• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP servlet problem

 
Varun Garg
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
 
Ashish Gauswami
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks for the reply.

Can you please where these .java and .class files of JSP gets stored?
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Tomcat they are located in the /work directory
 
Balaji Natarajan
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic