struts2:action传值给jsp失败(什么也没显示),jsp传值给action却成功 setter和getter都有 10

<s:iteratorvalue="aList"id="aut"><tr><td><s:propertyvalue="#aut.id"/></td><td><s:prop... <s:iterator value="aList" id="aut">
<tr>
<td ><s:property value="#aut.id" /> </td>
<td ><s:property value="#aut.authority" /> </td>
</tr>
</s:iterator>

loginAction
public class loginAction extends ActionSupport{
AuthorityFactory Factory = new AuthorityFactory();
AuthorityDAO authorityDAO = AuthorityFactory.getAuthorityInstance();

private Authority aut;
private List<Authority> aList = new ArrayList<Authority>();
private String userName;
private String password;

public Authority getAut() {
return aut;
}
public void setAut(Authority aut) {
this.aut = aut;
}

public List<Authority> getAList() {
return aList;
}
public void setAList(List<Authority> aList) {
this.aList = aList;
}

public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String execute() throws Exception {
if(userName.equals("123") && password.equals("123"))
return "good";
else
return "bad";
}

public String test() throws Exception{
aList = authorityDAO.findAll();
userName = "12346";
if(!aList.isEmpty()){
return "good";
}

else
return "bad";
}
}
struts.xml:

<action name="log" class="hfut.action.loginAction" method="test">
<result name="good" type="redirect">/jsp/test2.jsp</result>
<result name="bad">/jsp/add.jsp</result>
</action>

jsp:
<form action="log" method="post">
姓名:<input type="text" name="userName" value="123" /><br>
密码:<input type="text" name="password" value="123" /><br>
<input type="submit" value="submit" />
</form>
展开
 我来答
幽静孤雨下
2016-06-25 · TA获得超过187个赞
知道小有建树答主
回答量:207
采纳率:0%
帮助的人:114万
展开全部
aciton跳转传值可以使用<param name="username">${username}</param>传值。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式