Re: Struts 1.1 iterate woes
That works, thanks. But does anyone have a Struts EL version? I prefer to go that route. Thanks Victor ___ Sent with SnapperMail www.snappermail.com .. Original Message ... On Sun, 3 Oct 2004 18:27:11 -0500 Hubert Rabago <[EMAIL PROTECTED]> wrote: >I have to admit I always have trouble dealing with the iterate tag. I >recently rediscovered how easy it is to do these iterations using the >nested tags. Have you tried them? Maybe something like this would >work for you: > > > > > onchange="changefield(this);"/> > > > Send > > >I don't know if it's considered "best practice" to also surround the >form with , but I've tried using the basic >and it works fine, too. The result is code I can actually understand. >:) > >If you want to stick to the html tags, take a look at the example in >http://wiki.apache.org/struts/StrutsCatalogLazyList > >hth, >Hubert > >On Sun, 3 Oct 2004 14:16:19 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote: >> We are trying to use in a JSP to access items in a list >> stored in the Form Bean by the Action class but we can't seem to get the >> syntax right. >> >> I am getting an error meessage from PropertyUtils that displays the index as >> '${index}', which indicates that that struts el expression is not resolving >> to an int. >> >> Here is my exact syntax. The form and action are described in more detail >> below. >> >> >>> property="list"> >> >> >> >> >> >> >> >> >>> onchange="changefield(this);"/> >> >> >> >>Send >> >> >> I have created several Test classes to help me understand the flow... >> >> The form is an instance of TestForm exends ActionForm and its form name in >> struts-config.xml is "testForm". (This is the named form for the action.) >> TestForm has one property: java.util.List list with accessors public List >> getList() and public void setList(List list). >> >> List is always a List of LineItem objects where LineItem is a simple >> JavaBean with properties >> String id (public String getId() and public void setId(String id)), String >> description (public String getDescription() and public void >> setDescription(String description)) and boolean isChanged (public void - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 1.1 iterate woes
If "${index}" is not evaluating, then this is not a Struts problem. It's an issue with the container you're using and your configuration of it. For instance, you appear to say you're using Struts-EL. Do you have the correct taglib directives to use Struts-EL as opposed to Struts? What container are you using? > -Original Message- > From: Victor Grazi [mailto:[EMAIL PROTECTED] > > We are trying to use in a JSP to access items > in a list stored in the Form Bean by the Action class but we > can't seem to get the syntax right. > > I am getting an error meessage from PropertyUtils that > displays the index as '${index}', which indicates that that > struts el expression is not resolving to an int. > > Here is my exact syntax. The form and action are described in > more detail below. > > >name="testForm" property="list"> > > > > > > > > >onchange="changefield(this);"/> > > > > Send > > > I have created several Test classes to help me understand the flow... > > The form is an instance of TestForm exends ActionForm and its > form name in struts-config.xml is "testForm". (This is the > named form for the action.) TestForm has one property: > java.util.List list with accessors public List > getList() and public void setList(List list). > > List is always a List of LineItem objects where LineItem is a > simple JavaBean with properties String id (public String > getId() and public void setId(String id)), String description > (public String getDescription() and public void > setDescription(String description)) and boolean isChanged > (public void setIsChanged(boolean value) and public boolean > getIsChanged() ) > > The Action (TestAction extends Action) "execute" method > creates a List of 5 LineItem objects and stores that List > into the form by calling ((TestForm)form).setList(list), then > forwards to the jsp (test.jsp) > > In the jsp I would like to iterate through the list to perform the > following: > display the id (as html read-only text) and the > description (as html:text) of each line item, > then use JavaScript to change the "isChanged" property (in a > hidden field) when the onchange event is triggered. > > I have tried several different syntaxes. I also tried using > arrays instead of List's. I also specified the type of the > LineItem class explicitly in the form element. I tried each > of the "html:" and "bean:write" lines above one at a time to > see if any would be successful, but they all produce that > same error. I have combed the web for a good example of how > to accomplish this, but I couldn't find anything that handled > things in a way that would work for us. > > Can you tell me what I am doing wrong and how to accomplish > the access? > > Thanks/Victor > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.1 iterate woes
Thanks Addy, but I am not clear on your syntax. What is your bVO.lines? Remember my list is in my form. Also what is bLine? Not sure where my variables correspond Regards Victor .. Original Message ... On Sun, 3 Oct 2004 15:55:20 -0400 Addy Kapur <[EMAIL PROTECTED]> wrote: >I have used the following syntax and it works. > > > "/> >"/> >"/> > > > >On Sun, 3 Oct 2004 14:16:19 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote: >> We are trying to use in a JSP to access items in a list >> stored in the Form Bean by the Action class but we can't seem to get the >> syntax right. >> >> I am getting an error meessage from PropertyUtils that displays the index as >> '${index}', which indicates that that struts el expression is not resolving >> to an int. >> >> Here is my exact syntax. The form and action are described in more detail >> below. >> >> >> > property="list"> >> >> >> >> >> >> >> >> >> > onchange="changefield(this);"/> >> >> >> >> Send >> >> >> I have created several Test classes to help me understand the flow... >> >> The form is an instance of TestForm exends ActionForm and its form name in >> struts-config.xml is "testForm". (This is the named form for the action.) >> TestForm has one property: java.util.List list with accessors public List >> getList() and public void setList(List list). >> >> List is always a List of LineItem objects where LineItem is a simple >> JavaBean with properties >> String id (public String getId() and public void setId(String id)), String >> description (public String getDescription() and public void >> setDescription(String description)) and boolean isChanged (public void >> setIsChanged(boolean value) and public boolean getIsChanged() ) >> >> The Action (TestAction extends Action) "execute" method creates a List of 5 >> LineItem objects and stores that List into the form by calling >> ((TestForm)form).setList(list), then forwards to the jsp (test.jsp) >> >> In the jsp I would like to iterate through the list to perform the >> following: >> display the id (as html read-only text) and the >> description (as html:text) of each line item, >> then use JavaScript to change the "isChanged" property (in a hidden field) >> when the onchange event is triggered. >> >> I have tried several different syntaxes. I also tried using arrays instead >> of List's. I also specified the type of the LineItem class explicitly in the >> form element. I tried each of the "html:" and "bean:write" lines above one >> at a time to see if any would be successful, but they all produce that same >> error. I have combed the web for a good example of how to accomplish this, >> but I couldn't find anything that handled things in a way that would work >> for us. >> >> Can you tell me what I am doing wrong and how to accomplish the access? >> >> Thanks/Victor >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.1 iterate woes
I have to admit I always have trouble dealing with the iterate tag. I recently rediscovered how easy it is to do these iterations using the nested tags. Have you tried them? Maybe something like this would work for you: Send I don't know if it's considered "best practice" to also surround the form with , but I've tried using the basic and it works fine, too. The result is code I can actually understand. :) If you want to stick to the html tags, take a look at the example in http://wiki.apache.org/struts/StrutsCatalogLazyList hth, Hubert On Sun, 3 Oct 2004 14:16:19 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote: > We are trying to use in a JSP to access items in a list > stored in the Form Bean by the Action class but we can't seem to get the > syntax right. > > I am getting an error meessage from PropertyUtils that displays the index as > '${index}', which indicates that that struts el expression is not resolving > to an int. > > Here is my exact syntax. The form and action are described in more detail > below. > > > property="list"> > > > > > > > > > onchange="changefield(this);"/> > > > >Send > > > I have created several Test classes to help me understand the flow... > > The form is an instance of TestForm exends ActionForm and its form name in > struts-config.xml is "testForm". (This is the named form for the action.) > TestForm has one property: java.util.List list with accessors public List > getList() and public void setList(List list). > > List is always a List of LineItem objects where LineItem is a simple > JavaBean with properties > String id (public String getId() and public void setId(String id)), String > description (public String getDescription() and public void > setDescription(String description)) and boolean isChanged (public void > setIsChanged(boolean value) and public boolean getIsChanged() ) > > The Action (TestAction extends Action) "execute" method creates a List of 5 > LineItem objects and stores that List into the form by calling > ((TestForm)form).setList(list), then forwards to the jsp (test.jsp) > > In the jsp I would like to iterate through the list to perform the > following: > display the id (as html read-only text) and the > description (as html:text) of each line item, > then use JavaScript to change the "isChanged" property (in a hidden field) > when the onchange event is triggered. > > I have tried several different syntaxes. I also tried using arrays instead > of List's. I also specified the type of the LineItem class explicitly in the > form element. I tried each of the "html:" and "bean:write" lines above one > at a time to see if any would be successful, but they all produce that same > error. I have combed the web for a good example of how to accomplish this, > but I couldn't find anything that handled things in a way that would work > for us. > > Can you tell me what I am doing wrong and how to accomplish the access? > > Thanks/Victor > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.1 iterate woes
I have used the following syntax and it works. "/> "/> "/> On Sun, 3 Oct 2004 14:16:19 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote: > We are trying to use in a JSP to access items in a list > stored in the Form Bean by the Action class but we can't seem to get the > syntax right. > > I am getting an error meessage from PropertyUtils that displays the index as > '${index}', which indicates that that struts el expression is not resolving > to an int. > > Here is my exact syntax. The form and action are described in more detail > below. > > > property="list"> > > > > > > > > > onchange="changefield(this);"/> > > > > Send > > > I have created several Test classes to help me understand the flow... > > The form is an instance of TestForm exends ActionForm and its form name in > struts-config.xml is "testForm". (This is the named form for the action.) > TestForm has one property: java.util.List list with accessors public List > getList() and public void setList(List list). > > List is always a List of LineItem objects where LineItem is a simple > JavaBean with properties > String id (public String getId() and public void setId(String id)), String > description (public String getDescription() and public void > setDescription(String description)) and boolean isChanged (public void > setIsChanged(boolean value) and public boolean getIsChanged() ) > > The Action (TestAction extends Action) "execute" method creates a List of 5 > LineItem objects and stores that List into the form by calling > ((TestForm)form).setList(list), then forwards to the jsp (test.jsp) > > In the jsp I would like to iterate through the list to perform the > following: > display the id (as html read-only text) and the > description (as html:text) of each line item, > then use JavaScript to change the "isChanged" property (in a hidden field) > when the onchange event is triggered. > > I have tried several different syntaxes. I also tried using arrays instead > of List's. I also specified the type of the LineItem class explicitly in the > form element. I tried each of the "html:" and "bean:write" lines above one > at a time to see if any would be successful, but they all produce that same > error. I have combed the web for a good example of how to accomplish this, > but I couldn't find anything that handled things in a way that would work > for us. > > Can you tell me what I am doing wrong and how to accomplish the access? > > Thanks/Victor > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 1.1 iterate woes
We are trying to use in a JSP to access items in a list stored in the Form Bean by the Action class but we can't seem to get the syntax right. I am getting an error meessage from PropertyUtils that displays the index as '${index}', which indicates that that struts el expression is not resolving to an int. Here is my exact syntax. The form and action are described in more detail below. Send I have created several Test classes to help me understand the flow... The form is an instance of TestForm exends ActionForm and its form name in struts-config.xml is "testForm". (This is the named form for the action.) TestForm has one property: java.util.List list with accessors public List getList() and public void setList(List list). List is always a List of LineItem objects where LineItem is a simple JavaBean with properties String id (public String getId() and public void setId(String id)), String description (public String getDescription() and public void setDescription(String description)) and boolean isChanged (public void setIsChanged(boolean value) and public boolean getIsChanged() ) The Action (TestAction extends Action) "execute" method creates a List of 5 LineItem objects and stores that List into the form by calling ((TestForm)form).setList(list), then forwards to the jsp (test.jsp) In the jsp I would like to iterate through the list to perform the following: display the id (as html read-only text) and the description (as html:text) of each line item, then use JavaScript to change the "isChanged" property (in a hidden field) when the onchange event is triggered. I have tried several different syntaxes. I also tried using arrays instead of List's. I also specified the type of the LineItem class explicitly in the form element. I tried each of the "html:" and "bean:write" lines above one at a time to see if any would be successful, but they all produce that same error. I have combed the web for a good example of how to accomplish this, but I couldn't find anything that handled things in a way that would work for us. Can you tell me what I am doing wrong and how to accomplish the access? Thanks/Victor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]