Passing object data between activities

I had a problem with a list / dropdown list on one of my jsps, but now I realized that my main problem is with data entry between activities / pages. Old question

I am trying to navigate from one page displaying one specific object to a narrower page displaying attachedObject

(up to the first) and then moving to the first page of the object. The last step is the one I'm having trouble with.

The whole workflow: first page: display a list of objects, select one, and then go to the second page that displays that object and a list of its attached objects. Select one of the attached objects (or click "Add new") and you will be redirected to the third page. Fill out the form for the attached object and click "save".

Here you need to redirect the beck to the second page showing the object you just added the attached object. However, I get an error that I am prompting when the user tries to navigate to the second page, but does not select one of the objects in the list.

It seems that I need to pass my "object" or at least its identifier in order to remember and work with it later.

Right now, I have a class ShowAttachedObjectAction

that is only responsible for displaying the attached ObjectForm object (implementation com.opensymphony.xwork2.Action

). Also, I have a AttachedObjectAction

(extension com.opensymphony.xwork2.ActionSupport

) with a method invalidate()

. When adding an attached object (and therefore not selecting an attached object in the list of objects, an error message appears. This is why I decoupled the Action classes.

But how can I pass an object during various action calls? ( ShowAttachedObjectAction --> AttachedObjectAction.save() --> ShowObject.action

)

Here are my main classes on pastebin:

ObjectForm
AttachedObjectForm
Struts.xml
ObjectAction
AttachedObjectAction
ShowAttachedObjectAction

+2


source to share





All Articles