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 .
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").
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:
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 ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Joined: Jul 27, 2005
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
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 ???
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.