在struts.xml中重定向如何加参数

2025-04-14 18:18:55
推荐回答(2个)
回答1:

使用在result节点中使用param属性,如下



xxx


如果设置的new_id是一个动态的,那么
${id}id必须为action的一个属性(这样才能去得到id的值)

回答2:

struts2的核心是过滤器
首先进入的是web.xml
需要在web.xml配置struts2过滤器,如下:

struts2

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



struts2
*.action

然后再在struts.xml配置action例如








/index.jsp//指定返回页面
/login.jsp?errorid=0010



最后在你的登陆类action类中写好你的方法就行了。
public class LoginAction {

public String Login() {
.....
return "success";
}
}

写的已经很明白了