Results 1 to 5 of 5
- 10-10-2012, 08:19 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 6
- Rep Power
- 0
how to send value of a list to a hidden tag?
I have the following code in my jsp:
the html source is as following:Java Code:<c:forEach var="value" items="${MyList}" varStatus="loop"> <tr><td><div id="Name1">Here:${value.name}</div></td></tr> <s:hidden id="Name" name="Name" value="%{value.name}"/>
As demonstrated the div tag is showing the value.name correctly but the value attribute of hidden tag is empty. I could not find any solution because most of the solutions were not related to list.Java Code:<tr><td><div id="Name1">Here:My name is X</div></td></tr> <input type="hidden" name="Name" value="" id="Name"/>
I changed it to ${value.name} but ran into this error: "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"
- 10-10-2012, 09:47 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: how to send value of a list to a hidden tag?
You're mixing the jsp tags with struts tags.
Struts has its own iterator tag, so I would suggest using that.
That's the first thing.
Second, the name part of your hidden field has to map to something in the action, otherwise struts does not know where to pull the value from.
You don't generally set the value field (unless you need a default).
So your name would be "MyList[%{#loop.index}]", or something along those lines.Please do not ask for code as refusal often offends.
- 10-10-2012, 11:48 AM #3
Member
- Join Date
- Oct 2012
- Posts
- 6
- Rep Power
- 0
Re: how to send value of a list to a hidden tag?
I do not get you, what do you mean by "MyList[%{#loop.index}]", or something along those lines. would you give me a sample code?
- 10-10-2012, 11:49 AM #4
Member
- Join Date
- Oct 2012
- Posts
- 6
- Rep Power
- 0
- 10-10-2012, 12:41 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: how to send value of a list to a hidden tag?
In other words, use Struts the way it was intended.
The whole point behind struts is that the name field of the various input tags references an actual attribute on the action invoked.
So your hidden field names need to reference something, which I presumed was MyList[<index>].Please do not ask for code as refusal often offends.
Similar Threads
-
Passwords not hidden
By kkid in forum Suggestions & FeedbackReplies: 6Last Post: 11-13-2012, 02:21 PM -
Hidden JText Field
By jo15765 in forum New To JavaReplies: 5Last Post: 05-29-2012, 04:18 AM -
How to send a list as a input for a oracle procedure
By anilkumar_vist in forum Advanced JavaReplies: 4Last Post: 11-24-2010, 08:51 AM -
simple send email APP, but when press send button appeared:
By lse123 in forum Advanced JavaReplies: 10Last Post: 06-06-2010, 06:49 PM -
Hidden Button after paint()
By MuslimCoder in forum New To JavaReplies: 5Last Post: 09-14-2009, 05:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks