• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Manning-JSP-escape sequence

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try t write the '<' tag as '& lt;' (whitout space) - and '>' as '& gt;' (whitout space)
Rene
[ December 25, 2002: Message edited by: Rene Larsen ]
 
Sudd Ghosh
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic