首页 > 其他 > 详细

ModernDriven 获得表单数据

时间:2015-12-10 19:45:53      阅读:195      评论:0      收藏:0      [点我收藏+]

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 获得表单数据

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

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