Forums Register Login

using JSTL in struts framework

+Pie Number of slices to send: Send
Hi all,

m new to JSTL.
i have an action class which is setting one arraylist in request object, code goes like this
request.setAttribute("modelHelperResult",modelHelperResult);
modelHelperResult is an arrayList

now on jsp, i am retriving this arraylist to print its contents, it has all string objects in it.

now for the same purpose i want to use <c:forEach/>
being a new to the world of JSTL, whatever i could read regarding the tag, i coded like this:
<c:forEach var="modelHelperList" items="{modelHelperResult}">
${modelHelperList}
</c:forEach>


its not giving any result, instead its printing ${modelHelperList} as text.

plwase help me regarding the same....
+Pie Number of slices to send: Send
Make sure that your deployment descriptor is not using the Servlets 2.3 DTD. That will disable the EL.

See the JspFaq to make sure your web app is set up properly for the EL and JSTL.
+Pie Number of slices to send: Send
Also, it should be items="${modelHelperResult}">
+Pie Number of slices to send: Send
see,

when i do
<c:forEach var="modelHelperList" items="S{modelHelperResult}">
${modelHelperList}
</c:forEach>
(i.e. putting "$")
i get error as
attribute items does not accept any expressions

when i insert
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>;
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
in DD file
it fails in deployment.

can you please guide me all steps for using TLD???
+Pie Number of slices to send: Send
oops....i meant
<c:forEach var="modelHelperList" items="${modelHelperResult}">

(printing mistake for $ in previous post)
+Pie Number of slices to send: Send
It sounds as if your web app is badly misconfigured.

Check the JspFaq. Make sure that your web.xml is properly declared using servlets 2.4 or 2.5 and not 2.3. And make sure you are using the appropriate version of the JSTL for your container.

If you have a bad mix of versions, you will get these types of errors.
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1872 times.
Similar Threads
JSTL error
Reset the collection content in bean:define
c:forEach performance hit
A cleaner way to display LinkedHashMap/ArrayList
forEach in Java class
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:55:47.