Jiri,

What action class does your action extend?  If it is
org.apache.struts.action.Action, then the parameter field, which you appear
to have filled in with what seems to be a tiles definition, is ignored.  The
parameter field does nothing unless it is a subclass of Action, such as
ForwardAction, DispatchAction, etc.  Those sub-classes used the contents of
the optional "parameter" field to perform an action they were designed for:
ForwardAction assumes the contents of the parameter field is a tile or jsp
path to forward to while the DispatchAction assumes the contents of the
parameter field is to be used a form field name to determine what function
to execute.

When you put your return as a mapping.findForward("success"), where do you
define a forward named success?  You must define a  forward either in the
global forwards section, or in the action.  Since you said I corrected for
the form bean error, here is the old action without the forwards:

<action
        path="/Register2"
        name="registerFull"
        type="cz.chalu.struts.modules.completeregister.LoadDataAction"
        parameter=".main.registerFinish"/>

You should define "success", "failure", or anything else you plan to use as
a mapping.findForward("SOMETHINGHERE") in your action or in the
global-forwards section.  An action would be setup a bit like this:

<action
        path="/Register2"
        name="registerFull"
        type="cz.chalu.struts.modules.completeregister.LoadDataAction">
                <forward name="success" path=".main.registerFinish"/>
                <forward name="failure" path=".main.registerFailure"/>
                <!-- this above line is an example you could setup
                        for multiple destinations based on the name
                        you use in quotes with your findForward call.
                        If you wish to share these forwards, like "menu"
                        with other pages, put the <forward..../> in the
                        <global-forwards>... </global-forwards> section
                        for any action to utilize. -->
</action>

I actually did some searching on the parameter="something" last
week wondering what the normal Action class does with it and
found out it does nothing.  It is for you to pass information
to your action on the fly and access using getParameter() and
setParameter().  In the case of ActionForwards or other action
subclasses, it has specific means that assist in the function
of those subclasses.

Regards,
David

-----Original Message-----
From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 4:29 PM
To: Struts Users Mailing List
Subject: Re: load data from db into form


Thanks David,
it looks bettre, you've right, this was a clear mistake :(
this exception is not shown now, but now it is displayed blank page,
only <html><body></body></html>

Maybe, when action class is finished I must set some forward.

now I have

LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return (mapping.findForward("success"));

but in page I do not need to return to anywhere now, I need only load
data into form for future editing. How to do it, or what can I do for it?

Thanks,
Jiri

David Friedman wrote:

>Jiri,
>
>Your error message explains the problem properly: "No destination bean
>specified". This means that BeanUtils.copyProperties is trying to copy the
>registerDTO to a bean named 'form', which is null.  This makes complete
>sense since your previous emails never tell us you've fixed your
><action.../> tag to include the 'name="someFormBeanName"' parameter.  You
>need to switch your action tag to define a formBean. So, instead of having:
>
><action
>            path="/Register2"
>            type="cz.chalu.struts.modules.completeregister.LoadDataAction"
>            parameter=".main.registerFinish"/>
>
>You should have something like:
>
><action
>            path="/Register2"
>               name="registerFull"
>            type="cz.chalu.struts.modules.completeregister.LoadDataAction"
>            parameter=".main.registerFinish"/>>
>Without the name="registerFull" (or some other defined bean name), the
>ActionForm named 'form' in the execute(...) method will always be undefined
>or null, and therefore unusable:
>
>public ActionForward execute(ActionMapping mapping,
>       ActionForm form,        HttpServletRequest request,
>       HttpServletResponse response) throws Exception, DatabaseException
>{
>// 'form' is in this function unless the action has
>'name="someFormBeanName"' in it.
>.....
>}
>
>Regards,
>David
>
>-----Original Message-----
>From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
>Sent: Sunday, August 31, 2003 12:24 PM
>To: Struts Users Mailing List
>Subject: Re: load data from db into form
>
>
>Yes, nested tags, I must look at ...
>so now I have it without nested, form definition is now without it.
>
>but still I got
>
>java.lang.IllegalArgumentException: No destination bean specified
>       at
>org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
>       at
>cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDataAct
i
>on.java:32)
>
>What is missing? I my action class (execute method) I have:
>
>public ActionForward execute(...){
>LoadDataService service = new LoadDataService();
>ComplRegisterDTO registerDTO = service.loadUser(request);
>BeanUtils.copyProperties(form, registerDTO);
>return null;
>}
>
>If I understand well, in BeanUtils.copyProperties I copy data from DTO
>into form defined in execute method?
>Or something other is wrong?
>
>Thanks
>
>
>Mark Lowe wrote:
>
>
>
>>Okay assuming the following..
>>
>><form-bean name="registerFull"
>>type="org.apache.struts.validator.DynaValidatorForm">
>>             <form-property name="id" type="java.lang.Integer" />
>>           <form-property name="fullname" type="java.lang.String" />
>>            <form-property name="notify" type="java.lang.Integer" />
>></form-bean>
>>
>>..
>>
>><html:text property="fullname" />
>><html:text property="id" />
>><html:text property="notify />
>>
>>or if you are nesting you bean which in that case i wouldn't (too short).
>>
>><form-property name="mybean"
>>type="cz.chalu.struts.modules.completeregister.ComplRegisterDTO">
>>
>>Then assuming that fullname, id, and notify are all properties of
>>ComplRegisterDTO.
>>
>><html:text property="mybean.fullname" />
>><html:text property="mybean.id" />
>><html:text property="mybean.notify" />
>>
>>Cheers Mark
>>
>>
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>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]


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

Reply via email to