A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
bean:write inside html:text
Mark Butcher
Ranch Hand
Joined: Jun 28, 2012
Posts: 41
posted
Jan 11, 2013 23:18:45
0
Hi there,
Not able to display values with <bean:write> inside <html:text> using Struts 1.3
Here is the code :
Action Class
--------------
public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { ArrayList list = new ArrayList(); list.add("Hello"); list.add("Good"); list.add("Morning"); request.setAttribute("sendToJsp",list); return mapping.findForward("success"); }
JSP
Code
-----------
<logic:iterate id="myIter" name="sendToJsp"> <html:text property="<%<bean:write name="myIter"/>%>" /> </logic:iterate>
Thank you.
Mark
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
13
I like...
posted
Jan 11, 2013 23:41:42
0
You cannot use a custom tag as the attribute value of another custom tag.
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
Mark Butcher
Ranch Hand
Joined: Jun 28, 2012
Posts: 41
posted
Jan 13, 2013 07:36:16
0
Okay.....but an alternative would really help me.
Karthik Jayachandran
Ranch Hand
Joined: Feb 18, 2009
Posts: 36
I like...
posted
Jan 14, 2013 22:02:46
0
Mark Butcher wrote:
Okay.....but an alternative would really help me.
Try iterating using JSTL tags
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
13
I like...
posted
Jan 14, 2013 22:08:05
0
Mark Butcher wrote:
Okay.....but an alternative would really help me.
I would be using JSTL and EL rather than proprietary tags. The EL
can
be used as attribute values.
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4118
2
I like...
posted
Jan 15, 2013 07:54:14
0
Or you could use the version of the Struts tags that work with EL:
http://struts.apache.org/1.x/struts-el/tagreference.html#struts-html-el.tld
Junilu - [
How to Ask Questions
] [
How to Answer Questions
] [
MiH
]
Mark Butcher
Ranch Hand
Joined: Jun 28, 2012
Posts: 41
posted
Jan 23, 2013 05:10:47
0
I would really appreciate an example.
Thanks.
Gopakumar Naryanan
Ranch Hand
Joined: Jan 15, 2011
Posts: 71
I like...
posted
Jan 24, 2013 11:43:02
0
<HTML:text property='name' value='${emp.name}></html:text> where property is your formbean property and value is what you were trying to put in bean:write tag emp is bean name and name is the property.
Thanks & Regards
Gopakumar
I agree. Here's the link:
http://aspose.com/file-tools
subject: bean:write inside html:text
Similar Threads
How to retrieve the data from the database and display it on a jsp using struts
format attribute in bean:write not working
how to get values from jsp to action class
How to display ArrayList in JSP
how to display arraylist within arraylist in jsp
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter