Andy,
Following what you want to do. This may not be exact as I don't use a
dispatcher, I don't think.
jsp with edit button (In our case, we use a link with image (user.jsp).
<html:link
action="/user/preUpdateUser?userID=${userForm.userID}"><html:img
pageKey="images.updateIcon" border="0"/></html:link>
dispatcher? (struts-user-config.xml)
<action path="/user/preUpdateUser"
type="*scs.reaction.struts.user.actions.user.PreUpdateUserAction*"
name="userForm"
input="/user/preUpdateUser"
scope="request"
validate="false"
>
<forward name="success"
path="/user/user/preUpdateUser.jsp"/>
</action>
loadObject
scs.reaction.struts.user.actions.user.PreUpdateUserAction
editObject
/user/user/preUpdateUser.jsp
In jsp
<html:form action="/user/updateUser" method="post">
store in db
<action path="/user/updateUser"
type="scs.reaction.struts.user.actions.user.UpdateUserAction"
name="userForm"
input="/user/preUpdateUser"
scope="request"
validate="true"
>
<forward name="closeWindow"
path="/user/user/updateUser.jsp"/>
<forward name="retry" path="/user/user/preUpdateUser.jsp"/>
<forward name="success" path="/user/searchForUser"
redirect="yes"/>
</action>
re-display updatedObject
/user/user/updateUser.jsp
Hth,
Al
Andy.de wrote:
> Hi Eric,
> your point 2. in my application is a button on a previous page (i have
> several buttons)
> The button is evaluated by an EventActionDispatcher and the according
> execute() forwards
> to the action to fill the bean.
>
> public ActionForward editObject(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception {
> return mapping.findForward("loadObject");
> }
>
> the loadObject action loads data from database and forwards to
> 'displayObject' action with jsp to
> show the object. But i found now way to configure struts-config for
> 'loadObject'
>
> jsp page -> button 'edit' pressed -> dispatcher -> editObject() -> ok up
to
> this step
>
> -> forward to 'loadObject' how to do this?????
>
> -> forward to jsp page to display object is ok and works
>
> I hope my problem is clear now.
> I can not understand why no sample with this daily problem exists, every
> application needs it.
>
> Regards, Andy
>
>
> Givler, Eric wrote:
>
>> I'm not sure I understand what's wrong with this:
>>
>> 1. The load object from database is in the action's execute.
>> <action path="/prepareProfileEditScreen"
>> type="struts.actions.prepareProfileAction"
>> name="struts.forms.profileFormBean">
>> <forward name="success" path="profileEdit.jsp"/>
>> </action>
>>
>> 2. The menu choice is: Edit My Profile (for example), which invokes the
>> action from #1
>>
>> public ActionForward execute( <signature> ) throws ...
>> {
>> String userId = request.getParameter("userId");
>> UserProfile up = service.getProfile( userId );
>> BeanUtils.copyProperties( form, up );
>> return "success";
>> }
>>
>> 3. The user ends up on the profileEdit.jsp page with the data filled into
>> the form bean.
>>
>> -----Original Message-----
>> From: Andy.de [mailto:a.schmidt@best-blu.de]
>> Sent: Thursday, September 28, 2006 10:07 AM
>> To: user@struts.apache.org
>> Subject: Re: Forward to action without jsp
>>
>> Wendy Smoak-3 wrote:
>>
>>> On 9/28/06, Andy.de <a.schmidt@best-blu.de> wrote:
>>>
>>>
>>>> how can i forward to an action without input (jsp) ?
>>>>
>>> I'm not sure what you're asking. What do you want the user to be able to
>>> do?
>>>
>>> In general, any URL that maps to an Action will execute the action,
>>> whether or not there is any 'input' (request parameters from the form
>>> having been submitted, or in the URL itself.)
>>>
>>> --
>>> Wendy
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>> Hi Wendy,
>> i have an action 'load object from database', on execute() the form bean
>> is filled with values from database. On success i want to forward to the
>> jsp
>> to
>> display the object. The user can change the values and submit the jsp, the
>> according 'save action' stores the changed object to database. This is the
>> typicall way to populate and fill a form bean before the according jsp is
>> shown.
>> But i don't find a way to forward to my 'load object from database' action
>> because
>> this action has no input (no jsp) and the forward attribute of <action>
>> wants
>> a jsp. What i need is <forward name='success' action='load object from
>> data'>
>> instead of <forward name='success' path=/xyz.jsp>
>> Regards Andy
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Forward-to-action-without-jsp-tf2350751.html#a6547071
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
|