- PR -

Struts selectタグについて

1
投稿者投稿内容
TOM
会議室デビュー日: 2004/02/24
投稿数: 1
投稿日時: 2004-02-24 02:18
はじめまして
最近、Java+Strutsを勉強しはじめた者です。(まったくの素人です)
サンプルコードを使って勉強中ですが、以下のエラーが出て原因がわからず苦労しております。
誰かご教授ねがいます。
No getter method available for property selected for bean under name org.apache.struts.taglib.html.BEAN

行おうとしている事は、プルダウンメニューを動的に生成しようとしています。
1.メニュー画面からリンクをクリック(menu.jsp)
2.Actionクラスでプルダウンメニューの情報を生成(Menu1Before.java)
3.プルダウンメニューを表示(pulldown.jsp)

以下が各ファイルの内容です。
【struts-config.xml】
<form-beans>
<form-bean name="testfome" type="TestFormBean"/>
<form-bean name="selectfome" type="SelectFormBean"/>
</form-beans>

<global-forwards>
<forward name="menu1" path="/menu1before.do"/>
</global-forwards>
<action-mappings>
<action path="/menu1before" type="Menu1Before" scope="request">
<forward name="OK" path="/pulldown.jsp"/>
</action>

<action path="/selectAction" type="SelectAction" name="selectfome" scope="request">
<forward name="OK" path="/select.jsp"/>
</action>
</action-mappings>

【menu.jsp】
<html:link forward="menu1">プルダウン</html:link>

【Menu1Before.java】
public final class Menu1Before extends Action {
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception {

TestFormBean tform = new TestFormBean();
ArrayList list = new ArrayList();

list.add (new LabelValueBean("ワイン","1"));
list.add (new LabelValueBean("焼酎","2"));
list.add (new LabelValueBean("泡盛","3"));
list.add (new LabelValueBean("日本酒","4"));
list.add (new LabelValueBean("ビール","5"));

tform.setList(list);

req.setAttribute("testFormBean",tform);

return mapping.findForward("OK");

【TestFormBean.java】
public final class TestFormBean extends ActionForm {
private ArrayList list;


public void setList(ArrayList list) {this.list = list;}
public ArrayList getList() {return this.list;}
}

【SelectAction.java】
public final class SelectAction extends Action {
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception  {
return mapping.findForward("OK");
}
}

【SelectFormBean.java】
public final class SelectFormBean extends ActionForm {
private String select;


public void setSelected(String select) {this.select = select;}
public String getSlected() {return select;}
}


1

スキルアップ/キャリアアップ(JOB@IT)