提交表单时报404,新手求助啊
Eclipse控制台能打印出来,但jsp页面找不到
index.jsp submit到success.jsp
1.Action
public class ListAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<User> users;
private String info;
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
@Override
public String execute() throws Exception {
for (User user : users) {
System.out.println("Name:" + user.getName()+" " + "Age:" + user.getAge() +" " +
"Tel:" + user.getTel());
}
return SUCCESS;
}
}
2.user类
public class User {
private String name;
private int age;
private String tel;
....实现了get和set方法以及构造方法
3.index.jsp
<body>
<center>
<s:form action="list!show.action">
<table>
<tr>
<td/>
<td>first:</td>
<td>second:</td>
</tr>
<tr>
<td>Name:</td>
<td><s:textfield name="users[0].name" theme="simple"></s:textfield></td>
<td><s:textfield name="users[1].name" theme="simple"></s:textfield></td>
</tr>
<tr>
<td>Age:</td>
<td><s:textfield name="users[0].age" theme="simple"></s:textfield></td>
<td><s:textfield name="users[1].age" theme="simple"></s:textfield></td>
</tr>
<tr>
<td>Tel:</td>
<td><s:textfield name="users[0].tel" theme="simple"></s:textfield></td>
<td><s:textfield name="users[1].tel" theme="simple"></s:textfield></td>
</tr>
<tr>
<td colspan="3">
<s:submit></s:submit>
</tr>
</table>
</s:form>
</center>
</body>
4.success.jsp
<body>
<center>
Name:<s:property value="users[0].name"/>
Age:<s:property value="users[0].age"/>
Tel:<s:property value="users[0].tel"/>
Name:<s:property value="users[1].name"/>
Age:<s:property value="users[1].age"/>
Tel:<s:property value="users[1].tel"/>
</center>
</body>
5.struts.xml
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="list" class="com.wangzhihai.action.ListAction">
<result>/success.jsp</result>
</action>
</package>
</struts>