当前位置: 代码迷 >> Java Web开发 >> [求助]看看有什么错误
  详细解决方案

[求助]看看有什么错误

热度:204   发布时间:2006-04-21 20:36:00.0
[求助]看看有什么错误

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /right/research/declare/conn.jsp

Generated servlet error:
[javac] Compiling 1 source file

G:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\right\research\declare\login_005fconfirm_jsp.java:23: cannot find symbol
symbol : method forNam(java.lang.String)
location: class java.lang.Class
Class.forNam("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
^

An error occurred at line: 6 in the jsp file: /right/research/declare/login_confirm.jsp

Generated servlet error:
G:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\right\research\declare\login_005fconfirm_jsp.java:109: cannot find symbol
symbol : class Sting
location: class org.apache.jsp.right.research.declare.login_005fconfirm_jsp
String pwd=new Sting(request.getParameter("passwords"));
^

An error occurred at line: 6 in the jsp file: /right/research/declare/login_confirm.jsp

Generated servlet error:
Note: G:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\right\research\declare\login_005fconfirm_jsp.java uses unchecked or unsafe operations.

An error occurred at line: 6 in the jsp file: /right/research/declare/login_confirm.jsp

Generated servlet error:
Note: Recompile with -Xlint:unchecked for details.
2 errors


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.19


数据库的连接为
<%@ page import="java.sql.*"%>
<%!
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
public void jspInit() //执行数据库连结动作
{
try
{
Class.forNam("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://WP:1433;DatabaseName=db_Research";
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
public void jspDestroy() //关闭变量
{
try
{
rs.close();
stmt.close();
conn.close();
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
String ToGB2312(String str)
{
byte GB2312[]=new byte[str.length()];
for(int i=0;i<str.length();i++)
{
GB2312[i]=(byte)str.charAt(i);
}
return new String(GB2312);
}

%>

登陆界面为
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
<style type="text/css">
<!--
.style1 { font-size: 14px;
color: #0000FF;
}
-->
</style>
<link href="../css/style.css" rel="stylesheet">
<script language="javascript">
<!--
function check(){
if(form1.users.value==""){
alert("请输入申报员登录名称");
form1.users.focus();
return false;
}
if(form1.passwords.value==""){
alert("请输入申报员密码");
form1.passwords.focus();
return false;
}
}
-->
</script>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="300" height="121" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#ffffff" bordercolordark="#D6E3D6" bordercolorlight="#FFFFFF">
<form action="login_confirm.jsp" method="post" name="form1">
<tr align="center" valign="middle" bgcolor="#F7F3EF">
<td height="30" colspan="2"><span class="style1">申报员登录</span></td>
</tr>
<tr>
<td height="30" align="center" valign="middle">用户名:</td>
<td width="172" align="left" valign="middle"><input name="users" type="text" class="txt_grey" id="users" style="width:120pt;">
</td>
</tr>
<tr>
<td height="30" align="center" valign="middle">密&nbsp;&nbsp;码:</td>
<td height="30" align="left" valign="middle"><input name="passwords" type="password" class="txt_grey" id="passwords" style="width:120pt;">
</td>
</tr>
<tr align="center" bgcolor="#F7F3EF">
<td height="30" colspan="2" valign="middle"><input name=substr type="submit" class="btn_grey" onClick="return check()" value="提交">
&nbsp;&nbsp;
<input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
</tr>
</form>
</table>

</body>
</html>

登陆验证为:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="conn.jsp" %>
<%
String name=new String(request.getParameter("users"));
String pwd=new Sting(request.getParameter("passwords"));
String sql="select * from tb_user where users='"+name+"' and passwords='"+pwd+"'+ and levels='申报员'";
rs=stmt.executeQuery(sql);
if(rs.next()){
session.setAttribute("users",name);
session.setAttribute("passwords",pwd);
%>
<script language=javascript>
alert('登录成功 进入申报首页');
window.location="../declare.htm";
</script>
<% }
else{
%>
<script language=javascript>
alert('输入申报员名或密码有误');
window.location="login.jsp"</script>
<%
}
%>



各位大虾帮帮忙
看看是什么原因
希望各位都给回复一下
谢谢
本人有急用

搜索更多相关主题的帖子: The  jsp  jasper  

----------------解决方案--------------------------------------------------------
??????
----------------解决方案--------------------------------------------------------
G:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\right\research\declare\login_005fconfirm_jsp.java:23: cannot find symbol
symbol : method forNam(java.lang.String)
location: class java.lang.Class
Class.forNam("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

方法不能定位,即找不到这个方法

Generated servlet error:
G:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\right\research\declare\login_005fconfirm_jsp.java:109: cannot find symbol
symbol : class Sting
location: class org.apache.jsp.right.research.declare.login_005fconfirm_jsp
String pwd=new Sting(request.getParameter("passwords"));

Sting这个类找不到

这些都是很简单的问题哈,注意检查哈
----------------解决方案--------------------------------------------------------
  相关解决方案