How to pass parameters between JSP page?

Discussions

Web tier: servlets, JSP, Web frameworks: How to pass parameters between JSP page?

  1. How to pass parameters between JSP page? (6 messages)

    Hi,
       I have three JSP pages:
       dbview.jsp -- grid style for browse record
       query.jsp -- define query condition and return
       edit.jsp -- freefrom style for add/update
       User usually operate as following:
       1.Enter function module
       2.Execute query and select record
       3.Execute Update/Add/Del operation
       I hope to share query condition between there pages,for example,when user execute a query and return dbview UI, then click Keyword href link and enter edit UI, when return from edit UI, I hope the dbview only display the records using current query condition.But how to store query condition, I still do not find the way. Now I use
      dbview?queryCond = "<%=strQueryCond%>"
      to pass query condition between pages.
      But It is bad because a long parameter will appear at browser address and it is not safe.
      Hope to get your comments!
      Thanks

      Luke
  2. How to pass parameters between JSP page?[ Go to top ]

    You have some options
    1. You could user hidden form variables.
    2. You could use Query String.
    eg. First.jsp?userid=me&password=pass
    In the Second.jsp you could retrieve the values using request.getParameter("user"). This would give you the user value and request.getParameter("pass") would give you password field.
  3. http://www.theserverside.com/discussion/thread.jsp?thread_id=7050
  4. How to pass parameters between JSP page?[ Go to top ]

    As for your query coming in the Browser header in the form use method="post". This prevents the query to be printed in the Browser header.
  5. How to pass parameters between JSP page?[ Go to top ]

    Hi,
    I found the reason is href.I test using the code:

    <form name = "t" action="t.jsp" method="post">
    Enter Word:
    <input type = "Text" name="t1">
    href="t.jsp" language= "javascript" onclick="t.submit()">Test
    <input type="Submit" value="Submit">
    </form>
    t.jsp
    out.println(request.getParameter("t1"));
    if you click "Test" link, it will display null, but if you click submit button, it will display you the value of t1 field.
    If you want to pass parameters to t.jsp using href. You only use href="t.jsp?".
    so question still exists!

    Luke


  6. How to pass parameters between JSP page?[ Go to top ]

    Try making the type of the button, "Button" instead of "Submit" and onclick of the button call a javascript function which has a document.submit().

    It works for me. Try it out.
  7. You might want to take a look at this thread for some ideas
    Usha