How to send parameters or value to one JSP to another
What are the ways to send parameter values from one plain jsp page(no
html inside in it) to another jsp.
I know one way is through session variables.
Re: How to send parameters or value to one JSP to another
Varma <firstname.lastname@example.org> wrote:
> What are the ways to send parameter values from one plain jsp page(no
>html inside in it) to another jsp.
>I know one way is through session variables.
There are a few possibilities, depending on what exactly you need to
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:
<jsparam name="parameter1_name" value="parameter1_value">
<jsparam name="parameter2_name" value="parameter2_value">
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">
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¶mater2_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.
Last Post: 07-19-2005, 09:55 AM
By liliarum in forum ASP.NET
Last Post: 06-14-2005, 05:07 PM
Last Post: 04-07-2005, 04:40 AM
Last Post: 03-02-2001, 03:42 PM
Last Post: 04-07-2000, 02:20 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center