javax.servlet.jsp.JspException cannot be resolved to a type

把tomcat lib下的servlet-api.jar jsp-api.jar包导入eclise项目的lib包下 
阅读更多

tomcat cannot be resolved to a type

07-09

tomcat运行jsp文件显示错误rnrnAn error occurred at line: 2 in the jsp file: /saveMsg.jsprnmessageBean cannot be resolved to a typern1: <%@ page import="java.sql.*" %>rn2: rn3: rn4: rn5: rnrnrnbean代码rn[code=Java]rnimport java.sql.*;rnimport java.util.*;rnrnrnrnpublic class messageBeanrnrn private static Statement sta;rn private final static String dbURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MessageBoard";rn private final static String dbUSR="sa";rn private final static String dbPSW="21259520q";rn private Connection con=null;rn private String sqlStr=null;rn private ResultSet rs=null;rn rn //连接数据库rn public void connMsg()rn rn tryrn rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();rn rn con=DriverManager.getConnection(dbURL,dbUSR,dbPSW);rn sta=con.createStatement();rn rn catch(Exception e)rn rn e.printStackTrace();rn rn rn rn rn //关闭数据库rn public void closeMsg()rn rn tryrn rn con.close();rn sta.close();rn rn catch(Exception e)rn rn rn rn rn rn //增加数据库成员rn public void setMsg(String l_name,String l_content,String l_ip)rn rn connMsg();rn rn tryrn rn sqlStr="insert into message (name,content,ip) values('"+l_name+"','"+l_content+"','"+l_ip+"')";rn sta.executeUpdate(sqlStr);rn rn rn closeMsg(); rn rn catch(Exception e)rn rn e.printStackTrace();rn closeMsg();rn rnrn rnrnrn[/code]rnrnrnJSP文件出错的行是rn<%@ import "java.sql.*"%>rnrnrnrnrn<% rnString a="asfd";rnString b="sfda";rnString c="sdfsdf";rnub.setMsg(a,b,c) rn%>rnrnrnrnrn

“class” cannot be resolved to a type

10-20

jsp页面 编译报如标题错误 jsp文件全部在tomcat的root目录下 “class”也在相同目录下的一个.Java的文件中定义 jsp页面中也 通过<%@ page import = "com.ftsafe.util.*"%>引用 不知为何 大侠帮忙 感激涕零!页面代码如下:rnrn<%@ page language="java" contentType="text/html;charset=gb2312" %>rn<%@ page session="true" %>rn<%@ page import="java.io.*"%>rn<%@ page import = "com.ftsafe.util.*"%>rn<%@ page import="java.sql.*"%> rnrnrnrn<%rn String Randata = (String)session.getAttribute("RandomData");rnrn String ClientDigest = request.getParameter("Digest");rn rn rn rn /*如数据库中用户ID是中文需要转换rn //String UserID = new String(UserID1.getBytes("ISO8859_1"),"GB2312");rn //out.println(UserID);rn //out.println(ClientDigest);*/rnrn String UserKey=""; /*从数据库中得到的用户密钥,用于计算。硬件中的密钥文件是由该密钥产生的。是初始化工具完成的*/rn String ServerDigest=""; /*服务器端计算的结果*/rn byte digest[];rn rn UserKey = "123456"; /*由于数据库各处不同,通过查找后得赋值到UserKey中,示例为:“123456”*/rnrnrn rn Integer i = new Integer(UserKey.length());rn out.println("密钥长度"+i.toString());rn rn rn rn HMAC_MD5 hm = new HMAC_MD5(UserKey.getBytes());rn hm.addData(Randata.getBytes());rn rn digest = hm.sign();rn ServerDigest = hm.toString();rn if(ClientDigest.equals(ServerDigest))rn rn out.println("ok,equal!");rn rn elsern rn out.println("Sorry,clentDigest doesn't equal Server Digest!");rn rn%>rnrn rn rn Randata:rn <%=Randata%>rn ClientDigest:<%=ClientDigest%>rn rn rn UserKey:rn <%=UserKey%>rn ServerDigest:<%=ServerDigest%>rn rnrnrnrnrn

没有更多推荐了,返回首页