import java.util.ArrayList;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.struts.util.LabelValueBean;
public class ExampleAction extends Action {
private static final String attrName = "AreaList";
// ...
public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession session = request.getSession();
if(session.getAttribute(attrName) == null){
String[][] rsetArea = // リストを取得する
ArrayList alist = new ArrayList();
for(int y=0; y<rsetArea.getRowCount(); y++){
String label = rsetArea[y][1];
String value = rsetArea[y][0];
alist.add(new LabelValueBean(label, value));
}
session.setAttribute(attrName, alist);
}
return mapping.findForward("success");
}
}
|