This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes simple problem with web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "simple problem with web.xml" Watch "simple problem with web.xml" New topic
Author

simple problem with web.xml

Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Pals,
I find no problem in the following deployment descriptor, but my tomcat4.0.4 finds
It reports problem in /web-app/servlet. Tell me why....:rooleyes:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Test Webapp</display-name>
<description>This is an online survey system.</description>
<servlet>
<servlet-name>
sessionTracker
</servlet-name>
<jsp-file>
sessionTrack.jsp
</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>
sessionTracker
</servlet-name>
<url-pattern>
/survey/sessionTracker
</url-pattern>
</servlet-mapping>
<session-config>
<!-specifies session timeout as 25 minutes. -->
<session-timeout>25</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>
sessionTracker
</web-resource-name>
<url-pattern>
/survey/sessionTracker
</url-pattern>
<http-method>
POST
</http-method>
<auth-constraint>
<role-name>
user
<role-name>
</auth-constraint>
</web-resource-collection>
</security-constraint>
<login-config>
<auth-method>
FORM
</auth-method>
<form-login-config>
<form-login-page>
/survey/logon.jsp
</form-login-page>
<form-error-page>
/survey/error.html
</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>user</role-name>
</security-role>
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

I knew the problem was simple and the solution was simpler.
The <jsp-file> element takes the relative path.
So it would be

<jsp-file>
/survey/surveyTrack.jsp
</jsp-file>

There were some minor typing mistakes also. So I am giving here the full web.xml file again.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Test Webapp</display-name>
<description>This is an online survey system.</description>
<servlet>
<servlet-name>
sessionTracker
</servlet-name>
<jsp-file>
/survey/sessionTrack.jsp
</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>
sessionTracker
</servlet-name>
<url-pattern>
/survey/sessionTracker
</url-pattern>
</servlet-mapping>
<session-config>
<!-- specifies session timeout as 25 minutes. -->
<session-timeout>25</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>
sessionTracker
</web-resource-name>
<url-pattern>
/survey/sessionTracker
</url-pattern>
<http-method>
POST
</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>
user
</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>
FORM
</auth-method>
<form-login-config>
<form-login-page>
/survey/logon.jsp
</form-login-page>
<form-error-page>
/survey/error.html
</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>user</role-name>
</security-role>
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>

[ August 05, 2002: Message edited by: Ashik uzzaman ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: simple problem with web.xml
 
Similar Threads
Declarative Security with Java EE (Glassfish)
WebLogic Form-Based Authentication Problem
form based login with LDAP
Problem with jboss login
Trouble with Authentication