主页 > 编程资料 > JSP(JAVA) >
发布时间:2016-01-01 作者:网络 阅读:229次
1,TagForm.java
复制代码 代码如下:
package com.tarena.struts.tag.form;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.util.*;

public class TagForm extends ActionForm
{
private int id;
private String userName;
private String password;
private int sex;
private String[] hobbies;
private String from;
private String introduction;
private Collection provinces;
private boolean checkbox1;
private boolean checkbox2;

public TagForm()
{
sex = 1;
provinces = new ArrayList();
provinces.add(new OptionBean("beijing", "100000"));
provinces.add(new OptionBean("hebei", "110000"));
provinces.add(new OptionBean("tianjin", "120000"));
}

public String getFrom()
{
return from;
}

public void setFrom(String from)
{
this.from = from;
}

public String[] getHobbies()
{
return hobbies;
}

public void setHobbies(String[] hobbies)
{
this.hobbies = hobbies;
}

public int getId()
{
return id;
}

public void setId(int id)
{
this.id = id;
}

public String getIntroduction()
{
return introduction;
}

public void setIntroduction(String introduction)
{
this.introduction = introduction;
}

public String getPassword()
{
return password;
}

public void setPassword(String password)
{
this.password = password;
}

public int getSex()
{
return sex;
}

public void setSex(int sex)
{
this.sex = sex;
}

public String getUserName()
{
return userName;
}

public void setUserName(String userName)
{
this.userName = userName;
}

public Collection getProvinces()
{
return provinces;
}

public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
{
//checkbox1 = false;
//hobbies = null;
}

public boolean isCheckbox1() {
return checkbox1;
}

public void setCheckbox1(boolean checkbox1) {
this.checkbox1 = checkbox1;
}

public boolean isCheckbox2() {
return checkbox2;
}

public void setCheckbox2(boolean checkbox2) {
this.checkbox2 = checkbox2;
}

public void setProvinces(Collection provinces) {
this.provinces = provinces;
}
}

2,input_struts.jsp
复制代码 代码如下:
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/resource/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/resource/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/resource/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/resource/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/resource/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/resource/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/resource/app.tld" prefix="app"%>
<%@ taglib uri="/WEB-INF/resource/fmt.tld" prefix="fmt"%>




userName:
password:


checkbox1:

checkbox2:



hobbies:swim
reading
walking



gender:male
female









Show Value1
Show Value2
Show Value3












当前1/2页 12下一页
关键字词:JSP编程