tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Lee Deliang" <just_dar...@hotmail.com>
Subject HELP PLS
Date Tue, 13 Jun 2000 16:06:33 GMT
Hi i got problems running this rather simple jsp app hope you guys can help 
me.

Modeled after the hellouser in the tutorials in Java.Soft. I have a jsp file 
call login.jsp. It has a page include of a html called main.html. Here I can 
enter a username and password.

After which when i press Log in I will pass the contents in username and 
password field to a java bean called UserHandler.java. It is just supposed 
to do simple validation against hard coded values in it  (instead of a DB) 
and pass it out (getproperty) to another jsp called response.jsp which 
login.jsp calls.

I placed everything in the Tomcat\webapp\examples\jsp\login folder and 
placed the bean and its class in 
Tomcat\webapp\examples\web-inf\classes\login folder

However I get the following internal server error:

Error: 500
Location: /examples/jsp/login/login.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Bad file argument to include
	at 
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:688)
	at 
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116)
	at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
	at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
	at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
	at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
	at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
	at java.lang.Thread.run(Unknown Source)

//----------------------------------------------------------------------
Here is my source code for the files. First is my login.jsp:

<%@ page import="login.UserHandler" %>

<jsp:useBean id="mybean" scope="page"
          class="login.UserHandler" />
<jsp:setProperty name="mybean" property="user_Name" />
<jsp:setProperty name="mybean" property="user_Password" />

<%@ page info="This is a Log in example without DB Support" %>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" background="background.gif">
<%@ include file="main.html" %>
<blockquote>
  <blockquote>
    <blockquote>
      <blockquote>
        <blockquote>
          <form method="get">
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <table width="75%" border="0">
              <tr>
                <td width="27%"><font face="Verdana, Arial, Helvetica, 
sans-serif" size="2">Login
                  Name: </font></td>
                <td width="73%">
                  <input type="text" name="user_Name" size="30" 
maxlength="50">
                </td>
              </tr>
              <tr>
                <td width="27%">Password:</td>
                <td width="73%">
                  <input type="text" name="user_Password" size="30" 
maxlength="8">
                </td>
              </tr>
              <tr>
                <td width="27%">&nbsp;</td>
                <td width="73%">
                  <input type="button" name="Log_Button" value="Log In">
                  |
                  <input type="reset" name="Reset" value="Reset">
                </td>
              </tr>
              <tr>
                <td width="27%">&nbsp;</td>
                <td width="73%">This is a simple log in interface WITHOUT DB 
support.
                  The login name is &quot;Darren&quot; and the password is 
&quot;8127075I&quot;</td>
              </tr>
            </table>
          </form>
          <p>&nbsp;</p>
        </blockquote>
      </blockquote>
    </blockquote>
  </blockquote>
</blockquote>
<%
    if ( request.getParameter("user_Name") != null ) {
%>

<%@ include file="response.jsp" %>

<%
    }
%>

</body>
</html>

and my main.html:

<blockquote>
  <table width="75%" border="0">
    <tr>
      <td>
        <blockquote>
          <blockquote>
            <blockquote>
              <blockquote>
                <p><img src="Hello.gif" width="200" height="95"></p>
              </blockquote>
            </blockquote>
          </blockquote>
        </blockquote>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
</blockquote>

and my UserHandler.java:

package login;
import java.util.*;
import java.io.*;
import java.lang.String.*;

public class UserHandler {

    private String username;
    private String userpassword;
		private int success = 0;
		private String text;

    public UserHandler()
		{
        username = "Darren";
        userpassword = "8127075I";
    }

    public void setUsername( String name, String password )
    {
			if((name.compareTo(username) == 0)&&(password.compareTo(userpassword) == 
0))
			{
				success = 1;
			}
			else
			{
				success = 0;
			}
    }

    public String getUsername()
		{
   		if(success == 1)
			{
				text = "Successful";
			}
			else
			{
				text = "Unsuccessful, You have entered an invalid User Name or Password. 
Pls click the Back Button on your browser to go back and try again";
			}
			return text;
  	}
}

and my reponse.jsp:

<table border="0" width="700">
<tr>
<td width="150"> &nbsp; </td>

<td width="550">

<h1>Login is <jsp:getProperty name="mybean"
        property="text" />!
</h1>

</td>
</tr>
</table>


Sorry for all the long codes, I would appreicate if anyone can help me debug 
this

Darren
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message