[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using JSTL tags to iterate in struts app

Posted on 2006-05-25
8
Medium Priority
?
605 Views
Last Modified: 2010-05-18
I am currently getting the following, "JspTranslate: Unable to load class null" when I try to build my struts application. Here is my jsp code



<c:set var="techologyInventory"      scope="request"      value="${requestScope.techologyInventory}"/>
 
<c:forEach items="${techologyInventory.techCategory}" var="category">  
      <table cellspacing="0" border="0" cellpadding="0">
            <tr>
            <td class = "<c:out value='category.type'/></td>
            <td class = "<c:out value='category.type'/>" width="250px;">
                                                  <c:out value=”${category.description}”</td>
            <td class = "<c:out value='category.type'/>">Current Inventory :
                                                   <c:out value=”${category.count}”</td>
            </tr>
      </table>

'technology inventory' is a request scoped object (of type TechnologyCollection which I called )that implements java.util.Collection which is set in the Action class of my Struts action...

                           TechnologyCollection tc = TechnologyCollectionDAO.retrieve();            
            request.setAttribute("techologyInventory", tc);

What am I doing wrong ?
0
Comment
Question by:OMyStuckAgin
  • 5
  • 2
8 Comments
 
LVL 1

Expert Comment

by:punithapr
ID: 16760728
Hi,

<c:set var="techologyInventory"     scope="request"     value="${requestScope.techologyInventory}"/>  
<c:forEach items="${techologyInventory.techCategory}" var="category">  
     <table cellspacing="0" border="0" cellpadding="0">
          <tr>
          <td class = "<c:out value='category.type'/></td>
          <td class = "<c:out value='category.type'/>" width="250px;">
                                                  <c:out value=”${category.description}”</td>
          <td class = "<c:out value='category.type'/>">Current Inventory :
                                                   <c:out value=”${category.count}”</td>
          </tr>
     </table>

What is items="${techologyInventory.techCategory}"  -> this should be techologyInventory
Try this .

Thanks
0
 

Author Comment

by:OMyStuckAgin
ID: 16760834
The reference 'techologyInventory.techCategory' refers to a contained object accessible from technologyInventory via an accessor method called 'getTechCategory'. The error that I getting 'JspTranslate: Unable to load class null' is pointing to the <c:set statement as being the culprit.
0
 

Author Comment

by:OMyStuckAgin
ID: 16762762
It almost seems to me that it is having trouble resolving the URI, which is odd because the jsp has
<%@ taglib uri="/WEB-INF/lib/c-rt.tld" prefix="c" %>      where the file c-rt.tld is where it is suppose to be.


Just for fun, I cut and pasted the following line from a Struts Textbook...

<c:set var="foo" value="The wisest fool"/> which  creates the string "The wisest fool" and assigns it to the newly created page-scoped variable foo.

Basic stuff you know....anyways, the page now gives me the same "JspTranslate: Unable to load class null" but now it points to this new line which is syntactically correct.


I am using WSAD 5.1 and Websphere 5.1. I am wondering if there may be some sort of access issue to the descriptor that is causing this error.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 14

Expert Comment

by:boonleng
ID: 16769340
Have you placed the jstl library in your project?
If not you need to download from http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
and place the 2 jar files (jstl.jar, standard.jar) on /WEB-INF/lib

You can use point taglib location to url
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
       
0
 

Author Comment

by:OMyStuckAgin
ID: 16770297
I do, but I will download the latest versions just in case...ps when I changed my entry

<%@ taglib uri="/WEB-INF/lib/c-rt.tld" prefix="c" %>
to
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
I got a error message stating:

JSPTranslate: Unable to open tag library http://java.sun.com/jsp/jstl/core : JSPG0127E : Could not locate TLD META-INF/taglib.tld
0
 

Author Comment

by:OMyStuckAgin
ID: 16770363
.ps to boonleng

downloaded new versions of jstl and standard jars....no change in result
0
 
LVL 14

Accepted Solution

by:
boonleng earned 1600 total points
ID: 16774070
I checked on the Websphere spec, seems that Websphere 5.1 still running on J2EE 1.3, Servlet 2.3 and JSP 1.2.
So you need to use the older version of JSTL which is 1.0.
In this case, you need a few more jar files to get in run, see http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/standard-1.0/GettingStarted.html
0
 

Author Comment

by:OMyStuckAgin
ID: 16786573
.ps thanks a lot boonleng.....this application is scheduled to be deployed using Websphere 6.0 in the fall, but this answer will keep me moving until then....thanks again
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month20 days, 3 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question