File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes WAS 5.0 and Servlets (web.xml) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "WAS 5.0 and Servlets (web.xml)" Watch "WAS 5.0 and Servlets (web.xml)" New topic
Author

WAS 5.0 and Servlets (web.xml)

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi

I am having a little trouble with Websphere 5.0 and a little login Servlet, basically I have created my loginservlet and jsp pages, zipped them all up into a .war file (the structure is correct) and installed it into WAS5.0 with no problem.

The problem comes when I click on the 'login' button. Now the jsp should call the login Servlet (LoginServlet) but instead I get a URL not found on this server, error.

Here is a brief description of what/where the files are kept and the web.xml

<?xml version="1.0" encoding="UTF-8"?>
< !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 id="WebApp_1136296849094">
<servlet id="Servlet_1136296848734">
<servlet-name>LoginServlet</servlet-name>
<servlet-class>uk.co.domain.servlets.LoginServlet</servlet-class>
</servlet>
<servlet-mapping id="ServletMapping_1136296849094">
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
</web-app>

WAS 5.0 installed under:
C:\Program Files\WebSphere\AppServer

And my servlet is under:
...\installedApps\devsrv\domain.ear\domain.war\WEB-INF\classes\uk\co\domain\servlets\LoginServlet.class

login.jsp uses the following form:
<form name="frmLogin" action="/LoginServlet" method="POST">
...
</form>

Error:
The requested URL /LoginServlet was not found on this server.

Any help would be greatly appreciated, this is doing my nut!
Deepak Shankar
Greenhorn

Joined: Dec 14, 2005
Posts: 12
Hi Secker,

What is the target url in the "html form", where you are doing a submit?

If your target url is /LoginServlet, then you should have an url entry in web.xml.

sample,


<servlet>
<servlet-name>LoginServlet</servlet-name>
<display-name>LoginServlet</display-name>
<servlet-class>com.whereever.LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>

Make an entry for your target in the web.xml and try it.

[ January 03, 2006: Message edited by: Deepak Shankar ]
[ January 03, 2006: Message edited by: Deepak Shankar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WAS 5.0 and Servlets (web.xml)