This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with web.xml

 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me preface this by saying I am pretty new to the world of servlets and jsps.

I've got a little application set up, and it's been working so far. I've added another class that I want to be able to call from a jsp. I've added it to my web.xml, and now when I try to open my first page, I get a 404 from tomcat. If I take out the servlet and servlet mapping for the second servlet (CRNListObjects), it works fine.

Here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>CRNSignon</servlet-name>
<servlet-class>com.crn.hcsc.CRNSignon</servlet-class>
</servlet>

<servlet>
<servlet-name>CRNListObjects></servlet-name>
<servlet-class>com.crn.hcsc.CRNListObjects</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>CRNSignon</servlet-name>
<url-pattern>/Logon.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>CRNListObjects</servlet-name>
<url-pattern>ListObjects.do</url-pattern>
</servlet-mapping>

<display-name>crn</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

What am I doing wrong?

Thanks

Andrew
 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, If u have copied the web.xml and pasted it as is in this
forum, then probably.
check the > in your servlet-name tag (second servlet).

I Hope this helps.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've added another class that I want to be able to call from a jsp.


Is that class a servlet?
 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi, If u have copied the web.xml and pasted it as is in this
forum, then probably.
check the > in your servlet-name tag (second servlet).


Dang, I thought that was it! I fixed that, but I get the same result.

Originally posted by Ben Souther:


Is that class a servlet?


Yes it is.
[ May 28, 2005: Message edited by: Andrew McLaren ]
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<servlet-mapping>
<servlet-name>CRNListObjects</servlet-name>
<url-pattern>ListObjects.do</url-pattern>
</servlet-mapping>
W


right:
<servlet-mapping>
<servlet-name>CRNListObjects</servlet-name>
<url-pattern>/ListObjects.do</url-pattern>
</servlet-mapping>

in the lt;url-pattern>/BlaBla.do</url-pattern>
don't forget the slash / !!!
gruesse
ser
 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sergio mendez-rueda:


right:
<servlet-mapping>
<servlet-name>CRNListObjects</servlet-name>
<url-pattern>/ListObjects.do</url-pattern>
</servlet-mapping>

in the lt;url-pattern>/BlaBla.do</url-pattern>
don't forget the slash / !!!
gruesse
ser



Hooray!

Two stupid mistakes in one morning! Teach me to try and learn some stuff on a weekend Thanks!

Peace

Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic