Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: java programming  (Read 4062 times)

0 Members and 1 Guest are viewing this topic.

sravani

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    java programming
    « on: February 03, 2012, 10:08:17 PM »
    Hello.How can i transfer values from one jsp page to another jsp page.plz give an example illustrating it.plz give a fast reply

    Rob Pomeroy



      Prodigy

    • Systems Architect
    • Thanked: 124
      • Me
    • Experience: Expert
    • OS: Other
    Re: java programming
    « Reply #1 on: February 04, 2012, 08:55:30 AM »
    Use session variables or POST variables.  Can't give you illustrations, since I don't know JSP.  But Google does.
    Only able to visit the forums sporadically, sorry.

    Geek & Dummy - honest news, reviews and howtos

    papercupmachine



      Greenhorn

      • Paper cup machine
    • Experience: Beginner
    • OS: Windows XP
    Re: java programming
    « Reply #2 on: December 25, 2012, 02:59:06 AM »
    There are a few possibilities, depending on what exactly you need to
    do.

    If the first page is going to automatically invoke the second, you can
    use a jsp:include or jsp:forward, and pass the values with one or more
    jsparam tags. This would look something like:

    <jsp:forward page="secondpage.jsp">
    <jsparam name="parameter1_name" value="parameter1_value">
    <jsparam name="parameter2_name" value="parameter2_value">
    ...
    </jsp:forward>

    paramater1_value could be a simple expression, or a value of the form
    <%= something %>.

    If the first page requires the user to click a form submit button, the
    values can be passed as hidden fields, which would look like this:

    <form action="secondpage.jsp" method="POST">
    <input type="hidden" name="parameter1_name" value="parameter1_value">
    <input type="hidden" name="parameter2_name" value="parameter2_value">
    ...
    <input type="submit">
    </form>

    Again, the parameter values can be <%= %> expressions.


    If the page requires the user to click an href before proceeding, you
    can pass the parameters in a query string, as in:

    <a href="secondpage.jsp?paramater1_name=parameter1_value&paramater2_name=parameter2_value&... ">

    Again, you can use <%= %> tags for the values, but there are some
    things to watch for. If the result of the <%= %> is going to contain
    any of the characters %, &, = or / you might need to urlencode the
    values before they can be used. In this case, it would probably be
    easer to use some session variable, as you noted.