Win a copy of Java Challengers this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

JSP's dynamic content not getting displayed

 
Ranch Hand
Posts: 47
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

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
 
A timing clock, fuse wire, high explosives and a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic