| Author |
trick question : page directive + forward
|
Steven Colley
Ranch Hand
Joined: Feb 18, 2005
Posts: 290
|
|
Hi folks, "Consider the source for the following two JSP pages, a.jsp and b.jsp. What i steh outcome of requesting each in turn? You can assume tha c.jsp is available in the same web app directory as a and b pages." a.jsp b.jsp Options: A - neither JSP pages translate. B - a.jsp translates ; b.jsp does not. C - b.jsp translates ; a.jsp does not. D - Both pages translate. E - Neither JPP page runs successfully. F - a.jsp runs successfully; b.jsp does not G - b.jsp runs successfully; a.jsp does not H - Both pages run successfully. Tip: oh god , sincerelly, i wouldn�t remember myself from this issue at this point, pay atention. (is that even correct?) tks.
|
SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
|
 |
Ernesto Leyva
Ranch Hand
Joined: Feb 23, 2006
Posts: 62
|
|
I was reading tje JSP Spec 2.0 page 111 It says about <jsp:forward> "...If the page output was unbuffered and anything has been written to it, an attempt to forward the request will result in an IllegalStateException..." so as long as you do not have any output before the <jsp:forward> the jps should compile and run OK.
|
 |
Steven Colley
Ranch Hand
Joined: Feb 18, 2005
Posts: 290
|
|
hum..almost there Ernesto there still is another trick issue here.. (tip: a.jsp page reagrding its content)
|
 |
Ernesto Leyva
Ranch Hand
Joined: Feb 23, 2006
Posts: 62
|
|
I think the only difference would it be the break-line in "a.jsp" the container may interpret the breakline as template text and send it to the outputstream in that case the <jsp:forward> becomes invalid because the stream is not buffered so it flushed. so "a.jsp" should throw and illegalstate exception. while "b.jsp" should be OK.
|
 |
Vivek Kinra
Ranch Hand
Joined: Mar 11, 2006
Posts: 66
|
|
|
I agree with Ernesto...
|
 |
Steven Colley
Ranch Hand
Joined: Feb 18, 2005
Posts: 290
|
|
Yes, u�re right. The only one difference is about the "carriage return".
|
 |
 |
|
|
subject: trick question : page directive + forward
|
|
|