首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

struts1中html:multibox的应用

2012-10-06 
struts1中html:multibox的使用html:multibox 可以实现自动选中。用于替代checkbox.html:multibox property

struts1中html:multibox的使用
html:multibox 可以实现自动选中。用于替代checkbox.

  <html:multibox property="specialChooes" value="aa" />aa
  <html:multibox property="specialChooes" value="bb" />bb
  <html:multibox property="specialChooes" value="cc" />cc


public class ProductDigicamForm extends ActionForm {

private String[]  specialChooes;//
public String[] getSpecialChooes() {
return specialChooes;
}
public void setSpecialChooes(String[] specialChooes) {
this.specialChooes = specialChooes;
}
}

public ActionForward  showDigicam(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
IProductService service = (IProductService) this.getBean(Constants.PRODUCT_BEAN);
ProductDigicam digicam=new ProductDigicam();
ProductDigicamForm digicamForm=(ProductDigicamForm)form;
String prodId=request.getParameter("prodId");
try {
digicam = (ProductDigicam) service.getDigicamById(new Integer(prodId));
digicamForm.setSpecialChooes(digicam.getSpecialChooes().split("-"));
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("digicam");
}

热点排行