RegisterAction
package k.action;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; public class RegisterAction extends DispatchAction {
public ActionForward doRegister(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
DynaActionForm dynaForm = (DynaActionForm) form;
String userName = dynaForm.getString("userName");
String password = dynaForm.getString("password");
String mobile = dynaForm.getString("mobile");
System.out.println("==" + userName + "==" + password + "==" + mobile);
return mapping.findForward("registerOk");
}
}

struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="userForm2" type="org.apache.struts.action.DynaActionForm">
<form-property name="userName" type="java.lang.String"></form-property>
<form-property name="password" type="java.lang.String"></form-property>
<form-property name="mobile" type="java.lang.String"></form-property>
</form-bean>
</form-beans>
<action-mappings>
<action name="userForm2" path="/register" parameter="action" type="k.action.RegisterAction"
scope="request" attribute="userForm" input="index.jsp" validate="false">
<forward name="registerOk" path="/WEB-INF/jsp/registerOk.jsp"></forward>
</action>
</action-mappings>
</struts-config>

register.jsp

<h1>登录页面</h1>
<form action="${APP_PATH}/register.do?action=doRegister" method="post">
账号:<input type="text" name="userName" value="11哈哈"> <br>
密码: <input type="password" name="password" value="1"> <br>
手机: <input type="text" name="mobile" value="13612341234"> <br>
<input type="submit" value="submit"> <br>
</form>

registerOk.jsp

<h1>注册成功</h1>

【Struts 动态表单】DynaActionForm的更多相关文章

  1. Struts动态表单(DynamicForm)

    动态表单的含义是不要手动定义,直接在配置文件中进行定义. 1.手动进行定义 <form-beans > <form-bean name="userForm" ty ...

  2. [K/3Cloud] 如何从被调用的动态表单界面返回数据

    在需要返回数据的地方调用表单返回方法完成数据返回 this.View.ReturnToParentWindow(retData); 在调用界面的回调函数中取出返回结果的ReturnData即可使用. ...

  3. Vue+Element的动态表单,动态表格(后端发送配置,前端动态生成)

    Vue+Element的动态表单,动态表格(后端发送配置,前端动态生成) 动态表单生成 ElementUI官网引导 Element表单生成 Element动态增减表单,在线代码 关键配置 templa ...

  4. 简易OA漫谈之工作流设计(六,快捷表单和动态表单)

    如果没有表单设计功能,我们一般建物理表,再把表单挂接到流程, 我们可以把外接表单的地址填到表单地址中,地址中会传递一个id. 如果使用外接表单,在审批的时候可能会“不太友好”,因为在审批单上看不到任何 ...

  5. Struts防止表单重复提交

    1.什么是表单重复提交 > 在不刷新表单页面的前提下:         >> 多次点击提交按钮        >> 已经提交成功, 按 "回退" 之后 ...

  6. angularjs 动态表单, 原生事件中调用angular方法

    1. 原生事件中调用angular方法, 比如 input的onChange事件想调用angular里面定义的方法 - onChange="angular.element(this).sco ...

  7. vue 开发系列(八) 动态表单开发

    概要 动态表单指的是我们的表单不是通过vue 组件一个个编写的,我们的表单是根据后端生成的vue模板,在前端通过vue构建出来的.主要的思路是,在后端生成vue的模板,前端通过ajax的方式加载后端的 ...

  8. 1.struts 防止表单重复提交 2. 拦截器

    1. 使用struts 防止表单提交 时, form 表单必须使用struts标签库编写,如<s:form/> 等,而不是html标签 2. 拦截器是struts2的核心.  interc ...

  9. 如何在.Net Core MVC中为动态表单开启客户端验证

    非Core中的请参照: MVC的验证 jquery.validate.unobtrusive mvc验证jquery.unobtrusive-ajax 参照向动态表单增加验证 页面引入相关JS: &l ...

随机推荐

  1. [Codechef TASTR] Level of Difference - 后缀数组,容斥原理

    [Codechef TASTR] Level of Difference Description 给定两个字符串,求恰好在一个字符串中出现过的本质不同的子串数量. Solution 设 \(U(S)\ ...

  2. Spring MVC3 + Ehcache 缓存实现

    转自:http://www.coin163.com/it/490594393324999265/spring-ehcache Ehcache在很多项目中都出现过,用法也比较简单.一般的加些配置就可以了 ...

  3. 大数据-Storm

    Storm 流式处理框架 Storm是实时的,分布式,高容错的计算系统.java+cljoure Storm常驻内存,数据在内存中处理不经过磁盘,数据通过网络传输. 底层java+cljoure构成, ...

  4. IDEA与Tomcat相关配置

    idea会为每一个Tomcat部署的项目,独立建一份配置文件. 配置文件所在位置 怎么部署的(查看虚拟目录)使用的第三种部署方式 部署项目存放的路径 项目目录和Tomcat部署目录 Tomcat真正访 ...

  5. 解决ERROR 1130: Host 'x.x.x.x' is not allowed to connect to this MariaDB server 方法

    问题描述 在使用SQLyog操作Linux上的MariaDB时候,会出现如下错误: 解决方法 改表法 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电 ...

  6. dijkstra堆优化板子

    咕咕咕. #include<queue> #include<cstdio> #include<cstring> #include<algorithm> ...

  7. yii2 场景使用

    场景定义 //场景 const SCENARIO_USER_CREATE='0';//前台用户新增 const SCENARIO_USER_UPDATE='1';//前台用户更新 场景配置 publi ...

  8. MySQL数据库 | 数据库和数据表的基本操作

    第一篇博文,一个小小的纪念仪式^-^ 以下正文 一.数据库的基本操作 --数据库的操作 --连接数据库 mysql -uroot -p密码 mysql -uroot -pmysql --退出数据库 e ...

  9. phpstudy扩展mongoDB

    观察如下3个参数,即位数,ts/nts,vc9/vc11/……三条规则(一定要一一对应) 重要是,还要对应PHP的版本,我选的是5.6的对应的版本 去http://windows.php.net/do ...

  10. Diskpart手动创建EFI、MSR引导分区

    当给电脑加新硬盘时候,并且需要把新硬盘当作系统盘,有几种方法来为新硬盘创建引导分区: 可以选择用U盘刻录微软原版系统镜像,直接从U盘启动,然后直接创建分区,直接装,会自动为硬盘创建好几个引导分区. 进 ...