You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by thinair <ch...@edu.hefr.ch> on 2008/05/31 12:48:30 UTC
[Struts 2] s:iterator (post list back to java class doesn't work)
My Problem is the following :
1. When I trie to use the getThemes after the user post the submit button, I
have got a null exception value ? So I suspect the texfield name="... to be
uncorrect ?
My code is the following :
<s:form method="post" action="presidentThemes">
<s:iterator value="themes" id="id">
<s:textfield name="themes(%{id}).value" value="%{value}" />
<!-- code is converted to (in real html)
<input type="text" name="themes(1=Un petit theme).value" value="Un petit
theme" id="presidentThemes_themes(1=Un petit theme)_value"/>
-->
</s:iterator>
<s:submit name="submit" label="submit" value="submit" />
</s:form>
In the java class for the presidentThemes action ->
private Map<String, String> themes;
public Map<String, String> getThemes() {
return themes;
}
public void setThemes(Map<String, String> themes) {
this.themes = themes;
}
thx in advance,
--
View this message in context: http://www.nabble.com/-Struts-2--s%3Aiterator-%28post-list-back-to-java-class-doesn%27t-work%29-tp17574021p17574021.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Struts 2] s:iterator (post list back to java class doesn't
work)
Posted by thinair <ch...@edu.hefr.ch>.
Hi,
it didn't work for me.
But the following works for a similar sample (affectMap is a Treemap) :
<s:iterator value="affectMap" status="status">
<s:textfield name="affectMap[%{#status.index}]"
value="%{value}" label="%{key}" labelposition="left" />
</s:iterator>
Volker Karlmeier wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> maybe you mean this:
>
> <s:form method="post" action="presidentThemes">
> <s:iterator value="themes" status="status">
> <s:textfield name="themes(#status.index).value" value="%{value}"
> />
> </s:iterator>
>
> Volker
>
> thinair schrieb:
> | My Problem is the following :
> | 1. When I trie to use the getThemes after the user post the submit
> button, I
> | have got a null exception value ? So I suspect the texfield name="...
> to be
> | uncorrect ?
> |
> | My code is the following :
> |
> | <s:form method="post" action="presidentThemes">
> | <s:iterator value="themes" id="id">
> | <s:textfield name="themes(%{id}).value" value="%{value}" />
> | <!-- code is converted to (in real html)
> | <input type="text" name="themes(1=Un petit theme).value" value="Un
> petit
> | theme" id="presidentThemes_themes(1=Un petit theme)_value"/>
> | -->
> | </s:iterator>
> |
> | <s:submit name="submit" label="submit" value="submit" />
> | </s:form>
> |
> | In the java class for the presidentThemes action ->
> |
> | private Map<String, String> themes;
> | public Map<String, String> getThemes() {
> | return themes;
> | }
> |
> | public void setThemes(Map<String, String> themes) {
> | this.themes = themes;
> | }
> |
> | thx in advance,
>
>
> - --
> - -------------------------------
>
> Volker Karlmeier
> Friedrich-Freye-Str. 61
> 45481 Mülheim/Ruhr
>
> Tel. : (+49) 208-7785675
> Mobil: (+49) 176-21056587
> Mail : Volker@magiccode.eu
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (GNU/Linux)
>
> iD4DBQFIQbE0aEMQXBIqssERAu9fAJi+fc8/OUlY64gstblKeOw2l0ocAJ4q/uB7
> 6uk+0SFPTNBxVzG+h76cPw==
> =cFBc
> -----END PGP SIGNATURE-----
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/-Struts-2--s%3Aiterator-%28post-list-back-to-java-class-doesn%27t-work%29-tp17574021p17633553.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Struts 2] s:iterator (post list back to java class doesn't work)
Posted by Volker Karlmeier <vo...@magiccode.eu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
maybe you mean this:
<s:form method="post" action="presidentThemes">
<s:iterator value="themes" status="status">
<s:textfield name="themes(#status.index).value" value="%{value}" />
</s:iterator>
Volker
thinair schrieb:
| My Problem is the following :
| 1. When I trie to use the getThemes after the user post the submit
button, I
| have got a null exception value ? So I suspect the texfield name="...
to be
| uncorrect ?
|
| My code is the following :
|
| <s:form method="post" action="presidentThemes">
| <s:iterator value="themes" id="id">
| <s:textfield name="themes(%{id}).value" value="%{value}" />
| <!-- code is converted to (in real html)
| <input type="text" name="themes(1=Un petit theme).value" value="Un petit
| theme" id="presidentThemes_themes(1=Un petit theme)_value"/>
| -->
| </s:iterator>
|
| <s:submit name="submit" label="submit" value="submit" />
| </s:form>
|
| In the java class for the presidentThemes action ->
|
| private Map<String, String> themes;
| public Map<String, String> getThemes() {
| return themes;
| }
|
| public void setThemes(Map<String, String> themes) {
| this.themes = themes;
| }
|
| thx in advance,
- --
- -------------------------------
Volker Karlmeier
Friedrich-Freye-Str. 61
45481 Mülheim/Ruhr
Tel. : (+49) 208-7785675
Mobil: (+49) 176-21056587
Mail : Volker@magiccode.eu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD4DBQFIQbE0aEMQXBIqssERAu9fAJi+fc8/OUlY64gstblKeOw2l0ocAJ4q/uB7
6uk+0SFPTNBxVzG+h76cPw==
=cFBc
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org