|
-
How to send parameters or value to one JSP to another
Larry,
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.
Thanks
Varma
-
Re: How to send parameters or value to one JSP to another
Varma <vbhupatiraju@business.com> 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.
Hi Varma,
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
jsp aram tags. This would look something like:
<jsp:forward page="secondpage.jsp">
<jsp aram name="parameter1_name" value="parameter1_value">
<jsp aram 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¶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.
- Larne
Similar Threads
-
Replies: 0
Last Post: 07-19-2005, 08:55 AM
-
By liliarum in forum ASP.NET
Replies: 1
Last Post: 06-14-2005, 04:07 PM
-
Replies: 0
Last Post: 04-07-2005, 03:40 AM
-
Replies: 6
Last Post: 03-02-2001, 02:42 PM
-
Replies: 2
Last Post: 04-07-2000, 01:20 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks