struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Maré <l...@webtothemax.com>
Subject RE: what setters do i implement in an indexed tag ?
Date Wed, 15 Aug 2001 21:26:26 GMT
I'm following closely Dave's example code and almost have it working, except
that on post of the JSP form the parameter's values (which are correct) are
not stored in the Formbean's list. So seem to have had the same problem and
solved it. However, I fail to see what the difference between your 'hacked'
version and Dave's original code is. Please enlighten me.

TIA

Marcel


> -----Oorspronkelijk bericht-----
> Van: Warwick Boote [mailto:Warwick.Boote@eurobenefits.com]
> Verzonden: woensdag 25 juli 2001 17:13
> Aan: struts-user@jakarta.apache.org
> Onderwerp: RE: what setters do i implement in an indexed tag ?
>
>
> Here is a hacked version of the code posted by David Hay previously.  The
> code here will compile and run - a Vector is populated then displayed.
> After a post, the vector is retrieved from the form and then System.out is
> used to show its size.
>
> This should help others that are having problems with indexed
> tags.  You'll
> need to point your browser to somthing that looks like
> http://localhost/struts/ShowParameters.do once you've copied all the files
> into the correct locations.
>
> There were two issues with the way i was trying to do it, firstly
> it seems that unless the scope of the form is set to session (or
> not specified) it doesn't work and secondly because i was using a
> different id for the name in the logic:iterate / html:text tags
> (when i set them to
> "parameter" it worked).
>
> <logic:iterate id="parameter" name="FieldsMapForm"
> property="parameterList">
>   <html:text name="parameter" property="attributeCode"
> indexed="true"/> <br>
> </logic:iterate>
>
>
>     <action    path="/mapping"
>                type="com.eurobenefits.dta.presentation.FieldsMapAction"
>                scope="session"
>                name="FieldsMapForm"
>                validate="false">
>            <forward   name="viewmappings"
> path="/DefineFieldMappings.jsp"/>
>     </action>
>
> Waz.
> =)
>
> -----Original Message-----
> From: Warwick Boote [mailto:Warwick.Boote@eurobenefits.com]
> Sent: 24 July 2001 14:09
> To: struts-user@jakarta.apache.org
> Subject: what setters do i implement in an indexed tag ?
>
>
> I've created a page using indexed tags (neat stuff!).
> Here is what is currently working for me:
> o If i populate the form's vector, values from that vector are
> displayed in
> the jsp
> Here is what it not working:
> o when the form is posted back, the vector is null (in the struts
> perform()
> method)
> I suspect i haven't implemented some sort of setter within the form but i
> can't find an example as to what method should be implemented.  I've tried
> ArrayList and using parameterList instead with no different result.
> Thanks,
> Waz.
> =)
> Here are some code snippits for help:
> ---jsp---
> <logic:iterate id="mappings" name="FieldsMapForm"
> property="fieldMappings">
> <html:text name="mappings" property="attributeCode" indexed="true"/> <br>
> </logic:iterate>
> ---Form---
> public class FieldsMapForm extends ActionForm {
> private String fileColCount;
> private java.util.Vector fieldMappings = new java.util.Vector();
> private String action;
> public String getFileColCount() {
> return fileColCount;
> }
> public void setFileColCount(String newFileColCount) {
> fileColCount = newFileColCount;
> }
> public void setFieldMappings(java.util.Vector newFieldMappings) {
> fieldMappings = newFieldMappings;
> }
> public java.util.Vector getFieldMappings() {
> return fieldMappings;
> }
> public FieldMapping getParameter(int index) {
> return (FieldMapping)fieldMappings.elementAt(index);
> }
> public void setAction(String newAction) {
> action = newAction;
> }
> public String getAction() {
> return action;
> }
> public void reset(ActionMapping mapping, HttpServletRequest request) {
> fileColCount = null;
> fieldMappings = new java.util.Vector();
> action = null;
> }
> }
> ---The vector contains these:---
> public class FieldMapping implements Serializable {
> private Integer fieldNumber;
> private String attributeCode;
> public void setFieldNumber(Integer newFieldNumber) {
> fieldNumber = newFieldNumber;
> }
> public Integer getFieldNumber() {
> return fieldNumber;
> }
> public void setAttributeCode(String newAttributeCode) {
> attributeCode = newAttributeCode;
> }
> public String getAttributeCode() {
> return attributeCode;
> }
> }
>  <<indexed_eg_rwb.zip>>
>
>


Mime
View raw message