jQuery in Action, 3rd edition
The moose likes Struts and the fly likes lazy action form problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "lazy action form problem" Watch "lazy action form problem" New topic

lazy action form problem

BC claudio

Joined: May 02, 2005
Posts: 5
how come it always ends up with an exception?

javax.servlet.ServletException: Exception creating bean of class org.apache.struts.validator.LazyValidatorForm: {1}


Define the form in the struts-config.xml:


<form-bean name="lazyForm" type="org.apache.struts.validator.LazyValidatorForm"/>

<action path="/myActionPath" type="myPackage.MyAction" name="lazyForm" validate="true"/>


Set up the jsp in the usual way.

<html:form action="/myActionPath">

<h2>Simple Property Example</h2>

Customer Number: <html:text property="custNo"/>
Customer Name: <html:text property="custName"/>

<h2>Mapped Property Example</h2>

Street: <html:text property="address(street)"/>
Town: <html:text property="address(town)"/>
State: <html:text property="address(state)"/>
Country: <html:text property="address(country)"/>

<h2>Indexed Property Example</h2>

<logic:iterate id="products" property="products">
Product Code: <html:text name="products" property="code" indexed="true"/>
Product Description: <html:text name="products" property="description" indexed="true"/>
Product Price: <html:text name="products" property="price" indexed="true"/>


Use in the Action by casting the ActionForm to a DynaBean.

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServeletRequest request,
HttpServletResponse response) throws Exception {

// Cast form to DynaBean
DynaBean dynaForm = (DynaBean)form;

// Use the DynaBean
String custNo = (String)dynaForm.get("custNo"); // simple
Map address = (Map)dynaForm.get("address"); // mapped
List products = (List)dynaForm.get("products"); // indexed

... etc etc

I agree. Here's the link: http://aspose.com/file-tools
subject: lazy action form problem
It's not a secret anymore!