struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takhar, Sandeep" <Sandeep.Tak...@CIBC.ca>
Subject RE: DynaValidatorFom with checkbox properties
Date Fri, 02 Apr 2004 19:54:21 GMT
there have been tonnes of posts on why you cannot instantiate a dynaform like that.

http://www.javablogs.com/ViewEntry.jspa?id=128211

here is one example of how you can

sandeep

-----Original Message-----
From: Johannes Wolfgang Woger [mailto:jwwoger@chello.at]
Sent: Friday, April 02, 2004 2:42 PM
To: Struts Users Mailing List
Subject: Re: DynaValidatorFom with checkbox properties




Robert Taylor wrote:

>>employee. How shall I configure
>>the DynaValidatorForm in my strus_config to take a unknown number of 
>>checkbox values?
>>    
>>
>
><form-property name="rrole"
>                  type="java.lang.String[]" initial="{}"/>
>
>
>  
>
>>second question: how can I make the properties of a DynaVForm available 
>>to a Action?
>>    
>>
>DynaActionForm form = (DynaActionForm)form;
>String[] rrole = (String[])form.get("rrole);
>
Doing so, gives me the exception:
    

javax.servlet.ServletException: Invalid property name 'rrole'
	org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

java.lang.IllegalArgumentException: Invalid property name 'rrole'
	org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:598)
	org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:241)
	org.zack.action.EmployeeDispatchAction.update(Unknown Source)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:324)
	org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
	org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

>
>You might try using <html:multibox .../>
>
><c:forEach var="tk" items="${task}">
><html:multibox property="rrole"><c:out value="${tk.taskId}"/></html:multibox>
></c:forEach>
>
everything else you supose seems to work well, but I cannot look what 
the DVForm realy loaded,
how I will put these values into the database is an other story.

Thank you very much. Wolfgang

>
>
>robert
>
>  
>
>>-----Original Message-----
>>From: Johannes Wolfgang Woger [mailto:jwwoger@chello.at]
>>Sent: Friday, April 02, 2004 12:48 PM
>>To: user@struts.apache.org
>>Subject: DynaValidatorFom with checkbox properties
>>
>>
>>Hi,
>>I have a checkbox, where do not know in adwance how many properties to 
>>be checked I will have
>>this is why I use forEach.
>>I am using a DynaValidatorForm which takes some attibutes for an 
>>employee. How shall I configure
>>the DynaValidatorForm in my strus_config to take a unknown number of 
>>checkbox values?
>>
>><c:forEach var="tk" items="${tasks}">
>>    
>>       <c:out value="${tk.taskBez}"/>
>>               <input type="checkbox" name='rrole' value='<c:out 
>>value="${tk.taskId}"/>'/>                   
>>      </c:forEach>
>>
>>this is how my .jsp looks like.
>>
>>second question: how can I make the properties of a DynaVForm available 
>>to a Action?
>>
>>Thanks
>>    Wolfgang
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message