I tried to use now all qualifications as I could (at least, that 
I know) -- still the same result:
when using the sub class form, the hidden field could not
get retrieved. I shifted the classes (Forms and Actions) to
a package now (I think I read once something that
tomcat has problems with default package classes -- just in case).
Unfortunately, I had a hard time to post a war file. It took
hours until it came through all kinds of blockers. So I'll send the 
source within a zip file this time. Sorry for the ones that want
to take the time to run it and now have the extra work. The struts.jar
is again not included.

The updated jsp (test.jsp) that calls the SuperAction or the SubAction (with
the forms SuperForm, SubForm resp.) now is:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<head>
<title>Test</title>
<html:base/>
</HEAD>
<BODY>
<html:form action="/super.do" name="superForm" type="supertest.SuperForm">
    <html:hidden name="superForm" property="myField"  name="superForm"/>
    <html:submit property="command" value="Super Action"/>
</html:form>
<html:form action='/sub.do'  name="subForm" type="supertest.SubForm">
    <html:hidden name="subForm" property="myField" name="subForm"/>
    <html:submit property="command" value="Sub Action"/>
</html:form>
</body>
</html:html>

You start the test using start.jsp (web.xml also defaults to this jsp).

Unfortunately, I don't have the time to go through the struts code.
I'm some sort of "superbusy" here.

Btw., Thanks to Helmut/Cobbie.Behrend: 
Looks like, the things you suggested don't work too, see above.

Regards, 
Holger


-----Ursprungliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 18. September 2001 19:00
An: [EMAIL PROTECTED]
Betreff: Re: Unable to handle ActionForm class hierarchies?



Have you tried specifying the name explicitly?  As in: <html:hidden name
="superForm" property="myField"/>

I have experienced this same error when having more than one form in a
session with the same property's.  The actionForm associated with a
particular action was not being set. After specifying the name explicitly
the desired property was set.

cobbie
  

 -----Ursprungliche Nachricht-----
Von:    Wiechert, Holger  
Gesendet:       Dienstag, 18. September 2001 17:16
An:     User-Struts (E-Mail)
Betreff:        Unable to handle ActionForm class hierarchies? 

I've got a problem when using class hierarchies for ActionForms.
There are two ActionForms: SuperForm and SubForm (as can be guessed,
SubForm inherits from SuperForm). Then there are two Actions,
SuperAction and SubAction, where SuperAction uses SuperForm
and SubAction uses SubForm. The JSP that calls (via POST) either
SuperAction or SubAction contains a hidden field in the form tag:

test.jsp:

<BODY>
<html:form action="/super.do">
    <html:hidden property="myField"/>
    <html:submit property="command" value="Super Action"/>
</html:form>
<html:form action='/sub.do'>
    <html:hidden property="myField"/>
    <html:submit property="command" value="Sub Action"/>
</html:form>
</body>

The field "myField" is member of the SuperForm.
A PreloadAction initializes the myField field and then 
forwards to start.jsp. 
The thing is, when I call the SuperAction, the myField's
value can get retrieved and when I call SubAction, it reads
an empty string. For some reason, the myField will be set to
this empty string, before the request is forwarded to 
SubAction.
I included a war file that demonstrates this.
So, is this a bug or am I doing something wrong here?
I desperately need this feature (and besides this, I'm really
short in time, unfortunately).

Help greatly appreciated!
Thanks in advance,
Holger




superforms.zip

Reply via email to