struts inheritence

A

analogueboy

I tried to subclass ActionForm to create my own base form which I could
extend in my apps. However, the subclasses of my base form seem to be
sharing the same base form! I thought that as part of the language this
would not happen, now I've had to pull all the code from the base class into
my subclasses which defeats the original purpose.

Has anyone else had this problem? How did you get around it?
 
G

Guest

I tried to subclass ActionForm to create my own base form which I could
extend in my apps. However, the subclasses of my base form seem to be
sharing the same base form! I thought that as part of the language this
would not happen, now I've had to pull all the code from the base class into
my subclasses which defeats the original purpose.

Has anyone else had this problem? How did you get around it?

You should be able to do what you want. You did give the forms
different names in your struts config right?

Pete
 
A

Andrew S.

analogueboy said:
I tried to subclass ActionForm to create my own base form which I could
extend in my apps. However, the subclasses of my base form seem to be
sharing the same base form! I thought that as part of the language this
would not happen, now I've had to pull all the code from the base class into
my subclasses which defeats the original purpose.

Has anyone else had this problem? How did you get around it?

In the struts-config.xml make sure each of your forms are defined at
request scope - otherwise concurrent http requests will share the same
form instance.

Andrew
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top