Struts 編集可能な明細
ActionFormを利用して、編集可能な明細(Beanで表現)を作成する
// Bean public class Person { private String name; private String age; // getter & setter }
// Beanのリストを保持するActionForm import org.apache.struts.action.ActionForm; : public class MyForm extends ActionForm { private List<Person> personlist = new ArrayList<Person>(); // getter & setter }
// ELと、Strutsカスタムタグを利用して、リストをインデックス管理 <html:form styleId="myform" action="/personlistpage" method="POST" onsubmit="return false"> <table border="1"> <tr> <th>Name</th> <th>Age</th> </tr> <logic:iterate id="person" name="MyForm" property="personlist" indexId="idx"> <tr> <td> <html:text property="personlist[${idx}].name"/> </td> <td> <html:text property="personlist[${idx}].age"/> </td> :
YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto
Copyright© 矢木 浩人 All Rights Reserved.