Hi there,

I never worked with a text box in the logic iterate  but i worked with a
radio button.

<logic:iterate id="apprEntry" name="listDevApprGrpList" indexId="userIndex">
<tr>
<td.....</td>
<td>
             <html:radio value="A" name="apprEntry"
property="primary_or_adjunct" indexed="true" onclick="">Pri.</html:radio>
             <html:radio value="B" name="apprEntry"
property="primary_or_adjunct" indexed="true" onclick="">Adj.</html:radio>
</td>
<td.....</td>
<td.....</td>
</tr>
</logic:iterate>

for(int i=0;i<listDevApprGrpList.size();i++) // prepare a primary adjunct
array
{
 String preparedString = "apprEntry["+i+"].primary_or_adjunct";
 String tempValue = request.getParameter(preparedString);
 primAdj[i] = tempValue;
}


For this code
<logic:iterate id="orderproductlist" name="orderProductList"
property="arrayList" type="temptest.OrderProduct">
<tr>
<td><html:text indexed="true" size='4' maxlength='4' name="orderproductlist"
property="productQuantity" /></td>
<td><bean:write name="orderproductlist" property="productDesc" /></td>
<td><bean:write name="orderproductlist" property="productCharge"
/><html:hidden name="orderproductlist" property="productID" /></td>
</tr>
</logic:iterate>

May be for your Text box you can access it in the action form in this
fashion

for(int i=0;i<orderProductList.size();i++) // prepare a primary adjunct
array
{
 String preparedString = "orderproductlist["+i+"].productQuantity";
 String tempValue = request.getParameter(preparedString);
 System.out.println("pth string is "+tempValue);
 result[i] = tempValue;
}

this will be the same order as that of the ones in  ArrayList. So its kind
of hard to get the product ID at the same time. but if you have them in the
same order you can match them up.

Try it out and let me know if this works.

regards,
Uday Karrothi

On 11/13/06, Gallagher, Jim (RBoS ITD&S Dublin) <[EMAIL PROTECTED]>
wrote:

Hi,

        Further information as requested:

The formbean is as below:

package com.rbsg.application.serviceuserweb.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;

import temptest.OrderList;
import temptest.OrderProduct;

public class ScReplacementOrderFormBean extends ValidatorForm {

        private String contactID = null;
        private boolean waiveCharge = false;
        private String waiveReason = null;
        private String reasonReplaced = null;
        private OrderList orderProductList = null;

        public void reset(ActionMapping mapping, HttpServletRequest
request)
{

                contactID = null;
                waiveCharge = false;
                waiveReason = null;
                reasonReplaced = null;
                orderProductList = null;
        }

        public ActionErrors validate(
                ActionMapping mapping,
                HttpServletRequest request) {

                ActionErrors errors = new ActionErrors();
                return errors;

        }

        public String getContactID() {
                return contactID;
        }

        public String getReasonReplaced() {
                return reasonReplaced;
        }

        public boolean isWaiveCharge() {
                return waiveCharge;
        }

        public String getWaiveReason() {
                return waiveReason;
        }

        public void setContactID(String string) {
                contactID = string;
        }

        public void setReasonReplaced(String string) {
                reasonReplaced = string;
        }

        public void setWaiveCharge(boolean b) {
                waiveCharge = b;
        }

        public void setWaiveReason(String string) {
                waiveReason = string;
        }

        public OrderList getOrderProductList() {
                return orderProductList;
        }

        public void setProductList(OrderList list) {
                orderProductList = list;
        }

}

The relevant portion of struts-config.xml is:

<form-bean name="scReplacementOrderBean"
type="com.rbsg.application.serviceuserweb.forms.ScReplacementOrderFormBean
">
</form-bean>

<action path="/scSubmitReplacement"
type="
com.rbsg.application.serviceuserweb.actions.ScSubmitReplacementAction"
name="scReplacementOrderBean">
        <forward name="success" path="ScContactListPath"></forward>
</action>

The relevant portion of the JSP is below:

<logic:iterate id="orderproductlist" name="orderProductList"
property="arrayList" type="temptest.OrderProduct">
<tr>
<td><html:text indexed="true" size='4' maxlength='4'
name="orderproductlist"
property="productQuantity" /></td>
<td><bean:write name="orderproductlist" property="productDesc" /></td>
<td><bean:write name="orderproductlist" property="productCharge"
/><html:hidden name="orderproductlist" property="productID" /></td>
</tr>
</logic:iterate>

This is obviously contained in a larger form, which executes the
SCSubmitReplacement action.

I've investigated options like multibox, but because I need to capture 2
pieces of information from each line of the iterate (the productID and the
productQuantity) I don't think this suits my needs. Can I get the updated
collection in the formbean, or is there another technique I need to use?

Thanks in advance for all advice

                                 Regards,

                                         Jim


-----Original Message-----
From: news [mailto:[EMAIL PROTECTED]
Sent: 11 November 2006 01:52
To: user@struts.apache.org
Subject: Re: Question on formbeans and collections in iterate tags

*** WARNING : This message originates from the Internet ***

Gallagher, Jim (RBoS ITD&S Dublin) wrote:
> Hi,
>
>       I'm having an issue with a formbean not containing the data I
expect

> when returned from a JSP. I suspect this is a common problem, but
> despite searches I can't find a solution on the net. Any assistance
> will be gratefully received.
>
>       My form consists of general data about a specific person, along
with

> an area about purchases. The purchases are listed using
> <logic:iterate> tags, with a collection used to drive the iteration.
>
>       On submission of the form I was hoping/expecting that the
collection

> would be populated into the same-named instance variable in the
> formbean, allowing me to retrieve the changes made by the user in the
> JSP. However, this is not happening as the formbean instance variable is
null.
>
>       Could anyone suggest a way forward or point me to web resource to
> assist with this? I'm sure it's something I'm doing wrong, but I'm not
> sure what.

We'd need a bit more information to be able to help much. What does your
form bean look like? How is it configured in struts-config.xml? What do
the
relevant action mappings look like? And how is your JSP coded?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



The Royal Bank of Scotland plc, Registered in Scotland No. 90312.
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If
the message is received by anyone other than the addressee, please return
the message to the sender by replying to it and then delete the message from
your computer. Internet e-mails are not necessarily secure. The Royal Bank
of Scotland plc does not accept responsibility for changes made to this
message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the onward
transmission, opening or use of this message and any attachments will not
adversely affect its systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry out
such virus and other checks as it considers appropriate.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to