tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikola Milutinovic <alok...@yahoo.com>
Subject Re: Iterations in JSF using JSTL via forEach
Date Sun, 02 Nov 2008 22:12:55 GMT
JSTL is not a part of TC. Use Maven2 to assemble your application so it includes the desired
version of JSTL. Or Ant.

Nix.




________________________________
From: Alexander Hartner <alex@j2anywhere.com>
To: users@tomcat.apache.org
Sent: Friday, October 17, 2008 3:14:45 PM
Subject: Re: Iterations in JSF using JSTL via forEach

I figured out what the problem was. I was using JSTL 1.1 rather then 1.2.
I found a version of this here :
https://maven-repository.dev.java.net/repository/jstl/jars/

I am wondering if there are any plans to include this release with Tomcat
6, or make it easier accessible.

May this is already being done, just haven't found it.

Thanks
Alex

> I am sure this is a very silly problem, however I have been struggling
> with this for a while now. I am trying to iterate over a collection using
> JSF and JSTL's forEach which is apparently supported in JSP2.1 (2.0) and
> Tomcat 6.
>
> I have the version number in web.xml set to 2.5 and the faces-config.xml
> file set to 1.2 (see below).
>
> I checked the version of JARS included in the WAR file and they are :
>
> standard.jar : Implementation-Version: 1.1.2
> jstl.jar : Implementation-Version: 1.1.2
> jsf-impl.jar : Implementation-Version: 1.2_04-b20-p03
> jsf-api.jar : Implementation-Version: 1.2_04-b20-p03
>
> Below are the configuration files included with my WAR. I am using Tomcat
> apache-tomcat-6.0.16. I have found some older examples where I got this
> working, however I can't see why it doesn't work for me anymore.
>
> Any suggestions on this would really help me out a lot.
>
> Thanks in advance.
> Alex
>
> web.xml
> =======
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> ...
>
>
> faces-config.xml
> ================
> <?xml version='1.0' encoding='UTF-8'?>
> <faces-config version="1.2"
>     xmlns="http://java.sun.com/xml/ns/javaee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
>     <managed-bean>
>         <managed-bean-name>Controller</managed-bean-name>
>         <managed-bean-class>com.simple.Controller</managed-bean-class>
>         <managed-bean-scope>request</managed-bean-scope>
>     </managed-bean>
> </faces-config>
>
> jsp file
> ========
> <%@page contentType="text/html"%>
> <%@page pageEncoding="UTF-8"%>
> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
>   <head>
>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>     <title>JSP Page</title>
>   </head>
>   <body>
>     <f:view>
>       <h1>Hallo : <h:outputText value="#{Controller.message}"/></h1>
>       <h1><h:outputText value="JavaServer Faces" /></h1>
>       <c:forEach var="item" items="#{Controller.messages}">
>         <h1>Hallo</h1>
>         <h:outputText id="value" value="#{item}"/>
>       </c:forEach>
>     </f:view>
>   </body>
> </html>
>
>
> jspx file
> =========
> <?xml version="1.0" encoding="UTF-8"?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
>           xmlns:h="http://java.sun.com/jsf/html"
>           xmlns:f="http://java.sun.com/jsf/core"
>           xmlns:c="http://java.sun.com/jsp/jstl/core"
>           xmlns="http://www.w3.org/1999/xhtml"
>           version="2.1">
>   <jsp:directive.page contentType="text/html"/>
>   <jsp:output doctype-root-element="html"
>               doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
>               doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
>
>     <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>
>
>     <!-- any content can be specified here, e.g.: -->
>     <jsp:element name="text">
>         <jsp:attribute name="lang">EN</jsp:attribute>
>         <jsp:body>Hello World!</jsp:body>
>     </jsp:element>
>   <f:view>
>     <h1>Hallo 2 : <h:outputText value="#{Controller.message}"/></h1>
>     <h1><h:outputText value="JavaServer Faces" /></h1>
>     <c:forEach var="item" items="#{Controller.messages}">
>       <h1>Hallo</h1>
>       <h:outputText id="value" value="#{item}"/>
>     </c:forEach>
>   </f:view>
> </jsp:root>
>
>
> Controller.java
> ===============
> package com.simple;
> import java.util.ArrayList;
> import java.util.List;
> public class Controller
> {
>   private ArrayList<String> stuff = new ArrayList<String>();
>   public Controller()
>   {
>     System.out.println("Creating Controller");
>     stuff.add("A1");
>     stuff.add("A2");
>     stuff.add("A3");
>     stuff.add("A4");
>     stuff.add("A5");
>   }
>   public String getMessage()
>   {
>     return "This is a message";
>   }
>   public ArrayList<String> getMessages()
>   {
>     System.out.println("Getting Stuff");
>     return stuff;
>   }
>   public void setMessage(ArrayList<String> stuff)
>   {
>     System.out.println("Setting Stuff");
>     this.stuff = stuff;
>   }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message