2 ad6634998 ad6634998 于 2015.05.30 08:35 提问

struts配置问题大家帮忙看下错误在哪里 1C

struts文件



/404.jsp


/photo.jsp



loginAction
public class LoginAction extends ActionSupport implements ModelDriven{
private UserService userService;
private LoginInfo loginInfo=new LoginInfo();
public String execute(){
System.out.println(loginInfo.getUsername());
System.out.println(loginInfo.getPassword());
User user =new User();
user.setUsername(loginInfo.getUsername());
user.setPassword(loginInfo.getPassword());
if(userService.loginCheck(user)){
return SUCCESS;
}
return "fail";
}
public UserService getUserService() {
return userService;
}
@Resource(name="userService")
public void setUserService(UserService userService) {
this.userService = userService;
}
public LoginInfo getLoginInfo() {
return loginInfo;
}
public void setLoginInfo(LoginInfo loginInfo) {
this.loginInfo = loginInfo;
}
public LoginInfo getModel() {
// TODO Auto-generated method stub
return loginInfo;
}

}

JSP


用户名


密码





web.xml

struts2

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter




struts2
/*

错误提示警告: Could not find action or result
There is no Action mapped for namespace / and action name loginAction. - [unknown location]

9个回答

guwei4037
guwei4037   Ds   Rxr 2015.05.30 08:43
ad6634998
ad6634998   2015.05.30 08:43

Exception starting filter struts2
Unable to load configuration. - [unknown location]

Caused by: Caught exception while loading file struts-default.xml - [unknown location]

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

heidou_1123
heidou_1123   2015.05.30 09:31

struts文件配置错了,说了找不到action

qq_20480563
qq_20480563   2015.05.30 10:38

Exception starting filter struts2
Unable to load configuration. - [unknown location]

Caused by: Caught exception while loading file struts-default.xml - [unknown location]

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

wojiushiwo945you
wojiushiwo945you   Ds   Rxr 2015.05.30 11:10

异常显示是action配置问题,检查下struts2.xml配置文件,是否配置了这个action。

z345434645
z345434645   2015.05.30 13:17

struts-default加载失败。。

gucapg
gucapg   2015.05.31 13:36

给出web。xml的配置,还有struts.xml的配置看看

u014259155
u014259155   2015.06.01 10:41

把web.xml和struts.xml的配置文件贴出来

yiwei00000
yiwei00000   2015.06.01 23:27

在struts的配置文件中有这个配置,可能你没有配置这个或者配置的其他,在你访问时要加上你配置的namespace。
然后是上面标签里面配置action:

/HelloWorld.jsp

Csdn user default icon
上传中...
上传图片
插入图片