Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy How to append two values as a URL

    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)
    {
    document.forms[0].action="/accesingpage.do?method=create&AA=+Aa"

    ----> 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

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    You aren't even passing the first parameter correctly or using it correctly.
    Code:
    <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:
    Code:
    function formSubmit(Aa,Bb)
    {
        document.forms[0].action=
            "/accesingpage.do?method=create&AA=" + encodeURIComponent(Aa)
            + "&BB=" + encodeURIComponent(Bb);
        ...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •