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 13:40:04 UTC

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

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: 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