aspose file tools*
The moose likes JSP and the fly likes Scriptlet getting ignored by Tomcat 5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Scriptlet getting ignored by Tomcat 5.0 " Watch "Scriptlet getting ignored by Tomcat 5.0 " New topic
Author

Scriptlet getting ignored by Tomcat 5.0

samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 192
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

Joined: Aug 13, 2007
Posts: 34
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 ]

Winay Kumar<br />SCJP 5.0
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
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 ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 192
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

Joined: Jan 10, 2002
Posts: 60053
    
  65

Debugging step #1: What is in the HTML that is sent to the browser?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 192
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scriptlet getting ignored by Tomcat 5.0
 
Similar Threads
Error page problem
Printing the requesturl?
Error compiling JSP
ServletContext's getContext method
ServletContext's getContext() method