About Question enthuware.jwpv6.2.818 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.jwpv6.2.818 :

Post by ETS User »

There is a bug big like an home!
You couldn't write this: page="%=request.getParameter('redirectto')%"
Please fix it!
Thanks

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by admin »

As the explanation says, it is valid if the page is written in XML syntax instead of JSP syntax.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

tori3852
Posts: 38
Joined: Wed Oct 31, 2012 2:53 am
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by tori3852 »

But quotes are not valid:

Code: Select all

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

Code: Select all

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

Also,
it is valid if the page is written in XML syntax instead of JSP syntax.
It is mentioned in question, that this is JSP page, so not in XML syntax (JSP document is in XML syntax). But it's just a matter of terms.

harsh.sahajwani
Posts: 13
Joined: Sun Jan 20, 2013 5:58 am
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by harsh.sahajwani »

This question has incorrect answers.

Option 2 works but Options 3 and 4 do not work.

Explanation says Option 3 is currect, which is:
<jsp:forward page="%=request.getParameter('redirectto')%" />
However, the response that I get when I write the above line in a jsp and hit it using URL: http://localhost:7070/Servlets/abc.jsp? ... to=def.jsp

The browser shows:

HTTP Status 404 - /Servlets/%=request.getParameter('redirectto')%

--------------------------------------------------------------------------------

type Status report

message /Servlets/%=request.getParameter('redirectto')%

description The requested resource is not available.

================================================================
Explanation says Option 4 is currect, which is:
<jsp:forward page="<%=request.getParameter('redirectto')%>" />
However, this JSP does not compile. And the response that I get when I write the above line in a jsp and hit it using URL: http://localhost:7070/Servlets/abc.jsp? ... to=def.jsp

HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.abc_jsp

--------------------------------------------------------------------------------

type Exception report

message java.lang.ClassNotFoundException: org.apache.jsp.abc_jsp

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.abc_jsp
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


root cause

java.lang.ClassNotFoundException: org.apache.jsp.abc_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:202)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by admin »

The issue is that the quoting conventions as described JSP 2.2 Section 1.6 are not implemented consistently by the containers. Ideally, the following three are equivalent:
<jsp:forward page="<%=request.getParameter('redirect')%>" />
<jsp:forward page='<%=request.getParameter("redirect")%>' />
<jsp:forward page="<%=request.getParameter(\"redirect\")%>" />
In tomcat, at some point when the question was tested, all three worked. But now the first one doesn't work but second and third still do.
We have updated it to avoid this issue.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

harsh.sahajwani
Posts: 13
Joined: Sun Jan 20, 2013 5:58 am
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by harsh.sahajwani »

Options 3 and 5 mentioned in the question have missing starting "<" and closing ">" signs. These are written in the question as:

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

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

This creates a lot of confusion when the explanation shows these options as correct. Please, fix it!

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.818 :

Post by admin »

harsh.sahajwani wrote:Options 3 and 5 mentioned in the question have missing starting "<" and closing ">" signs. These are written in the question as:

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

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

This creates a lot of confusion when the explanation shows these options as correct. Please, fix it!
It is meant to create confusion. Option 3 is correct because in XML syntax, < and > are not used.
The option has been updated to make it more clear.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests