Hello,

I've got a "little" Problem in how using the struts select - tag correctly.
I'm new to Struts and have read the mails correspondig to the select-tag in
this mailing-list, but i'm not able to run my select tag.

Scenario:

In my action class a list of planningperiods is generated. the select - tag
in the following jsp should be filled with the ids of these periods. I wrote
an helper class containing only three attributes (planninperiodid,
begindate, enddate), with the correct getter-/setter-Methods.....

here is the code of the helper class, action class, the jsp containing the
select tag and the error code:

<-------------- helper class code --------------------->
package actions.helper;

....

public class PlanningPeriodHelper extends PlanningPeriod {

  private String planningperiodid;
  private String begindate;
  private String enddate;

  public PlanningPeriodHelper() {
  }
  public PlanningPeriodHelper(String ppid, String begindate, String enddate)
  {
    this.planningperiodid = ppid;
    this.begindate = begindate;
    this.enddate = enddate;
  }

  public void setPlanningperiodid(String ppid)
  {
    this.planningperiodid = ppid;
  }

  public void setBegindate(String bd)
  {
    this.begindate = bd;
  }

  public void setEeginddate(String ed)
  {
    this.enddate = ed;
  }

  public String getPlanningperiodid()
  {
    return super.getPlanningPeriodID();
  }

  public String getBegindate()
  {
    return begindate;
  }
  public String getEnddate()
  {
    return enddate;
  }

  public static List getAllPlanningperiods()
  {
    Iterator _pps = PlanningPeriod.getPlanningPeriods().iterator();
    List _pplist = new ArrayList();

    while (_pps.hasNext())
    {
      PlanningPeriod next = (PlanningPeriod)_pps.next();
      _pplist.add(new PlanningPeriodHelper(next.getPlanningPeriodID(),
                                           new
Long(next.getBeginDate()).toString(),
                                           new
Long(next.getEndDate()).toString()));
    }
    return _pplist;
  }
}

<-------------- end ---------------------------------->
<-------------- action class ------------------------->
public class InitSelectAction extends Action {

  public ActionForward perform (ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response) throws
IOException, ServletException
 {
    List _pplist = PlanningPeriodHelper.getAllPlanningperiods();

    request.setAttribute("pplist",_pplist);
    request.setAttribute("begindate", new Long(1234).toString());
    request.setAttribute("enddate", new Long(1235).toString());

    return mapping.findForward("init");
 }

}
<-------------- end ---------------------------------->
<-------------- jsp ---------------------------------->
<body bgcolor="#FFFFFF" text="#000000">
<html:form action="selectPP.do">
<table width="400" border="1">
 <tr>
  <td>
   <html:select property="planningperiodid">
       <html:options collection="pplist" property="planningperiodid"
labelProperty="planningperiodid"/>
   </html:select>
  </td>
 </tr>
 <tr>
  <td>
   <% out.print("Begin Date = " + request.getAttribute("begindate"));%>
  </td>
 </tr>
 <tr>
  <td>
   <% out.print("End Date = " + request.getAttribute("enddate"));%>
  </td>
 </tr>
 <tr>
  <td>
  </td>
 </tr>
</table>
</html:form>
</body>
</html:html>
<-------------- end ---------------------------------->
<-------------- error code --------------------------->
javax.servlet.ServletException: No getter method available for property
planningperiodid for bean under name org.apache.struts.taglib.html.BEAN
 at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:452)
 at org.apache.jsp._0002fselect_jsp._jspService(_0002fselect_jsp.java:218)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
..............
root cause

javax.servlet.jsp.JspException: No getter method available for property
planningperiodid for bean under name org.apache.struts.taglib.html.BEAN
 at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:304)
 at org.apache.jsp._0002fselect_jsp._jspService(_0002fselect_jsp.java:115)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
..............

<-------------- end ---------------------------------->

I hope you can help me. I'm at my wit's end.

many,many thanx

bjoern


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to