日期:2014-05-17 浏览次数:20611 次
<div align="center" class="register">
<form action="/course/studentRegisterAction" method="post">
<table class="register_table">
<caption>学生注册信息表单</caption>
<tbody>
<tr>
<td>学生学号:</td>
<td><input type="text" name="sid" required="required"/></td>
</tr>
<tr>
<td><button type="submit">提交</button></td>
<td><button type="reset">重置</button></td>
</tr>
</tbody>
</table>
</form>
</div>
<constant name="struts.i18n.encoding" value="UTF-8"/>
<!-- 将struts交给spring进行管理 -->
<constant name="struts.objectFactory" value="spring"/>
<constant name="struts.devMode" value="true"/>
<constant name="struts.serve.static.browserCache" value="false"/>
<constant name="truts.action.extension" value="action,do"/>
<constant name="struts.configuration.xml.reload" value="true"/>
<!-- 设置目标缓存文件位置
<constant name="struts.multipart.saveDir" value="D:\\temp"/>
-->
<package name="org.course.action" extends="struts-default">
<action name="studentRegisterAction" class="studentRegisterHandler">
<result>/index.jsp</result>
</action>
</package>
@Transactional
@Controller
public class StudentRegisterHandler extends ActionSupport {
private static final long serialVersionUID = -520L;
private String sid;
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
@Override
public String execute() throws Exception {
System.out.println(getSid());
return SUCCESS;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>struts</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
<!-- <filter-class