首页 > 其他 > 详细

Struts2-在action中获取表单提交的参数

时间:2015-07-17 13:51:59      阅读:239      评论:0      收藏:0      [点我收藏+]

1、表单

    <form action="<%=path %>/FirstAction" method="post">
        <input type="text" name="username">
        <input type="submit" name="提交">
    </form>

2、action代码

package com.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

public class FirstAction {
    private String username;
    
    public String execute(){
        HttpServletRequest request = ServletActionContext.getRequest();
        username = request.getParameter("username");        
        System.out.println(username);
        return null;        
    }
}

 

Struts2-在action中获取表单提交的参数

原文:http://www.cnblogs.com/Arvin-9/p/4653890.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!