Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

pre-compilation of JSP  RSS feed

 
Swapna Sam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to pre-compile jsp,tomcat provides JSPC compiler to do this ,but I am unable to load jsp .Can anyone specify how to add class file in web.xml.
 
arpit singla
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can add your servlet in the web.xml as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/testServlet</url-pattern>
</servlet-mapping>
</web-app>

JSP can be put into ur web-application, if u are creating a separate application. Or u can put it into the webapps/examples/jsp folder if u are using the already created application
hope that helps
 
Swapna Sam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had one separate directory for my JSP's and I had taken one JSP file and compiled to java file using jspc tool ..
and compiled java file using javac to get class file
Now I endup with having pre-compiled jsp class file and jsp file
when I hit the page it is not taking the class I had specified in web.xml ,instead it is again compiling jsp file to servlet class and placing in appropriate work directory .
If I delete the JSP file ,page is not displayed
I need to point to pre-compiled class file when user hits on that page ..
I hope now my question is clear ..
Originally posted by arpit singla:
u can add your servlet in the web.xml as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/testServlet</url-pattern>
</servlet-mapping>
</web-app>

JSP can be put into ur web-application, if u are creating a separate application. Or u can put it into the webapps/examples/jsp folder if u are using the already created application
hope that helps


[This message has been edited by Swapna Sam (edited July 03, 2001).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!