• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JSP servlet problem

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

According to HF, whenever a JSP is converted in Servlet the servlet's name is preceded by My and ends with _jsp.

For eg,

JSP file name - Counter
Servlet generated by Container - MyCounter_jsp.java

Now when i looked in my application directory, the servlet was created by name of Counter_jsp.java and when i try to do mapping in DD i am not able to access Counter_jsp.java servlet.

I am using Tomcat.

Please Help !

Thank You
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess you are mis-reading the book. the doesnt say that your jsp will be prefixed with 'My'. the example they have used has jsp file name 'MyJsp.jsp' so it will be converted to MyJsp_jsp.java/class.

also if you will bring the class over to your WEB-INF/classes with proper package hierarchy, and add <servlet> and <servlet-mapping> tags to your DD, it will let you access that servlet.
 
Varun Garg
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

Can you please where these .java and .class files of JSP gets stored?
 
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Tomcat they are located in the /work directory
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to map JSP files in DD use <Jsp-file> tag within servlet as given below.

<servlet>
<servlet-name>main</servlet-name>
<jsp-file>/main.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>/main/*</url-pattern>
</servlet-mapping>

I placed main.jsp directly under web-application root.
Hope that helps.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that the name of the converted JSP file is left to the container provider. There's no rule for the filename, so it's not correct either to say that 'MyJsp.jsp' will be converted to MyJsp_jsp.java/class.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
The name of the generated java and compiled class files are fully depends on the Container i.e. Server vendors.
e.g. for JBOSS/tomcat,
....\jboss-4.0.0\server\default\work
for weblogic ..\bea\user_projects\domains\myDomain\myserver\.wlnotdelete\extract\....\jsp_servlet\....class
only . no java file . you have to decompile it.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic