aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Manning-JSP-escape sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Manning-JSP-escape sequence" Watch "Manning-JSP-escape sequence" New topic
Author

Manning-JSP-escape sequence

Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
Hi -
I am trying some escape sequences from the Manning book, chapter 12, section 12.1.4.
My JSP code mydate.jsp (the part inside the html body) is :
The opening tag of a scriptlet is <\%
The closing tag of a scriptlet is %>
<BR>
<%= "The opening tag of a scriptlet is <%" %>
<%= "The closing tag of a scriptlet is %\>" %>
The relevant portion of the generated servlet mydate_jsp.java from the "tomcat/work.." directory is :
out.write("<BR>\r\n-->\r\nThe opening tag of a scriptlet is ");
out.write("<%\r\nThe closing tag of a scriptlet is %>\r\n");
out.write("<BR>\r\n");
out.print( "The opening tag of a scriptlet is <%" );
out.write("\r\n");
out.print( "The closing tag of a scriptlet is %>" );
out.write("\r\n");
AND the output on running http://localhost:8080/myExamples/jsp/mydate.jsp
is :
The opening tag of a scriptlet is
The opening tag of a scriptlet is
(which is not correct).
I don't know where I'm going wrong with this, but somehow I'm not able to use the backslash escape properly. I have coded it exactly as per the aforementioned section of the Manning book.
Thanks, Sudd


SCJP 1.4, SCWCD, SCBCD 1.3
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Try t write the '<' tag as '& lt;' (whitout space) - and '>' as '& gt;' (whitout space)
Rene
[ December 25, 2002: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
Hi Rene -
What you suggested worked. But I'm still wondering how to use the escape sequences mentioned in Hanumant's book, or is it possible that its use depends upon the container, ie, does Apache tomcat have some problems in interpreting those? Or is it another error in Manning's book?
Thanks
bor
Greenhorn

Joined: Dec 26, 2002
Posts: 11
Originally posted by Sudd Ghosh:
Hi -
I am trying some escape sequences from the Manning book, chapter 12, section 12.1.4.
My JSP code mydate.jsp (the part inside the html body) is :
The opening tag of a scriptlet is <\%
The closing tag of a scriptlet is %>
<BR>
<%= "The opening tag of a scriptlet is <%" %>
<%= "The closing tag of a scriptlet is %\>" %>
The relevant portion of the generated servlet mydate_jsp.java from the "tomcat/work.." directory is :
out.write("<BR>\r\n-->\r\nThe opening tag of a scriptlet is ");
out.write("<%\r\nThe closing tag of a scriptlet is %>\r\n");
out.write("<BR>\r\n");
out.print( "The opening tag of a scriptlet is <%" );
out.write("\r\n");
out.print( "The closing tag of a scriptlet is %>" );
out.write("\r\n");
AND the output on running http://localhost:8080/myExamples/jsp/mydate.jsp
is :
The opening tag of a scriptlet is
The opening tag of a scriptlet is
(which is not correct).
I don't know where I'm going wrong with this, but somehow I'm not able to use the backslash escape properly. I have coded it exactly as per the aforementioned section of the Manning book.
Thanks, Sudd


bor
bor
Greenhorn

Joined: Dec 26, 2002
Posts: 11
Hi, Sudd,
Your code is correct. The reason that you see by that view is that <% ... %> will be interpret to be some script in browser. Please view the generated source from your browser. You can save it to mydate.html to understand it more clearly.
Originally posted by Sudd Ghosh:
Hi -
I am trying some escape sequences from the Manning book, chapter 12, section 12.1.4.
My JSP code mydate.jsp (the part inside the html body) is :
The opening tag of a scriptlet is <\%
The closing tag of a scriptlet is %>
<BR>
<%= "The opening tag of a scriptlet is <%" %>
<%= "The closing tag of a scriptlet is %\>" %>
The relevant portion of the generated servlet mydate_jsp.java from the "tomcat/work.." directory is :
out.write("<BR>\r\n-->\r\nThe opening tag of a scriptlet is ");
out.write("<%\r\nThe closing tag of a scriptlet is %>\r\n");
out.write("<BR>\r\n");
out.print( "The opening tag of a scriptlet is <%" );
out.write("\r\n");
out.print( "The closing tag of a scriptlet is %>" );
out.write("\r\n");
AND the output on running http://localhost:8080/myExamples/jsp/mydate.jsp
is :
The opening tag of a scriptlet is
The opening tag of a scriptlet is
(which is not correct).
I don't know where I'm going wrong with this, but somehow I'm not able to use the backslash escape properly. I have coded it exactly as per the aforementioned section of the Manning book.
Thanks, Sudd
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Manning-JSP-escape sequence