• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem using Dyna Action Form

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am facing the below mentioned problem, while trying to use dynaActionForm.

In the struts-config, I get an error saying that com.infosys.apmsweb.sample.MyFormBean[] is not a valid type. If I remove [], then the error is not thrown.

When I try deploying, I got an exception saying that index can come only under iterate tag.

I have added all relvant jar�s and tld�s which come in jakarta-taglibs-standard-1.0.6.

Can someone help me on this? Some immediate help on this, would highly be appreciated.


Entry in struts-config


<form-beans>

<form-bean name="myFormBeanList" type="org.apache.struts.action.DynaActionForm" >

<form-property className="org.apache.struts.config.FormPropertyConfig" name="lines" type="com.infosys.apmsweb.sample.MyFormBean[]" size="4" />

</form-bean>

</form-beans>


Jsp form

<html:form action="/end">



<table border="1">



<c:forEach var="lines" items="${myFormBeanList.map.lines}" >

<TR><TD><html:text indexed=�true� name="lines" property="custSSN"/></TD>



</c:forEach>

<tr>

<html:submit value="Submit" />

</tr>

</table>





</html:form>

Execute in Action Class



public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {



ActionErrors errors = new ActionErrors();

ActionForward forward = new ActionForward();

// return value



try {



if(null== form)

System.out.println("No Form exists");

if(null!=form){







DynaActionForm poForm = (DynaActionForm) form;

MyFormBean[] list=(MyFormBean[]) poForm.get("lines");

MyFormBean mf=((MyFormBean)list[1]);

System.out.println(mf.getCustSSN());

}





} catch (Exception e) {



// Report the error using the appropriate name and ID.

errors.add("name", new ActionError("id"));



}





// Finish with

return mapping.findForward("success");



}
 
reply
    Bookmark Topic Watch Topic
  • New Topic