• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scriptlet getting ignored by Tomcat 5.0

 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I have written 1 JSP with a System.out.println() statement in the scriptlet . However it has been observed that the scriptlet code gets ignored by the tomcat and rest of the stuff is getting rendered properly. I am using tomcat 5.0 (exicutable version) and also I checked it out that in web.xml there is no entry for <scripting-invalid> tag .
I deployed this jsp inside web-app/ MyProject/test.jsp where Myproject is my project .
I am using IE 7 . Can anybody please tell me the cause behind this.
Here is the code for jsp which I want to deploy .

 
winay Kumar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the output of System.out.println ("Scriptlet found"); is printing in to the stdout.log file which is inside log folder. you can check this inside that file. if you want to print to browser then use out.println("message").

[ October 28, 2007: Message edited by: Jagadabi Vinay Kumar ]
[ October 29, 2007: Message edited by: Jagadabi Vinay Kumar ]
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Actually it's not being ignored. Your output is going to the console!

If you want your output statements get rendered on your browser, then use:


Instead of:


And the reason for this is that System.out is the standard output stream, whereas out is of type JspWriter.

I hope i made myself clear ...

Best of luck ...
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Thanks for the reply. But I have checked on the output consol . its not there. As well I tried using out.println("something") . As far as my understanding goes it should be inside scriplet like
<%
out.println("something")
%>
But that is also not getting rendered . Can anybody please tell me the reason behind the same.
Thanks in advance
Samir
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Debugging step #1: What is in the HTML that is sent to the browser?
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the above example only "This is a test JSP " should be send to the browser and that is getting rendered properly on the browser (In case of IE) .
And if I try to run the same example in mozilla then output is

This is a test JSP
followed by <%System.out.println("This is a test JSP"); %>
thats the code in the scriptlet gets rendered on the browser if I use mozilla.
Why this is happening ???
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "what is the HTML that is sent to the browser", Bear means "what code is sent to the browser", not "what do you see in the browser?".

To determine this, right click on the page and select "view html source".
See if your printed statement is in there. If it is, but it isn't showing up in the rendered page, there is probably an error in your HTML.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic