Tomcat/JSP

J

Jon.Trav

I'm trying to call a jsp page when tomcat is started. I tried putting
it into the web.xml file in the conf folder. it says it can't find the
class. The jsp page is in the ROOT folder.
 
R

riccardonews

This is the right floder list

/tomcatdir/webapps/myproject/index.jsp

/tomcatdir/webapps/myproject/WEB-INF/web.xml

/tomcatdir/webapps/myproject/WEB-INF/classes/myclass.class

/tomcatdir/webapps/myproject/WEB-INF/lib/mylib.jar

call index.jsp into your browser by
http://localhost:8080/myproject/index.jsp

bye bye!
Riccardo

(e-mail address removed) ha scritto:
 
J

Jon.Trav

I got that to work, but I want it to run automatically when the tomcat
service is started. I read that if you put it in the ROOT dir and the
ROOT web.xml file it would work with the load-on-start parm. This is
saying call not found.
 
R

riccardonews

if you want to start your application with
index.jsp you put this code in your web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>My Application</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

the welcome page is index.jsp.


(e-mail address removed) ha scritto:
 
J

Juha Laiho

I got that to work, but I want it to run automatically when the tomcat
service is started. I read that if you put it in the ROOT dir and the
ROOT web.xml file it would work with the load-on-start parm. This is
saying call not found.

Hmm.. I think JSP's cannot be run as "init-on-startup" modules.
You need servlets for that. Which makes quite a lot of sense:
JSPs primarily output documents (primarily HTML) -- and where
would you output the document with no browser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top