wood burning stoves 2.0*
The moose likes JSP and the fly likes jsp forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp forward" Watch "jsp forward" New topic
Author

jsp forward

pippiri venu
Greenhorn

Joined: Apr 19, 2005
Posts: 8
in the bellowed prg i am passing x,y into next page by 2 ways.
which one is the best and why?

test1.jsp
---------
<%
String str="test2.jsp?x=20&y=30";
%>
<jsp:forward page="<%=str%>" />


test1.jsp
---------
<jsp:forward page="test2.jsp" >
<jsp aram name="x" value="20" />
<jsp aram name="y" value="30" />
</jsp:forward>


venu gopal p
shekar march chandra
Greenhorn

Joined: Jul 07, 2005
Posts: 25
Hi Venu,

I think the second option is good.

Because instead of using scriptlet, it is good to go for Jsp Elements.Thats what I guess.

Thanks,
Chandra
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Avoid using scriptlet in your jsp page. Avoid as much as you can.

Without scriptlet your jsp would be more readable, simple, and understandable to everyone.
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
Also works (at least in Tomcat):

<jsp:forward page="test2.jsp?x=20&y=30"/>

-Yuriy
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

I would avoid hard-coding the URL, whether you use scriptlets or not. Using the JSP actions ensure not only that your URL is correctly formatted, it also URL-encodes the parameter values as necessary.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp forward
 
Similar Threads
forward page and parameter
jsp:param more deatils needed
Anchor in Jsp:forward
jsp param tag(urgent)
jsp:param