码迷,mamicode.com
首页 > 其他好文 > 详细

ModernDriven 获得表单数据

时间:2015-12-10 19:47:54      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:moderndriven 获取表单值

package com.cola.struts;

import com.cola.bean.Book;

import com.opensymphony.xwork2.ActionSupport;

import com.opensymphony.xwork2.ModelDriven;

@SuppressWarnings("all")

public class UserAction extends ActionSupport implements ModelDriven<Book> {

    private Book book;

    /*

     * public String list(){ System.out.println(

     * "User‘s list-------------------->"); return "success"; }

     */

    public String execute() {

        System.out.println(book);

        return null;

    }

    public Book getBook() {

        return book;

    }

    @Override

    public Book getModel() {

        if (book == null) {

            book = new Book();

        }

        return book;

    }

    public void setBook(Book book) {

        this.book = book;

    }

}

< form action= "user" method = "get">

  bookname: < input name= "bookname" /><br />

  bookauthor:< input name= "bookauthor" /><br />

  bookprice: < input name= "bookprice" /><br />

  <input type = "submit" value= "add"/>< br/>

</ form>


ModernDriven 获得表单数据

标签:moderndriven 获取表单值

原文地址:http://icola.blog.51cto.com/5412204/1721692

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!