action中的动态方法调用有两种形似
一.不指定method方法
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">7
<title>Action中的动态方法调用</title>
</head>
<body>
<table width="360" align="center">
<form action="loginReg!execute">
<tr>
<td>用户名:</td>
<td><input type="text" name="userName" size="26"/></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="password" size="28"/></td>
</tr>
<tr>
<td><input type="submit" value="登录"/></td>
<td><input type="submit" value="注册" οnclick="register();"/></td>
</tr>
</form>
<table>
<script type="text/javascript">
function register(){
//获取页面的第一个表单
targetForm = document.forms[0];
//动态修改表单的action属性
targetForm.action = "loginReg!regist";
}
</script>
</body>
</html>
二,指定method方法,就是在struts.xml中配置好<action>,后面加上method方法,逻辑结构比第一种清楚
但是第一种只需配置一个<action>元素