。struts2动态结果集不能用
求助。struts2动态结果集不能用
主要有三个文件!
这是我连接的文件index.jsp!
struts.xml的配置如下
一下是User.java
就是这么多了!但是我点击链接,页面就显示404,我哪里配置错了?并且在myeclipse中提示struuts.xml的<result>一行有错误。求助各位大神。
------解决方案--------------------
一般的方法:
先确定正确的url是什么,假如是:http://192.168.0.1:8080/project/struts/user?type=1
然后需要确定 <a href="struts/user?type=1">动态结果集</a></br>,这个最终形成的url是多少。
假设形成的url是:http://192.168.0.1:8080/projectstruts/user?type=1,project和struts中间差个/,那么就要修改<a href="struts/user?type=1">来调整。
主要有三个文件!
这是我连接的文件index.jsp!
<body>
Result</br>
<a href="struts/user?type=1">动态结果集</a></br>
<br>
</body>
struts.xml的配置如下
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/struts" extends="struts-default">
<action name="user" class="actionClass.User">
<result>
${pages}
</result>
</action>
</package>
一下是User.java
package actionClass;
import com.opensymphony.xwork2.ActionSupport;
public class User extends ActionSupport{
private String pages;
private int type;
public String getPage() {
return pages;
}
public void setPage(String page) {
this.pages = page;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String execute() throws Exception {
if ( type == 1 ) {
pages = "/Success.jsp";
} else {
pages = "/error.jsp";
}
System.out.println(pages);
return SUCCESS;
}
}
就是这么多了!但是我点击链接,页面就显示404,我哪里配置错了?并且在myeclipse中提示struuts.xml的<result>一行有错误。求助各位大神。
Struts
动态结果集
------解决方案--------------------
一般的方法:
先确定正确的url是什么,假如是:http://192.168.0.1:8080/project/struts/user?type=1
然后需要确定 <a href="struts/user?type=1">动态结果集</a></br>,这个最终形成的url是多少。
假设形成的url是:http://192.168.0.1:8080/projectstruts/user?type=1,project和struts中间差个/,那么就要修改<a href="struts/user?type=1">来调整。