package sample.pg;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.commons.beanutils.*;
public class BeanUtilAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
// BeanUtilFormの、プロパティ"stringData"の値"xxxx"を設定する
BeanUtils.setProperty(form, "stringData","xxxx");
// BeanUtilFormの、プロパティ"arrayData"の値を設定する
String[] setArray = {"aaa","bbb","ccc"};
BeanUtils.setProperty(form, "arrayData",setArray);
// BeanUtilFormの、ネストしたプロパティ"copyData.tel"の値を設定する
BeanUtils.setProperty(form, "copyData.tel","123");
return mapping.findForward("success");
}
}
|