aspose file tools
The moose likes Servlets and the fly likes pre-compilation of JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "pre-compilation of JSP" Watch "pre-compilation of JSP" New topic
Author

pre-compilation of JSP

Swapna Sam
Greenhorn

Joined: Jul 03, 2001
Posts: 7
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

Joined: Jun 18, 2001
Posts: 66
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

Joined: Jul 03, 2001
Posts: 7
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pre-compilation of JSP
 
Similar Threads
How to retain formatting when passing a String to a JSP
jsp tag library
i18n - not recognised in WAS 6.0
can not compile JSP
I want to use StringEscapeUtils in a JSP with JSTL (no scriplets!)