Article View: comp.lang.java.programmer
Article #479Help me with struts please!!!
From: lou
Date: Wed, 13 Nov 2002 17:34
Date: Wed, 13 Nov 2002 17:34
87 lines
3953 bytes
3953 bytes
Hello
I have a problem with struts tags and I can not fix it!!.
In fact, I am using in my jsp nested tags for:
1- selecting items from a list of objects (and by the way, those lists
are themselves repeated several times in another nested:iterate tag )
2- display itereted input boxes with another nested:iterate tag. This
input boxs are filled from a list of objects (listAttValue)and when
the user enter a new value and click on submit, those values are
inserted in the bean after executing the validate method in the Action
form.
Here is my code:
<nested:iterate property="<%= Constants.LIST_NEW_CATEGORY_ITEMS %>"
>
<tr>
<td>
<html:select name="<%=Constants.CATEGORY_ITEM %>"
property="concatAttValues" indexed="true"
onchange="extract(this.name, this.value)">
<html:options
collection="<%=Constants.LIST_CATEGORY_ITEMS %>" property="itemId"
labelProperty="concatAttValues"/>
</html:select>
</td>
<td>
<html:hidden name="<%= Constants.LIST_NEW_CATEGORY_ITEMS
%>" property="itemId" indexed="true"/>
<nested:iterate property="listAttValue" >
<nested:write property="attValueId"/>
<nested:text property="attValue"/>
</nested:iterate>
</td>
</tr>
</nested:iterate>
So far everything is correct. I just have to code my validate method
and everything is setted by itself
I was very happy (in the beginning) with the result and the
felxibility the nested tags give. But the a problem came up
The Big Problem is the following:
When I select an Item from one of my select lists, I want a javascript
fonction(extract()), extract substrings from the item selected and
then put those substrings in the input text boxes (which contents
should be affected later, during the submit to the object
listAttributs, just like if the user input them by hand)
So the idea is to affect those substrings, in the extract function, to
the name of the input fields.
But as you know, when we use nested tags, ALL the input fields name in
the Html result are indexed
example:
listNewCategoryItems[0].listAttValue[1].attValue
And if I use this syntax in my extract method, a javaScript error
occurs saying: Object Expected
I think that the javascript doesn't accept the indexed syntax above
because As soon as I remove this instruction, the error disapears.
So what should I do to code my javascript method and have my
fonctionnalty and fix my problem????
I have been struggling with this problem for many days and I haven't
find the solution yet
Please help me!!!!
Thank you so much
Lou
Technical Details
Message-ID:
<3307736e.0211130934.1c284998@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff8e2,de7415f8b03152e8,start X-Google-Attributes: gidff8e2,public X-Google-Thread: 10a146,de7415f8b03152e8,start X-Google-Attributes: gid10a146,public X-Google-Thread: 106c40,de7415f8b03152e8,start X-Google-Attributes: gid106c40,public X-Google-Thread: 106af8,de7415f8b03152e8,start X-Google-Attributes: gid106af8,public X-Google-Thread: f4be4,de7415f8b03152e8,start X-Google-Attributes: gidf4be4,public X-Google-ArrivalTime: 2002-11-13 09:34:51 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: louisab2003@yahoo.ca (lou) Newsgroups: comp.lang.java.programmer,borland.public.jbuilder.servlets-jsp,weblogic.developer.interest.servlet,debian.bugs.dist,debian.bugs.closed Subject: Help me with struts please!!! Date: 13 Nov 2002 09:34:50 -0800 Organization: http://groups.google.com/ Lines: 87 Message-ID: <3307736e.0211130934.1c284998@posting.google.com> NNTP-Posting-Host: 65.94.116.243 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1037208890 30836 127.0.0.1 (13 Nov 2002 17:34:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 13 Nov 2002 17:34:50 GMT