I would suggest you to install and work with Netbeans 5.0. Netbeans 5.0 have bundled Tomcat which work out of the box. Than you will not have problems like these before deployment.

Allen Williams wrote:
Well, I can't figure out this directory structure and finding stuff at all.
Here are my directory listings

docroot= /usr/share/tomcat5/webapps/smsinfo
*******************************************
anw-dev:/usr/share/tomcat5/webapps/smsinfo$ ls -laF
total 20
drwxr-xr-x  3 anw     root 4096 2006-05-19 21:14 ./
drwxr-xr-x  9 tomcat5 root 4096 2006-05-13 16:10 ../
-rw-r--r--  1 anw     anw   564 2006-05-19 21:20 login.jsp
drwxr-xr-x  4 anw     anw  4096 2006-05-19 21:15 WEB-INF/
-rw-r--r--  1 anw     anw   241 2006-05-19 21:20 welcome.jsp

********************************************
anw-dev:/usr/share/tomcat5/webapps/smsinfo/WEB-INF$ ls -laF
total 20
drwxr-xr-x  4 anw anw  4096 2006-05-19 21:15 ./
drwxr-xr-x  3 anw root 4096 2006-05-19 21:14 ../
drwxr-xr-x  3 anw root 4096 2006-05-18 20:27 classes/
drwxr-xr-x  2 anw root 4096 2006-05-13 15:49 lib/
-rw-r--r--  1 anw anw   440 2006-05-19 21:18 web.xml

(lib is empty)
***********************************************
anw-dev:/usr/share/tomcat5/webapps/smsinfo/WEB-INF/classes$ ls -laF
total 12
drwxr-xr-x  3 anw root 4096 2006-05-18 20:27 ./
drwxr-xr-x  4 anw anw  4096 2006-05-19 21:15 ../
drwxr-xr-x  2 anw root 4096 2006-05-18 20:27 UserConfig/
*************************************************
anw-dev:/usr/share/tomcat5/webapps/smsinfo/WEB-INF/classes/UserConfig$
ls -laF
total 12
drwxr-xr-x  2 anw root 4096 2006-05-18 20:27 ./
drwxr-xr-x  3 anw root 4096 2006-05-18 20:27 ../
-rwxr-xr-x  1 anw root 1322 2006-05-19 21:18 login.class*
*************************************************

Here is the source to login.jsp (located in docroot,
/usr/share/tomcat5/webapps/smsinfo):

<html>
<head>
        <title>SMS Information Transfer Login Page</title>
        <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" onload="document.loginForm.username.focus()">
        <!-- form name="loginForm" method="post"
action="/servlet/UserConfig.login" -->
        <form name="loginForm" method="post"
action="WEB-INF/classes/UserConfig.login">
                <p>User Name:<input type="text" name="username"></p>
                <p>Password:<input type="password" name="password"></p>
                <p><input type="Submit" name="Submit"></p>
        </form>
</body>
</html>

*************************************************
Here is the source to login.class:

package UserConfig;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class login extends HttpServlet
    {
    private String target="/welcome.jsp";
    private String getUser(String username, String password)
        {
        return username;
        }
    public void doGet(HttpServletRequest request, HttpServletResponse
response)
        throws ServletException, IOException
        {
        // If it is a Get request, forward to doPost
        doPost(request, response);
        }
    public void doPost(HttpServletRequest request, HttpServletResponse
response)
        throws ServletException, IOException
        {
        // Get user name and password:
        String username= request.getParameter("username");
        String password= request.getParameter("password");
        String user= getUser(username, password);
        // Add fake user to the request
        request.setAttribute("USER", user);
        ServletContext context= getServletContext();
        RequestDispatcher dispatcher= context.getRequestDispatcher(target);
//target defined above
        dispatcher.forward(request, response);
        }
    }
***************************************************
Here is the source for my web.xml file:

<?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/j2ee/dtds/web-app_2_3.dtd";>

<web-app>
<servlet>
    <servlet-name>login</servlet-name>
    <servlet-class>UserConfig.login</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>login</servlet-name>
    <url-pattern>/servlet/login</url-pattern>
</servlet-mapping>
</web-app>
*******************************************************

As can be seen, all this is very simple, my very first Tomcat web app.  I
have
followed the instructions in

http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html

When I go to http://localhost:8180/smsinfo/login.jsp, I get the form, input
some text, then get the following screen from tomcat:

HTTP Status 404 - /smsinfo/WEB-INF/classes/UserConfig.login

Type: Status report

Message: /smsinfo/WEB-INF/classes/UserConfig.login

Description: The requested resource
(/smsinfo/WEB-INF/classes/UserConfig.login) is not available.
Apache Tomcat/5.0
*****************************************************

I've been screwing around with this for days, reading books and the web
help,
but can't find out what's wrong.  Any help is greatly appreciated.

TIA and regards,
anw


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Mladen Adamovic
http://home.blic.net/adamm
http://www.shortopedia.com http://www.froola.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to