Search Results

Search found 148 results on 6 pages for 'jstl'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Assigning outcome of another JSTL tag as value of one JSTL tag

    - by NoozNooz42
    I've got this, which is working: <c:choose> <c:when test="${sometest}"> Hello, world! </c:when> <c:otherwise> <fmt:message key="${page.title}" /> </c:otherwise> </c:choose> And I want to change it to this: <c:choose> <c:when test="${sometest}"> <c:set var="somevar" scope="page" value="Hello, world!"/> </c:when> <c:otherwise> <c:set var="somevar" scope="page" value="<fmt:message key="${page.title}">" </c:otherwise> </c:choose But of course the following line ain't correct: <c:set var="somevar" scope="page" value="<fmt:message key="${page.title}">" How can I assign to the somevar variable the string resulting from a call to fmt:message?

    Read the article

  • cannot load JSTL taglib within embedded Jetty server

    - by fthompson
    I am writing a web application that runs within an embedded Jetty instance. When I attempt to execute a JSTL statement, I receive the following exception: org.apache.jasper.JasperException: /index.jsp(1,63) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application I have the following jars on the classpath ant-1.6.5.jar ant-1.7.1.jar ant-launcher-1.7.1.jar core-3.1.1.jar jetty-6.1.22.jar jetty-util-6.1.22.jar jsp-2.1-6.1.14.jar jsp-api-2.1.jar jstl-1.2.jar servlet-api-2.5-20081211.jar servlet-api-2.5-6.1.14.jar standard-1.1.2.jar My web.xml looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee h77p://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>test</display-name> </web-app> My code looks like this: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <body> <h2>Hello World!</h2> <%= new java.util.Date() %><br/> ${1+2}<br/> <c:out var="${5+9}"/><br/> </body> </html> I started my embedded Jetty server like this: Server server = new Server(80); WebAppContext context = new WebAppContext("pig-1.0-SNAPSHOT.war","/"); server.addHandler(context); server.start(); I spent the past two days experimenting with various combinations of jar files, web.xml configurations, and tag library declarations, but to no avail. How can I get an embedded Jetty server up and running with full JSTL support?

    Read the article

  • When I mix JSTL 1.0 and JSTL 1.1 taglib declarations, it causes a ParseException on some of my serve

    - by sangfroid
    Hello all, When I mix JSTL 1.0 and JSTL 1.1 taglib declarations, it causes a ParseException on some of my servers, but not all of them. Here is the block of code that's giving me trouble : <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <c:set var="TEXTVARIABLE">|STRINGOFTEXT|</c:set> <c:set var="OTHERTEXTVARIABLE">${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}</c:set> And here is the exception : javax.servlet.jsp.JspException: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}": org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported. However, everything works fine if I change the URI for the core declaration to http://java.sun.com/jsp/jstl/core So here's the really weird part : for some reason, mixing 1.0 and 1.1 taglib declarations only causes an exception on two of my servers -- my staging server and my production server. It causes no problems at all on my local machine or my development server. Why is this? What could possibly be causing this difference in behavior? The three servers are extremely similar in setup and configuration. The JSP page is being served up by OpenCMS, and I'm using the Caucho's Resin webserver. I understand that you don't know how my servers or CMS are set up, but really, what I'm looking for is ideas. Any ideas at all would help -- this problem has been driving me absolutely batty. Even if you don't know what could be causing the problem, if you have any suggestions at all for how I could approach the problem, that would be extremely helpful. I just don't understand what could cause this difference in behavior between my servers. For reference, here's the full stack trace : javax.servlet.jsp.JspException: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}": org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported. at org.opencms.jsp.CmsJspTagInclude.includeActionWithCache(CmsJspTagInclude.java:369) at org.opencms.jsp.CmsJspTagInclude.includeTagAction(CmsJspTagInclude.java:241) at org.opencms.jsp.CmsJspTagInclude.doEndTag(CmsJspTagInclude.java:472) at _jsp._WEB_22dINF._jsp._online._system._modules.com_MYCOMPANY__marketing._templates._MAIN_0PAGE__jsp._jspService(_MAIN_0PAGE__jsp.java:153) at com.caucho.jsp.JavaPage.service(JavaPage.java:60) at com.caucho.jsp.Page.pageservice(Page.java:579) at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:179) at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:175) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:485) at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:350) at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194) at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:169) at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:1193) at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423) at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:173) at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:1227) at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:1171) at org.opencms.loader.A_CmsXmlDocumentLoader.load(A_CmsXmlDocumentLoader.java:232) at org.opencms.loader.CmsXmlContentLoader.load(CmsXmlContentLoader.java:52) at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:964) at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1498) at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:92) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106) at com.caucho.filters.CmsGzipFilter.doFilter(CmsGzipFilter.java:177) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:277) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106) at com.caucho.server.dispatch.ForwardFilterChain.doFilter(ForwardFilterChain.java:80) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:207) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520) at com.caucho.util.ThreadPool.run(ThreadPool.java:442) at java.lang.Thread.run(Thread.java:595) Caused by: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}": org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported. at com.caucho.jsp.java.JspNode.error(JspNode.java:1489) at com.caucho.jsp.java.JspNode.error(JspNode.java:1480) at com.caucho.jsp.java.JavaJspGenerator.validate(JavaJspGenerator.java:466) at com.caucho.jsp.JspCompilerInstance.generate(JspCompilerInstance.java:475) at com.caucho.jsp.JspCompilerInstance.compile(JspCompilerInstance.java:373) at com.caucho.jsp.JspManager.compile(JspManager.java:233) at com.caucho.jsp.JspManager.createPage(JspManager.java:177) at com.caucho.jsp.JspManager.createPage(JspManager.java:157) at com.caucho.jsp.PageManager.getPage(PageManager.java:248) at com.caucho.jsp.PageManager.getPage(PageManager.java:166) at com.caucho.jsp.QServlet.getSubPage(QServlet.java:292) at com.caucho.jsp.QServlet.getPage(QServlet.java:210) at com.caucho.server.dispatch.PageFilterChain.compilePage(PageFilterChain.java:206) at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:133) at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:175) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:485) at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:350) at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194) at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:169) at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:1193) at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423) at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:173) at org.opencms.jsp.CmsJspTagInclude.includeActionWithCache(CmsJspTagInclude.java:364) ... 45 more Thanks for the help!

    Read the article

  • How to display formated Calendar type in JSTL?

    - by maectpo
    Hi, I am using Calendar type in Java and I would like to display formated date in jstl. I was trying: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <fmt:parseDate var="date" type="date" dateStyle="short" value="${photo.dateCreated}" /> <c:out value="${data}" /> But it doesn't work: java.text.ParseException: Unparseable date Can JSP format "Calendar" type?

    Read the article

  • XSLT, JSTL e JSF

    - by Paulo S.
    I have a xml file which I want to transform in a jsf code page. To do that I've created a xsl file. xml: <?xml version='1.0' encoding='ISO-8859-1'?> <questionario xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='Schema2.xsd'> <componente nome='input'> <id>input1</id> </componente> <componente nome='input'> <id>input2</id> </componente> </questionario> code: <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> <c:set var="xml" value="${questionarioXSLBean.xml}"/> <c:set var="xsl"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" exclude-result-prefixes="f h"> <xsl:template match="/"> <xsl:for-each select="questionario/componente"> <xsl:if test="attribute::nome = 'input'"> <xsl:variable name="id"> <xsl:value-of select="id" /> </xsl:variable> <h:inputText id="{$id}"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> </c:set> <x:transform xml="${xml}" xslt="${xsl}" /> The problem is that nothing is shown in my screen because the generated code for <h:inputText id="input1"/> is <h:inputText id="input_1" xmlns:h="http://java.sun.com/jsf/html"/> how can I replace the xmlns:h="http://java.sun.com/jsf/html" or suppress it. Thanks! Update: Let me clarify what I want to do. I want to generate a jsf page dynamically depending on the attributes of a xml file, for instance, 2 input texts, 3 check boxes, etc. To make the transformation to jsf I thought in two approaches, one using jstl and another using xslt. The problem with the former is that I couldn't integrate jstl with jsf code (to set jsf components attributes using jstl variables) and with the last approach, I'm facing the problem described above.I wouldn't like to create components in java (UIComponents). Any suggestions?

    Read the article

  • How to create templates in JSTL JSP

    - by desau
    Say I have a JSP page with JSTL. I'm using c:forEach and looping over 5 different sets of objects, each very similar. Each loop is nearly identical.. lots of duplicated code. I'd like to make that loop a template -- such as a JSP template, but I want to pass the JSTL object(s) in the parameters. How can I do this? Or a more general question -- how can I create reusable HTML templates in JSP/JSTL?

    Read the article

  • How to add JSTL to Maven?

    - by La Chamelle
    I'm working on a JSF 2.0 project using Mojarra, PrimeFaces and Tomcat 6.x. I need to use c:forEach for some primefaces component like dynamic number of p:tab but i have problem with the c:forEach. All the other tag of JSTL work nice. I have the following error : java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTagStatus I use the following xmlns:c="http://java.sun.com/jsp/jstl/core", i tried to replace with xmlns:c="http://java.sun.com/jstl/core" but nothing display with the second. This is the exact version of lib: <dependency> <groupId>javax.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.0.2-FCS</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.0.4-b03</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> <version>2.2</version> </dependency> How i can fix it ? I can give more specific information if needed.

    Read the article

  • Loop through a Map with JSTL

    - by Dean
    I'm looking to have JSTL loop through a Map and output the value of the key and it's value. For example I have a Map which can have any number of entries, i'd like to loop through this map using JSTL and output both the key and it's value. I know how to access the value using the key, ${myMap['keystring']}, but how do I access the key?

    Read the article

  • Custom JSTL tags with body

    - by Mickel
    Hi, We are going to use JSTL and custom JSTL-tags for some sort of template-engine in our JSP/spring-project. Is there a way to create a tag that looks similar like this: <div id="site"> <div id="header">Some title</div> <div id="navigation"> SOME DYNAMIC CONTENT HERE </div> <div id="content"> ${content} </div> <div id="footer"></div> </div> and use it like this: <mytags:template> <h1>Title</h1> <p>My content!</p> </mytags:template> i.e. use body-content inside a custom JSTL-tag... This works: <mytags:template content="some content... not HTML" /> but is not very useful in our case.

    Read the article

  • Java List use through use of JSTL <c:forEach>

    - by Mark Lewis
    Hello If I have a JSF backing bean return an object of type ArrayList, I should be able to use to iterate over the elements in the list. Each element contains a map and although the question of how to access the map content through JSTL has been answered here, if I pass an array of such maps, I can't find how to iterate over them and still access the map content using JSTL. There's documentation which refers to simple iterators but not to those whose items are themselves maps. BalusC, I'm not trying to force the issue, just that I've been looking at this all day, and still cannot seem to be able to output the contents of my data structure through jsp (only on the console). This as a separate question still has merit. If anyone can give me a simple example of how a java List is iterated over in JSP I'd be massively appreciative. Mark

    Read the article

  • JSTL Session Lookup - Key Has Periods

    - by John W.
    Hello All, I am working with some legacy code, and at some point there is a key in the session that is something like session.setAttribute("com.org.something.Object",someObject); Now trying to access this in a jsp using jstl is a bit difficult becuase if I tried it like I normally would I would do: ${sessionScope.com.org.something.Object.someFieldGetter} As most of us can imagine it will fail because there is no com object in session scope. I also tried ${sessionScope.'com.org.something.Object'.someFieldGetter} And a parsing error was thrown. Does anyone know how to resolve this so that I can correctly get the object similar to session.getAttribute("com.org.something.Object") but through jstl? thank you.

    Read the article

  • Jetty 7 hightide distribution, JSP and JSTL support

    - by Lior Cohen
    Hello guys. I've been struggling with Jetty 7 and its support for JSP and JSTL. My JSP file: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <head> <title>blah</title> </head> <body> <table id="data"> <tr class="columns"> <td>Hour</td> <c:forEach var="campaign" items="${campaigns}"> <td>${campaign}</td> </c:forEach> </tr> <c:forEach var="hour" items="${results}"> <tr> <td class="hour">${hour.key}</td> <c:forEach var="campaign" items="${campaigns}"> <td>${hour[campaign]}</td> </c:forEach> </tr> </c:forEach> </table> </body> </html> The JSP portions above work as expected. JSTL, however, does not. The campaigns and results variables are request attributes set by a servlet. I get the following errors: WARN: ... compiler.TagLibraryInfoImpl: Unknown element (deferred-value) in attribute WARN: ... compiler.TagLibraryInfoImpl: Unknown element (deferred-value) in attribute WARN: ... compiler.TagLibraryInfoImpl: Unknown element (deferred-value) in attribute ERROR: ... javax.servlet.ServletException: java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext; I am not bundling any jar files into my .war file deployed to jetty. The version of jetty I'm using is: jetty-hightide-7.0.1.v20091125 The classpath: /usr/local/jetty/lib/jetty-xml-7.0.1.v20091125.jar:/usr/local/jetty/lib/servlet-api-2.5.jar:/usr/local/jetty/lib/jetty-http-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-continuation-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-server-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-security-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-servlet-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-webapp-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-deploy-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-servlets-7.0.1.v20091125.jar:/usr/local/jetty/lib/jsp/ant-1.6.5.jar:/usr/local/jetty/lib/jsp/core-3.1.1.jar:/usr/local/jetty/lib/jsp/jetty-jsp-2.1-7.0.1.v20091125.jar:/usr/local/jetty/lib/jsp/jsp-2.1-glassfish-9.1.1.B60.25.p2.jar:/usr/local/jetty/lib/jsp/jsp-api-2.1-glassfish-9.1.1.B60.25.p2.jar:/usr/local/jetty/resources:/usr/local/jetty/lib/jetty-util-7.0.1.v20091125.jar:/usr/local/jetty/lib/jetty-io-7.0.1.v20091125.jar Any help would be greatly appreciated. Thanks in advance, Lior.

    Read the article

  • Using jstl tags in a dynamically created div

    - by George
    I want to be able to show some data based on criteria the user enters in a text field. I can easily take this data, process the form post, and show the data on another page. However, I want to be able to do it all on the same page - they click the button, and a new div shows up with the information. This doesn't seem too complicated, but I want to use jstl tags to format the data like: <c:forEach items="${model.data}" var="d"> <tr> <td><fmt:formatDate type="date" dateStyle="short" timeStyle="default" value="${d.reportDate}" /></td> <td><c:out value="${d.cardType}"/></td> </tr> </c:forEach> If jstl tags are processed when the page loads, can I use that in this new div? Can I update it via a javascript (using prototype) function to display the proper data? Will I be able to do the same thing if they change the criteria and click the submit button again?

    Read the article

  • Java: how to debug an invalid JSTL declaration?

    - by Webinator
    I've seen this kind of issue on SO (and on the Net overall) quite a few times. For example here: http://stackoverflow.com/questions/1884529 Earlier today I was trying on a JSP (regular .jsp, not .jspx) to do this, because I stupidly cut/pasted some example found on the net: <%@ taglib prefix = "c" uri = "http://java.sun.com/jstl/core"%> Then my .jsp was giving a blank page. No error message in the Tomcat log. No nothing. Just a blank page. While, of course (I'm being sarcastic here), the correct line was this: <%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%> There was a "jsp/" missing (which I found a hint to in yet another SO question). So obviously such issues are common. I can't believe you have to wait for things "not to work" to know you've there's an error and I'm honestly a bit confuzzabled by the number of questions found on the net (and here on SO) where the answer is basically "fix your declaration". My question here is simple: how do you know that it's a declaration issue? What thought process is required here to diagnose and troubleshoot such issues? Are there tools that can help here? (I don't know, like, say, IntelliJ IDEA or Eclipse or Emacs in nxml-mode warning you in real time that the declared URI is invalid?)

    Read the article

  • JSTL c:forEach causes @ViewScoped bean to invoke @PostConstruct on every request

    - by Nitesh Panchal
    Hello, Again i see that the @PostConstruct is firing every time even though no binding attribute is used. See this code :- <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:head> <title>Facelet Title</title> </h:head> <h:body> <h:form> <c:forEach var="item" items="#{TestBean.listItems}"> <h:outputText value="#{item}"/> </c:forEach> <h:commandButton value="Click" actionListener="#{TestBean.actionListener}"/> </h:form> </h:body> </html> And this is the simplest possible bean in JSF :- package managedBeans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean(name="TestBean") @ViewScoped public class TestBean implements Serializable { private List<String> listItems; public List<String> getListItems() { return listItems; } public void setListItems(List<String> listItems) { this.listItems = listItems; } public TestBean() { } @PostConstruct public void init(){ System.out.println("Post Construct fired!"); listItems = new ArrayList<String>(); listItems.add("Mango"); listItems.add("Apple"); listItems.add("Banana"); } public void actionListener(){ System.out.println("Action Listener fired!"); } } Do you see any behaviour that should cause postconstruct callback to fire each time? I think JSF 2.0 is highly unstable. If it has to fire PostConstruct each and every time what purpose does @ViewScoped serve. Why not to use @RequestScoped only? I thought i have made some mistake in my application. But when i created this simplest possible in JSF, i still get this error. Am i not understanding the scopes of JSF? or are they not testing it properly? Further, if you remove c:forEach and replace it with ui:repeat, then it works fine. Waiting for replies to confirm whether it is bug or it is intentional to stop the programmers from using jstl?

    Read the article

  • Code assist in (jsp /jstl) view for Spring MVC model objects in Eclipse

    - by Bjorn Thor Jonsson
    In Spring MVC when placing an object in the view model like so: public String getUser( Model model ) { //...fetch user... model.addAttribute( "user", user ); return "viewName"; } and accessing it's values in the JSP / JSTL view like this: ... <p> ${user.name} </p> ... I'm wondering if it is possible to have code assist for the user object in the view? The IDE I'm using is MyEclipse but it would be interesting to know if this is possible in other editors as well. Thanks.

    Read the article

  • Iterating over a HashMap with JSTL, always getting last Object

    - by hkansal
    Hello, I have a Map, which I tried to iterate over with JSTL. Somehow I could not accomplish even this basic task. I also referred the questions here and here, but that is what I am already doing, still no success. What I tried to do was: <c:forEach items="${myMap}" var="myEntry"> ${myEntry.key} + ${myEntry.value} </c:forEach> But I always get the last object. Maybe I am missing something trivial, please advise. Thank You

    Read the article

  • JSTL - Format date

    - by John Manak
    Hi! I have a loop that goes through all the news items we have on our site. One of the fields is date ${newsitem.value['Date']}, given in millliseconds. I'd like to display this date in month/day/year format on the webpage. I thought JSTL format tag, <fmt:formatDate>, would help, but I haven't succeeded. Do you know how to do it? <cms:contentaccess var="newsitem" /> <h2><c:out value="${newsitem.value['Title']}" /></h2> // display date here <c:out value="${newsitem.value['Text']}" escapeXml="false" />

    Read the article

  • JSTL param implicit object

    - by srinannapa
    Hi , i'm using struts 2 and jstl. facing problem with param implicit object. Here is the test code : <% request.setAttribute ("error", "Failed"); %> <%= request.getAttribute("error") %> ----------> Prints "Failed" <c:out value="${param.error}"></c:out> ---------> Prints nothing?? Why param.error is not producing the result.

    Read the article

  • JSTL XML Transforms not working with nested XSL includes

    - by timxyz
    I have a bit of JSP that does this: <c:import url="/xsl/Transformer.xsl" var="xslt" /> <x:transform doc="${actionBean.dom}" xslt="${xslt}" xsltSystemId="/xsl/"> This transforms the XML exactly as expected so long as Transformer.xsl contains no <xsl:include> tags or so long as any documents it does include do not include anything. However, if I use an XSL which includes a document which in turn includes another document, I get the following error: ERROR: 'Invalid URI 'NestedInclude.xsl Could not resolve entity reference: "NestedInclude.xsl"'.' Note that the JSP is contained in the directory below the xsl documents. If all my XSLs and JSPs are in the same directory (and I remove the xsltSystemId attribute) then everything would work fine, but I don't really want to do this. Can anyone see anything I'm doing wrong, as it's a bit of a killer at the moment and the JSTL documentation is next to useless.

    Read the article

1 2 3 4 5 6  | Next Page >