facebook

JSTL attributes, no rt expressions in JSPs [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #220640 Reply

    dsarris
    Member

    – System Setup ——————————-
    Operating System and version: Fedora Core 3
    Eclipse version: 3.0.1
    Fresh Eclipse install (y/n): y
    MyEclipse version: 3.8.2 GA
    Eclipse JDK version: 1.4.2
    Application Server JDK version: 1.4.2
    Appication Server: JBoss 4.0

    – Message Body ——————————-
    Hello,

    I have the same problem as the one described in the

    https://www.genuitec.com/forums/topic/jstl-attributes-not-accepting-expressions-in-jsps-3-8ga/&start=0&postdays=0&postorder=asc&highlight=according+tld+attribute+directive+tag+file+attribute+items+accept+expressions

    How can I override this problem?

    Thank you,
    Dimitris

    #220648 Reply

    Riyad Kalla
    Member

    Dimitris,
    1) What does your web.xml file look like?
    2) What do your <taglib> directives look like?

    #220661 Reply

    dsarris
    Member

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <servlet>
          <servlet-name>MyActionServlet</servlet-name>
          <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
          <init-param>
             <param-name>config</param-name>
             <param-value>/WEB-INF/struts-config.xml</param-value>
          </init-param>
          <init-param>
             <param-name>debug</param-name>
             <param-value>3</param-value>
          </init-param>
          <init-param>
             <param-name>detail</param-name>
             <param-value>3</param-value>
          </init-param>
          <load-on-startup>0</load-on-startup>
       </servlet>
       <servlet-mapping>
          <servlet-name>MyActionServlet</servlet-name>
          <url-pattern>*.do</url-pattern>
       </servlet-mapping>
       <welcome-file-list>
           <welcome-file>/main.jsp</welcome-file>
       </welcome-file-list>
    </web-app>

    JSP directives

    <%@ page language="java"%>
    
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html:html locale="true">
      <head>
        <html:base />
        
        <title>displayCountries.jsp</title>
        
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">    
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
      </head>
      
      <body>
          <html:errors/>
          <table border="1" width="100%">
            <tr>
              <th>
              CountryId
              </th>
              <th>
              CountryName
              </th>
            </tr>
            <c:forEach var="Country" items="${countryList.countries}">
              <tr>
                <td>
                  <c:out value="${Country.countryid}"/>
                </td>
                <td>
                  <c:out value="${Country.countryname}"/> 
                </td>
              </tr>
            </c:forEach>
          </table>
      </body>
    </html:html>
    #220664 Reply

    Riyad Kalla
    Member

    Dimitris,
    Thanks for the snippet. You can either change your taglib to use the rt version of the C tag library:

    
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
    

    Or you can upgrade to the JSTL 1.1 libs and change the taglib URI to this:

    
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
    #220699 Reply

    dsarris
    Member

    Thanks,

    I have modified the libs and the directives and all worked fine, except for the validation in the MyEclipse (it considers the JSTL 1.1 tld files invalid).

    Dimitris 😀

    #220707 Reply

    Riyad Kalla
    Member

    except for the validation in the MyEclipse (it considers the JSTL 1.1 tld files invalid).

    What error are you seeing? Were you sure to Add the JSTL Libs for 1.1 before you made this change? I didn’t see any warnings/errors when I did the sample above and use JSTL 1.1 in 2 projects I’m working on in parallel right now…

    #230728 Reply

    abrhaao
    Member

    How can I get the source code of the jstl/core_rt ??

    #230733 Reply

    Riyad Kalla
    Member

    IIRC getting the source code of the JSTL libs is a real nightmare because they are generated at compile time (no joke). If you do download the source from Sun you’ll notice that there is only source for a few libs, but a ton (or all) of them is missing, then you read on and find out that it is actually an Ant script that generates them at build time (right before compile). Very strange, but I guess the code is so cookie cutter that they were able to abstract it all out into these generated classes.

    I was never able to build it and get it connected correctly, so I just gave up. I believe the same goes for the JSF taglibs from the Sun RI and MyFaces as well… (unless I am mixing the two up).

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: JSTL attributes, no rt expressions in JSPs [Closed]

You must be logged in to post in the forum log in