struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andihartm...@freenet.de>
Subject creating html:text-forms on the fly
Date Wed, 12 Apr 2006 17:47:50 GMT
Hello,

I've got a lot of html:text forms, which are created on the fly -
therefore I don't know during programming, which getter and setter-methods
will be needed. I assume, it works by using arrays.

<logic:iterate property="value" id="entry" indexId="ctr" >
	<html:text name="entry" property='<%="value["+ctr+"]"%>' >
</logic:iterate>


In the ActionForm:

ArrayList <String> value=new ArrayList<String>();
public String getValue(int id) {return value.get(id);}
public void setValue(String value, int id) {value.set(id,value);}


Is this correctly?




Would it be possible to operate with a Hashtable, too?
Something like:

In the ActionForm
Hashtable <String,String> hash = new Hashtable <String,String>();
Hashtable <String,String> hash getHashtable (return hash;)

public String getValue(String key) {return hash.get(key);}
public String setValue(String value, String key) {hash.put(key,value);}

In the jsp:
<logic:iterate property="hashtable" id="key" >
	<html:text name="key" property="value" >
</logic:iterate>

How could the Hashtable be directly accessed in the jsp without the
iterate-tag (literal and with a method)?
<html:text name="hashtable" property="??">



I would be very glad if anybody could give me some advice, how to do these
things.


Kind regards,
Andreas Hartmann


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


Mime
View raw message