Struts 1.x scenario: populate form after search

C

cteb

Hi!

I'm having problems implementing a rather common situation with Struts
1.3.8. After a successful search for some person record, I want the user
to edit it.

This is how I want to do it, two JSP pages with corresponding forms and
in between two actions, the first loads the person record from a
database, the second fills out the person form with that record:

searchperson.jsp -> processPersonSearch -> populatePersonForm ->
editperson.jsp

However, I don't know how my second action can give its PersonForm to
the editperson.jsp page. I don't mind any other solution, this was just
my idea, to separate retrieval in the database from populating the form.

In case nobody wants to write a long reply with code or
struts-config.xml settings, do you know of an open example where there's
a search form followed by a form which edits whatever was found in the
step before? I don't mind studying code, I just haven't found something
exactly like that.

thx
... C
 
D

Donkey Hottie

cteb said:
Hi!

I'm having problems implementing a rather common situation with Struts
1.3.8. After a successful search for some person record, I want the user
to edit it.

This is how I want to do it, two JSP pages with corresponding forms and
in between two actions, the first loads the person record from a
database, the second fills out the person form with that record:

searchperson.jsp -> processPersonSearch -> populatePersonForm ->
editperson.jsp

However, I don't know how my second action can give its PersonForm to
the editperson.jsp page. I don't mind any other solution, this was just
my idea, to separate retrieval in the database from populating the form.

In case nobody wants to write a long reply with code or
struts-config.xml settings, do you know of an open example where there's
a search form followed by a form which edits whatever was found in the
step before? I don't mind studying code, I just haven't found something
exactly like that.

thx
... C

Not sure if I understand what you are up to, but you could share a form
instance by making it session scope. Or your processPersonSearch could set
up a request attribute (complex object) which the populatePersonForm uses.
 
C

cteb

Donkey said:
Not sure if I understand what you are up to, but you could share a form
instance by making it session scope. Or your processPersonSearch could set
up a request attribute (complex object) which the populatePersonForm uses.

I don't know how to initiate the forwarding from the first action to the
second. Or how to make sure that my populated form (and not a new
instance) gets used by editperson.jsp.

... C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,271
Latest member
BuyAtenaLabsCBD

Latest Threads

Top