<parag>
just one more question, is this valid: ?
String eventName = "myEvent";
response.sendRedirect(
response.encodeRedirectURL("/foodir/foo.jsp?eventName=" + eventName));
</parag>
Yes, it is valid! You can use the JSP compiler on the JSP file
to see the generated servlet code.
<parag>also, why will the following NOT work?:</parag>
It should be
String eventName = "myEvent";
...
<jsp:forward page="eventNotFound.jsp?event=URLEncoder.encode(eventName)"/>
Please note that <jsp:forward> is an action and not a scriptlet <% %>.
It allows the request to be forwarded to another JSP, a servlet, or a static
resource.
So, u can use it as
<jsp:forward page=" url"/>
OR
<jsp:forward page=" urlSpec">
<jsp:param name="paramName" value="paramValue"/>
</jsp:forward>
The actual translation happens at runtime, as you might alreaady be aware.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Parag V Thakur
Sent: Friday, September 29, 2000 1:24 AM
To: [EMAIL PROTECTED]
Subject: Re: what is URL rewriting?
> Hope this helps.
yup! u have been great help...
just one more question, is this valid: ?
String eventName = "myEvent";
response.sendRedirect(
response.encodeRedirectURL("/foodir/foo.jsp?eventName=" + eventName));
also, why will the following NOT work?:
String eventName = "myEvent";
...
<jsp:forward
page="eventNotFound.jsp?event=<%=URLEncoder.encode(eventName)%>"/>
thanks!
parag.
> ---------------
> String eventName = request.getParameter("eventName");
...
> if(eventNotFound) {
>
> <jsp:forward
> page="eventNotFound.jsp?event=<%=URLEncoder.encode(eventName)%>"/>
> }
> -----------------
>
> is this URL rewriting? also, could anyone tell me why this code is not
> running?
> the error i get is:
>
> javax.servlet.ServletException
> at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:386)
> at
>
_0002feventView_0002ejspeventView_jsp_36._jspService(_0002feventView_0002ejs
> peventView_jsp_36.java:447)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:174)
> at
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:160)
> at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
> at java.lang.Thread.run(Thread.java)
>
> Root cause:
> java.lang.IllegalArgumentException
> at javax.servlet.http.HttpUtils.parseName(HttpUtils.java:285)
> at
javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:154)
> at
>
org.apache.tomcat.core.RequestDispatcherImpl.addQueryString(RequestDispatche
> rImpl.java:326)
> at
>
org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
> ava:155)
> at
>
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:357)
> at
>
_0002feventView_0002ejspeventView_jsp_36._jspService(_0002feventView_0002ejs
> peventView_jsp_36.java:195)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:174)
> at
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:160)
> at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
> at java.lang.Thread.run(Thread.java)
>
>
> thanks!
> parag.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets