注册 登录
编程论坛 J2EE论坛

这段提示是什么意思

susan001983 发布于 2007-07-30 13:36, 1380 次点击
请问各位,

我写了个登录页,按下登录按钮又完全没有反应,页面也不跳转,

我看了,数据库应该是连上了.

请帮我看看,下面这段提示是什么意思呀?

2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
2007-7-30 13:29:59 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
15 回复
#2
Gramary2007-07-30 13:38
你是用的Struts吗??
应该是你的ACTION没设置跳转 这里应该是启动服务器的时候出现的配置文件信息吧
#3
susan0019832007-07-30 13:47
是用struts写的,也是启动服务器的时候出现的配置文件信息,没错.

我表单里的action是这样写的
<html:form action="/index">
有什么问题吗?

#4
Gramary2007-07-30 13:57
恩`
那个启动信息是没有错误的``
你改成这样试一下<html:form action="/index.do">
#5
susan0019832007-07-30 14:02
还是没有反应,又出现这样的错了,

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
#6
susan0019832007-07-30 14:05
Gramary,我觉得你很热心,也很有才,

你当版主吧.

我投了你一票,支持你.
#7
Gramary2007-07-30 14:12
呵呵
谢谢啊`` 太抬举了`
你这是数据库出现在的问题``
你把你的 index.do对应的Action类的方法给我看看``

#8
susan0019832007-07-30 14:18

这是IndexAction:

public class IndexAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
IndexForm indexForm = (IndexForm) form;

HttpSession session = request.getSession();
IndexOper op = new IndexOper();
if(op.getControlResult(indexForm))
{
User user = op.get_user(indexForm);
session.setAttribute("user",user);
String uname = request.getParameter("user");
session.setAttribute("uname",uname);
return mapping.findForward("success");
}

return mapping.findForward("fail");
}
}



//这是IndexOper
public class IndexOper {
public boolean getControlResult(IndexForm user)
{
boolean flag = false;
Connection con=null;
PreparedStatement st=null;
ResultSet rs=null;
DBdrive db=new DBdrive();

try
{
con = db.getDBdrive();
st = con.prepareStatement("select * from administrator where user_name=? and user_pwd=? ");
st.setString(1,user.getUser_name());
st.setString(2,user.getUser_pwd());
rs = st.executeQuery();
while(rs.next())
{
if(user.getUser_name().equals(rs.getString(1))&&user.getUser_pwd().equals(rs.getString(2)));
flag=true;
}
return flag;
}
catch(Exception e)
{
return false;
}
finally
{
//db.CloseDBdriver();
}
}


public User get_user(IndexForm user){
Connection con=null;
PreparedStatement st=null;
ResultSet rs=null;
User us = new User();
DBdrive db=new DBdrive();
try
{
con = db.getDBdrive();
st = con.prepareStatement("select * from administrator where user_name=? and user_pwd=? ");
st.setString(1,user.getUser_name());
st.setString(2,user.getUser_pwd());
rs = st.executeQuery();

if(rs.next()){

us.setU_id(rs.getInt("user_id"));
us.setU_name(rs.getString("user_name"));
}
}catch(Exception e){

}
finally
{
//db.CloseDBdriver();
}
return us;
}
}

#9
Gramary2007-07-30 14:22
你有没有确定代码执行到哪里就报异常了啊````
你这种连接数据库的方式我没用过``一下子看不出来是什么问题
你要先确定程序执行到哪里``才出现的问题,这样就容易解决....
#10
susan0019832007-07-30 14:40
我试了好多次,

后台也不报错,

我在DBdriv(数据库连接文件)中的后台提示也没出来,

我想就是数据库连接的错误,

可又找不出到底是哪错了.
#11
Gramary2007-07-30 14:50
你用的是Eclipse吧`
你会用断点吗???
不会就用原始的错误定位方法
public class IndexAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
IndexForm indexForm = (IndexForm) form;
System.out.println("11111111111");
HttpSession session = request.getSession();
IndexOper op = new IndexOper();
System.out.println("22222222222");
if(op.getControlResult(indexForm))
{
User user = op.get_user(indexForm);
session.setAttribute("user",user);
System.out.println("33333333333");
String uname = request.getParameter("user");
session.setAttribute("uname",uname);
System.out.println("44444444444444");
return mapping.findForward("success");
}

return mapping.findForward("fail");
}
}
加上那些输出语句就可以知道哪里出现问题了,如果一个都没输出就是代码没有执行过,那就不
是这些代码有问题,如果输出了111111111但是没有输出222222222的话
那错误就是在11111111和22222222之间,因为程序抛异常,那么异常后面的代码都不会执行的
程序调好了后就要把这些语句删了
#12
susan0019832007-07-30 15:01
你真有耐心,

我来试试.
#13
susan0019832007-07-30 15:08
我突然发现这么一句,
是services.xml文件不存在吗?
这个文件是干什么的?

严重: Servlet /CardSystem threw load() exception
java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist
#14
Gramary2007-07-30 15:14
你是用的现成的项目吗???
我没看过这个项目,不清楚这个文件是来干什么的`
一般在J2EE中.xml结尾的都是配置文件
#15
susan0019832007-07-30 15:21
不是,
是我自己写的,
只不过,
乱七八糟导了一堆东西进来.

我不是想这样万无一失嘛.
结果也挺麻烦的,
都不知道是什么.
#16
Gramary2007-07-30 15:25
呵呵``
没关系你用久了就会知道一些东西是干什么用了````
1