You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ma...@nokia.com on 2003/07/06 21:15:11 UTC

logic:iterate question

hi all,
	i have a Map-backed action Form which contains an HashMap

the ActionForm is as follows

public MapActionForm extends ActionForm {
	HashMap table = new HashMap();


	public void setValue(String key, String value) {
          ...
      }

	public Object getValue(String key) {
	    ..
      }

      public HashMap getTable() {
		return table;
      }

}


in one of jsp i have to display a textfield for each key contained in the HashMap.

i have written following code (name of the bean is DisplayKeys)

<logic:iterate id="params" collection="<%= displayKeys.getTable() %>">
                      <tr>
                        <td><bean:write name="params"/></td>
                        <td><html:text property="value(<bean:write name="params"/>)"/></td>
                      </tr>
</logic:iterate>

but when i get into the page (after populating the bean) i got following exception:

org.apache.jasper.JasperException: /callservice.jsp(53,79) equal symbol expected

the hashmap contains parameter names.
in the jps i want to display the name of the parameter (done with bean:write name="params")
and i want to display close to teh name an input text with the name of the parameter..

Example:
in the map i have following values

param1, ""
param2, ""


and in the jsp i want to display

param1 : <input type="text" name="param1"/>


anyone can give me some help?

regards
	marco	



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


Re: logic:iterate question

Posted by Sandeep Takhar <sa...@yahoo.com>.
The following link should help:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg71256.html

however it talks about using el, but this is not
necessary.

I have got the nested tags to work properly.  The
logic tag should work, but I think I was doing
something slightly wrong when I tried.

Remember to have

getMap(String key)

and 

setMap(String key, Object value)

in your form.  The online help has more on this.


sandeep
--- Marco.Mistroni@nokia.com wrote:
> hi all,
> 	i have a Map-backed action Form which contains an
> HashMap
> 
> the ActionForm is as follows
> 
> public MapActionForm extends ActionForm {
> 	HashMap table = new HashMap();
> 
> 
> 	public void setValue(String key, String value) {
>           ...
>       }
> 
> 	public Object getValue(String key) {
> 	    ..
>       }
> 
>       public HashMap getTable() {
> 		return table;
>       }
> 
> }
> 
> 
> in one of jsp i have to display a textfield for each
> key contained in the HashMap.
> 
> i have written following code (name of the bean is
> DisplayKeys)
> 
> <logic:iterate id="params" collection="<%=
> displayKeys.getTable() %>">
>                       <tr>
>                         <td><bean:write
> name="params"/></td>
>                         <td><html:text
> property="value(<bean:write name="params"/>)"/></td>
>                       </tr>
> </logic:iterate>
> 
> but when i get into the page (after populating the
> bean) i got following exception:
> 
> org.apache.jasper.JasperException:
> /callservice.jsp(53,79) equal symbol expected
> 
> the hashmap contains parameter names.
> in the jps i want to display the name of the
> parameter (done with bean:write name="params")
> and i want to display close to teh name an input
> text with the name of the parameter..
> 
> Example:
> in the map i have following values
> 
> param1, ""
> param2, ""
> 
> 
> and in the jsp i want to display
> 
> param1 : <input type="text" name="param1"/>
> 
> 
> anyone can give me some help?
> 
> regards
> 	marco	
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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