| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 775 人关注过本帖
标题:jsp登录检测问题
取消只看楼主 加入收藏
赤冰
Rank: 1
等 级:新手上路
帖 子:397
专家分:0
注 册:2007-1-22
收藏
 问题点数:0 回复次数:2 
jsp登录检测问题
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, SQLException {
LoginForm login = (LoginForm) form;// TODO Auto-generated method stub

Class.forName("org.postgresql.Driver");
String url="jdbc:postgresql://localhost:/test";
String user="postgres";
String password="1234";
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs;
String sql="selcet * from manager";
rs= stmt.executeQuery(sql);
while(rs.next())
{
String name=rs.getString(2);
String pass=rs.getString(3);
if(name.equals(login.getName()) && pass.equals(login.getPassword()))
{
request.setAttribute("manager", login.getName());
request.setAttribute("mpass", login.getPassword());
return mapping.findForward("ok");
}
}


return null;

}
这是我做的登录的代码,但出现了以下错误:
javax.servlet.ServletException: No suitable driver
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.sql.SQLException: No suitable driver
java.sql.DriverManager.getConnection(DriverManager.java:545)
java.sql.DriverManager.getConnection(DriverManager.java:171)
com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:46)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
请问是怎么回事啊
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

搜索更多相关主题的帖子: jsp String postgresql form 
2007-01-25 11:58
赤冰
Rank: 1
等 级:新手上路
帖 子:397
专家分:0
注 册:2007-1-22
收藏
得分:0 
咋弄啊?什么意思?
2007-01-25 12:04
赤冰
Rank: 1
等 级:新手上路
帖 子:397
专家分:0
注 册:2007-1-22
收藏
得分:0 
解决了,我的sql语句写错了,还有就是url也写的问题.已经ok!!!
谢谢了
2007-01-25 14:13
快速回复:jsp登录检测问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018196 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved