You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Markert <di...@dr-markert.de> on 2003/07/07 12:42:53 UTC

Re[4]: Form bean is not stored in request

Hello Nadja,

  

***************************************************************

NS> Hello again,

>>Do you need the above line for some good reason. If not, drop it.

NS> I deleted the attribute line. Stupid easy-struts is still telling me that
NS> attribute=suchen but I can't find the line the struts-config.xml anymore. I
NS> have that line in all my action mappings (for forms anyway), it never did
NS> anything... Why shouldn't I have the line in there?

NS> Still things seem to be behave oddly... Here's the logging (with comments
NS> from me) I don't quite understand what is going on anymore...

NS> 1) Looking for ActionForm bean instance in scope 'request' under attribute
NS> key 'suchen'
NS> 2) Creating new ActionForm instance of type 'de.zmnh.struts.form.SuchenForm'

NS> This is the first call to the form, it correctly creates a new instance.

NS> Then comes some general struts initialisation. Next 16 lines are from my
NS> own debugging info for the dropdown in my form and then follows some more
NS> struts message initialisations and such. All these are not really of
NS> consequence here, so I deleted them.

NS> Then after info in entered into the form and submit is pressed:

Attention. Here the new request starts!

NS> 3) Get module name for path /suchen.do
NS> 4) Module name found: default
NS> 5) Processing a 'POST' for path '/suchen'
NS> 6) Looking for ActionForm bean instance in scope 'request' under attribute
NS> key 'suchen'
NS> 7) Creating new ActionForm instance of type 'de.zmnh.struts.form.SuchenForm'
8)  -->> de.zmnh.struts.form.SuchenForm@3acc67

NS> As you can see, the form bean is stil being looked for even though I
NS> deleted that line.
That's okay. Its only the debugging info beeing not quite correct.
So far, everything looks okay to me.

NS> Maybe, it's easy-struts messing things up but I checked
NS> the code the line is not there anymore...
NS> (mapping: <action
NS>             input="/index.jsp"
NS>             name="suchen"
NS>             path="/suchen"
NS>             scope="request"
NS>             type="de.zmnh.struts.action.SuchenAction" />
NS> Tried switching to session, no change...)

NS> 9) Storing ActionForm bean instance in scope 'request' under attribute key
NS> 'suchen'

NS> Now, it created a new one and stores this one in the request right away...
NS> Why?
Because it is supposed to create a new form. We are dealing with a new
request, aren't we? This new request is missing the form bean named
"suchen".

NS> 10) Populating bean properties from this request

NS> It can't. The data of the form is gone...

NS> 11) BeanUtils.populate(de.zmnh.struts.form.SuchenForm@3acc67,
NS> {field(searchfield1)=[Ljava.lang.String;@41a12f,
NS> submit=[Ljava.lang.String;@bd4e3c,
NS> parameter(searchparam1)=[Ljava.lang.String;@5b78cf})
NS> 12) setProperty(de.zmnh.struts.form.SuchenForm@3acc67, field(searchfield1),
NS> [string_Geraet.Hersteller])
NS> 13) Skipping read-only property

NS> I don't have a ready-only property in the form... Not that I know of
NS> anyway. I have one in the next page, that should be displayed when all this
NS> works, but not here...

NS> 14) setProperty(de.zmnh.struts.form.SuchenForm@3acc67, submit, [Suchen])
NS> DEBUG 2003-07-07 12:13:44,519 [HttpProcessor[8080][3]] (BeanUtils.java:873)
NS> org.apache.commons.beanutils.BeanUtils -
NS> setProperty(de.zmnh.struts.form.SuchenForm@3acc67, parameter(searchparam1),
NS> [HP])
NS> 15) Skipping read-only property
NS> 16) Validating input form properties
NS> 17) No errors detected, accepting input
NS> 18) Looking for Action instance for class de.zmnh.struts.action.SuchenAction
NS> 19) Creating new Action instance

NS> The next two line are from a bean created in my Action class, that does a
NS> few things with the data it shoudl be getting from my form. I have added
NS> one line telling me the size of one of the maps that are stored in my form
NS> bean and get passed to the this SearchSupportBean but since a new form bean
NS> was created the size of this map is of course zero...

NS> 20) SearchSupportBean.createNew()
NS> 21) Fields size: 0

NS> Any ideas? I know, I don't have any anymore... Completely confused now...
NS> Thanks for the help so far.

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


NS> ---------------------------------------------------------------------
NS> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
NS> For additional commands, e-mail: struts-user-help@jakarta.apache.org



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re[8]: Form bean is not stored in request

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

you are welcome.

***************************************************************

NS> Hello Dirk,

>>try to change your getters (Field/Param) to return String, not Object.

NS> Thanks, that was it!! Can't believe I have been looking in the wrong place
NS> the whole damn time... That error had kept me guessing since last thursday!

NS> But now this part is working and I can face a whole new and different
NS> error. :) Thanks for all your help!

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


NS> ---------------------------------------------------------------------
NS> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
NS> For additional commands, e-mail: struts-user-help@jakarta.apache.org



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Re[6]: Form bean is not stored in request

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello Dirk,

>try to change your getters (Field/Param) to return String, not Object.

Thanks, that was it!! Can't believe I have been looking in the wrong place
the whole damn time... That error had kept me guessing since last thursday!

But now this part is working and I can face a whole new and different
error. :) Thanks for all your help!

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form bean is not stored in request

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello,

>This is definitely the problem.  What properties are you trying to
>set?

I have two map backed fields in form. Since they can actually exists
repeatedly I am building the name in my .jsp and am displaying this as
follows:

<tr bgcolor="#FFFFFF"> 
          <% String fname = "field(searchfield"+(counter)+")";
		     String pname = "parameter(searchparam"+(counter)+")";%>
          <td> <html:select property="<%=fname%>"> 
            <html:optionsCollection property="searchFields" value="value"
label="label"/> 
            </html:select></td>
          <td><html:text property="<%=pname%>"/></td>
        </tr>
        <% counter++;
   }while(counter<=number); %>

So, the fields should be set via setField(String key, String value) and
setParameter(String key, String value):

public void setField(String key, String value){
	LoggerSupport.logDebug("setField(): key: "+key+", value: "+value,log);
	this.fields.put(key,value);
	LoggerSupport.logDebug("setField(): sind die Daten auch in der Map?
"+(this.fields.get(key)==null?"Nein":"Ja "+this.fields.get(key)),log);
}

public void setParameter(String key, String value){
	LoggerSupport.logDebug("setParameter(): key: "+key+", value: "+value,log);
	this.params.put(key,value);
	LoggerSupport.logDebug("setParameter(): sind die Daten auch in der Map?
"+(this.params.get(key)==null?"Nein":"Ja "+this.params.get(key)),log);
}

The Maps are being initialzed in SuchenForm's contructor:

public SuchenForm(){
	fields = new TreeMap();
	params = new TreeMap();
	cnt = new Integer(1);
}

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re[6]: Form bean is not stored in request

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Struts,

  

***************************************************************

NS> And once again hello,

NS> [snip]
>>NS> 9) Storing ActionForm bean instance in scope 'request' under attribute
NS> key
>>NS> 'suchen'
>>
>>NS> Now, it created a new one and stores this one in the request right
NS> away...
>>NS> Why?
>>Because it is supposed to create a new form. We are dealing with a new
>>request, aren't we? This new request is missing the form bean named
>>"suchen".

NS> Wait a moment, I thought the form bean is supposed to be known in the
NS> action. The form's data needs to be processed further in the action and
NS> that can't really be done if there is a new form bean getting created in
NS> the action class every time... Or am I completely misunderstanding
NS> something here?

No. Before your action is called the form bean exists and its values
are set.

NS> Also, I've added another line of debugging info and it seems that my
NS> variables don't get filled at all, meaning my setField and setParameter
NS> methods do not get called to. I have write debug info into my logfile
NS> there, so that should get printed into the logfile if they were called...
NS> Also, there are these lines that are worrying me:

NS> setProperty(de.zmnh.struts.form.SuchenForm@1408a75, field(searchfield1),
NS> [string_Geraet.Hersteller])
NS> Skipping read-only property
NS> setProperty(de.zmnh.struts.form.SuchenForm@1408a75,
NS> parameter(searchparam1), [HP])
NS> Skipping read-only property

NS> I never said anything about read-only. I guess, that's actually my whole
NS> problem (not sure though) but I have no idea how to fix it.

This is definitely the problem.  What properties are you trying to
set?

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


NS> ---------------------------------------------------------------------
NS> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
NS> For additional commands, e-mail: struts-user-help@jakarta.apache.org



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re[6]: Form bean is not stored in request

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

try to change your getters (Field/Param) to return String, not Object.

Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Re[4]: Form bean is not stored in request

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
And once again hello,

[snip]
>NS> 9) Storing ActionForm bean instance in scope 'request' under attribute
key
>NS> 'suchen'
>
>NS> Now, it created a new one and stores this one in the request right
away...
>NS> Why?
>Because it is supposed to create a new form. We are dealing with a new
>request, aren't we? This new request is missing the form bean named
>"suchen".

Wait a moment, I thought the form bean is supposed to be known in the
action. The form's data needs to be processed further in the action and
that can't really be done if there is a new form bean getting created in
the action class every time... Or am I completely misunderstanding
something here?

Also, I've added another line of debugging info and it seems that my
variables don't get filled at all, meaning my setField and setParameter
methods do not get called to. I have write debug info into my logfile
there, so that should get printed into the logfile if they were called...
Also, there are these lines that are worrying me:

setProperty(de.zmnh.struts.form.SuchenForm@1408a75, field(searchfield1),
[string_Geraet.Hersteller])
Skipping read-only property
setProperty(de.zmnh.struts.form.SuchenForm@1408a75,
parameter(searchparam1), [HP])
Skipping read-only property

I never said anything about read-only. I guess, that's actually my whole
problem (not sure though) but I have no idea how to fix it.

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org