点击一个链接“添加用户”始终无法转到正确的页面,出的是404错误。。请大家看看问题在哪,虽然多,但很简单,配置应该没问题,是链接的问题吧?请看看,谢谢!这个是index.jsp <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><html>
<head>
<base href="<%=basePath%>">
<title>index</title>
</head>
<body>
<a href="user/user!add?name=a">添加用户</a>
</body>
</html>
==================================================================================================
这个是struts.xml:
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/user" extends="struts-default">
<action name="user" class="com.XC.yangjian.action.UserAction" >
<result >
/user_add_success.jsp
</result>
<result name="error">
/user_add_error.jsp
</result>
</action>
</package>
==============================================================================================
这个是我的JavaBean:
package com.XC.yangjian.action;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {
private String name;public String add() {
if(name == null || !name.equals("admin")) {
this.addFieldError("name", "name is error");
return ERROR;
}
return SUCCESS;
}public String getName() {
return name;
}public void setName(String name) {
this.name = name;
}
}
================================================================================================
web.xml就是默认的:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>两个jsp页面不用贴出来了,因为根本没跳转过去。在线等
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><html>
<head>
<base href="<%=basePath%>">
<title>index</title>
</head>
<body>
<a href="user/user!add?name=a">添加用户</a>
</body>
</html>
==================================================================================================
这个是struts.xml:
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/user" extends="struts-default">
<action name="user" class="com.XC.yangjian.action.UserAction" >
<result >
/user_add_success.jsp
</result>
<result name="error">
/user_add_error.jsp
</result>
</action>
</package>
==============================================================================================
这个是我的JavaBean:
package com.XC.yangjian.action;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {
private String name;public String add() {
if(name == null || !name.equals("admin")) {
this.addFieldError("name", "name is error");
return ERROR;
}
return SUCCESS;
}public String getName() {
return name;
}public void setName(String name) {
this.name = name;
}
}
================================================================================================
web.xml就是默认的:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>两个jsp页面不用贴出来了,因为根本没跳转过去。在线等
解决方案 »
- JMS MessageListener 的疑问
- 有人做过银行的ECIF系统吗?
- 求救,dwr怎么取不到返回结果???appfuse+spring+dwr
- 如何在XML文件中对SQL语句进行锁定,在线等,谢谢啊!!!
- 关于在页面中直接显示word文档、excel文档、pdf文档等文件
- weblogic和tomcat有什么不同
- 用AXIS自动生成客户端测试文件
- 从数据库拿出的jsp页可以直接用excel显示吗!求教!高手出来啊!100分。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
- 100分提问Eclipse+Tomcat启动问题!
- ajax用户登陆获取不到session里的验证码
- java实现分步骤录入功能
- 求毕业设计+论文(基于jsp、java的BBS论坛的设计与实现)
这样试一下