View Full Version : How to append two values as a URL

12-10-2010, 08:09 PM
Hi to all,

Sorry to ak this question it may be easy but i didn't got the solution on net please provide the proper answer.

My question is : I am defining hyperlink in struts as
<a href= Javascript:formSubmit(<bean:write name="AA" property="aa">','<bean:write name="BB" property="bb">)

defining function as

function formSubmit(Aa,Bb)

----> in above statement how to pass the second parameter(i.e Bb)....I tried different ways but giving syntax error.

please post the ans as soon as possible

Old Pedant
12-10-2010, 10:21 PM
You aren't even passing the first parameter correctly or using it correctly.

<a href="formSubmit('<bean:write name="AA" property="aa">','<bean:write name="BB" property="bb">');">

You need the apostrophes around EACH ARGUMENT, separately.

And then:

function formSubmit(Aa,Bb)
"/accesingpage.do?method=create&AA=" + encodeURIComponent(Aa)
+ "&BB=" + encodeURIComponent(Bb);