File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes jstl nested inside bean:write tag ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "jstl nested inside bean:write tag ?" Watch "jstl nested inside bean:write tag ?" New topic
Author

jstl nested inside bean:write tag ?

Ronan Dowd
Ranch Hand

Joined: Jan 21, 2006
Posts: 84
I want to render an input box "n" times (the value of n will be a request attribute). I tried using JSTL forEach as below:

<c:forEach var="count" begin="0" end="${request.numberOfTimes}">
<html:text property='<%= "fieldValue[" + count + "]"%>'/>
</c:forEach>

This doesnt seem to work. I know that i can get the value of the current count by doing <c ut value="${count}"> but I can't nest this JSTL fragment
inside my "<%= .... %>" tags! Essentially i want count to be printed for each iteration of the loop.
Can someone provide me with a code sample if poss of how to get around this? is there a way i can
- either nest my JSTL inside my "<%= .. %>"
- or using some other struts way, render my count value

Thanks. Ronan.


SCJP 1.4 | OCWCD JEE 5
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest using the EL version of the Struts tags. They allow you to embed EL expressions in your tags. Just make sure that the struts-el-1.3.x.jar is in your WEB-INF/lib directory and reference the URI http://struts.apache.org/tags-html-el in your taglib definition. Once you do this, you can do the following:


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jstl nested inside bean:write tag ?