Takhar, Sandeep wrote:

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

Thank you sandeep,

the DynaValidatorForm is already there.
I use the rr_lesson_ibatis from Reuman and I try to extand it so that
user roles/permissions can be attributed to the employees.
The DVF is taken from the ActionForm element in the parameterlist of
the execute method inside the action.

Am I completely wrong?

Wolfgang


-----Original Message----- From: Johannes Wolfgang Woger [mailto:[EMAIL PROTECTED] 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:[EMAIL PROTECTED]
Sent: Friday, April 02, 2004 12:48 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





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







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




Reply via email to