Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:forward

 
janne s
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi! ranchers,

can anyone explain about this tag...
is it a valid tag?

<jsp:forward page="%=request.getParameter('redirectto')%" />



Thank you in advance
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the foll. is correct?

<jsp:forward page="<%=request.getParameter('redirectto')%>"/>

http://java.sun.com/products/jsp/tags/11/syntaxref11.fm9.html
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's a valid tag...
but the container will look for the "%=request.getParameter('redirectto')%" resource...
correct me if i wrong..
 
Bassam Zahid
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tag present in the first post is valid because it is a JSP Document(XML) tag. When using JSP Document following is valid:


In JSP Document runtime attribute values are passed as above.

Is it clear now ?
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bassam is right. The above syntax is JSP Document and not JSP page.
The clue is the missing '<' and '>'. In JSP Documents, the request time attributes (expressions) do not contain '<' and '>'.

But I couldn't get the above tag to work in Tomcat 5.0.30

<jsp:forward page="%=request.getParameter('redirectto')%" />

I had to change it to...

<jsp:forward page='%=request.getParameter("redirectto")%' />

as I was getting a compile time error.
C:\jakarta-tomcat-5.0.30\work\Catalina\localhost\vish\org\apache\jsp\xmlCaller_jsp.java:54: unclosed character literal
_jspx_page_context.forward(request.getParameter('redirectto'));


I had to swap the single quotes with the double quotes to get it working. So I am inclined to believe that the above code in question might still be invalid.

What do you say, Bassam?
 
janne s
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! ranchers

Thanks for your replies
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic