my dog learned polymorphism*
The moose likes JSP and the fly likes JSP's dynamic content not getting displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Watch "JSP New topic
Author

JSP's dynamic content not getting displayed

himanshu.harish agrawal
Ranch Hand

Joined: Oct 18, 2010
Posts: 47

Hello,

I have written a very basic JSP as below:


But I am unable to see sysout in my console, which means that my scriplet is not getting displayed.
In am running it in Apache tomcat container 5.5.30.

If we see then JSP are complied under "work" directory for the generated servlet. But that directory is also not having any generated servlet. So, basically mu JSPs are not getting compiled and hence page is showing up as simple HTML page.

I having a hard time rectifying it. Somebody kindly help me out!

Regards,
Himanshu
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

It's likely sending the output to a log file somewhere. In any case, scriptlets have been discredited since 2002. You should no longer be using them in JSP pages.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Looks fine to me.
What do you get when you invoke this page?
What url are you using to access it?

Maybe try something more complex in the page:
Here is a simple example that prints out server info, and checks EL expressions:




himanshu.harish agrawal
Ranch Hand

Joined: Oct 18, 2010
Posts: 47

Hello Stefan,

Greetings and thanks for reply!!!

Below is the output which I got


Which suggests that my scriplets are not executing. And as I said I am not even getting compiled JSP servlets under "work" directory.
NOTE: I am not manually compiling my JSPs through ant task. I remember tomcat compiles them on its own.
My web context root is "webdav" and I am running it as below
Just as a try out I have tried to run this both in Jakarat Tomcat 5.0 also apart from Apache Tomcat 5.5.33 but none is displaying JSPs correctly. Initially I tried with default configurations and then I tried adding "Context" element in my conf/server.xml. But none is helping.
I remember that few months back I also was able to execute JSPs but then later my system was reformatted and now with new installation all these softwares My JAVA_HOME env. variable is also correctly set.
I am unable to execute my JSPs. :(

Please help me out as I am preparing for OCPWCD and my JSP container is not working. :(

Regards,
Himanshu
himanshu.harish agrawal
Ranch Hand

Joined: Oct 18, 2010
Posts: 47

Bear Bibeault wrote:It's likely sending the output to a log file somewhere. In any case, scriptlets have been discredited since 2002. You should no longer be using them in JSP pages.


Hello Bear,

Thanks for reply!!!

Ok, please see me rely which I have posted to Stefan. Even those scripltes are not working for me. It seems my JSP container is not working as my JSPs are not compiling.


Regards.
Himanshu
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

YOur web app is likely misconfigured.

Start from scratch building a web app one step at a time, making sure that it works each step along the way.

Start by creating the context root folder, a simple index.jsp containing a minimal EL expressions such as ${3+4}, a WEB-INF folder, and a minimum web.xml in WEB-INF. Make sure this starts in Tomcat. Until you can get this working any other work is wasted time.
himanshu.harish agrawal
Ranch Hand

Joined: Oct 18, 2010
Posts: 47

Bear Bibeault wrote:YOur web app is likely misconfigured.

Start from scratch building a web app


Hello Bear,

Thanks a lot!!! Yes, there were some issues in my web.xml; actually I configured a servlet in my web.xml but later I deleted that servlet but didn't delete its configuration in web.xml. Because of this, it seems my web container was causing issues. Once I deleted that configuration I could see my JSP scripltes executing well.

Silly mistake but a good lesson to learn!

Thanks again!!!

Regards,
Himanshu
Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

himanshu.harish agrawal wrote:

Thanks a lot!!! Yes, there were some issues in my web.xml; actually I configured a servlet in my web.xml but later I deleted that servlet but didn't delete its configuration in web.xml . Because of this, it seems my web container was causing issues. Once I deleted that configuration I could see my JSP scripltes executing well.

Regards,
Himanshu


If the servlet was deleted and not the configuration in web.xml it must give ClassNotFoundException , why it's not giving the exception ???
himanshu.harish agrawal
Ranch Hand

Joined: Oct 18, 2010
Posts: 47

Arun Giridharan wrote:If the servlet was deleted and not the configuration in web.xml it must give ClassNotFoundException , why it's not giving the exception ???


Exactly, but only when you try to access that servlet, and luckily I didn't!

Regards,
Himanshu
 
jQuery in Action, 2nd edition
 
subject: JSP's dynamic content not getting displayed
 
Similar Threads
Cannot get to the error page
Servlets and CSS
SimpleTagSupport implementation problem
JSP to HTML on serverside
basic jsp