Re: Strange JSTL1.0 problem

Rashmi Rubdi <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
Name the loop item different from the name of the ArrayList 

So instead of <c:forEach var="RecordList" items="${RecordList}"> , rewrite it something like this:

<c:forEach var="recordListItem" items="${RecordList}">

Then try:

<c:out value="${recordListItem.axField}" /> inside the c:forEach loop.

I hope everything else is configured correctly for JSTL1.0 -- for example
1) web.xml that conforms to Servlet 2.3  (has the DTD and everything 2.3)
2) Web Container that supports Servlet 2.3 and JSP 1.2 -- example Tomcat 4.1.34 -- http://tomcat.apache.org/whichversion.html 
3) JSTL 1.0 versions of jstl.jar and standard.jar 
4) May need to add TLDs explicitly to web.xml (Not required in JSTL 1.1.x ---- not sure if it is required in JSTL 1.0.x)
5) Correct versions of JSTL 1.0 taglib URIs in the JSP pages. 
6) Set isElIgnored="false" 

Also instead of <c:out value="${recordListItem.axField}" />  , you could also use the shorter syntax ${recordListItem.axField} (works in JSTL 1.1.x not sure if this short syntax works in JSTL 1.0.x)

-Rashmi

----- Original Message ----
From: neeraj bhusare <[email protected]>
To: [email protected]
Sent: Monday, March 26, 2007 12:11:28 PM
Subject: Strange JSTL1.0 problem


>Friends,

> I am experience a strange problem using *JSTL1.0.* Please find my
> problem description below.

> I have a ArrayList of objects (Java beans with some getter /setters), which
> are to be rendered in a JSP page. I tried using struts tag library by I
> didn't find it much helpful so I tried using JSTL tag library. My Code
> snippet is given below

> Here,RecordList – List containing the Java Beans with getter and setters for
> axField, displayLabel, search etc.




                  <tr>

                        <td><c:out value="${RecordList.axField}" />

      <bean:define id="Foo" value="${RecordList.axField}" /></td>

                        <td><c:out value="${RecordList.diaplayLabel}" /></td
>



                        <td><c:out value="${RecordList.search}" /></td>



                        <td><c:out value="${RecordList.result}" /></td>



                        <td><c:out value="${RecordList.view}" /></td>



                        <td></td>



                        <td><html:link action="/Edit" paramId="axField"
paramName="Foo" paramScope="page"> Edit</html:link></td>



                        <td><html:link action="/DeleteRecord" paramId=
"axField" paramName="Foo" paramScope="page">Delete</html:link></td>

                  </tr>

            </c:forEach>




The retrieved field values of  axField, displayLabel, search etc are
rendered comfortably on the JSP page in the <c:out />,  but when I try using
${} into the <bean:define value=${…}/> tag, the value associated with the
axField is not retrieved. Even if I try using ${} outside any of the struts
tags/JSTL tags, no value is rendered.

I guess there is some compatibility problem. I would like to know if I am
missing something or there exists some workaround for the same.




-- 
"Different isn't always better,but better is always different."


 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.