Jstl - fmt Tag problem

hi..
I am facing problem in jstl. I have written a jsp file which is using jstl, <fmt> tag when I execute this file its gives me an error
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /dt.jsp(6,8) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
     org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
     org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
     org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
     org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
     org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
     org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
     org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
     org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
     org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.
Apache Tomcat/5.5.12
  my jsp file is give blow
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<html>
<body>
<h1>Formatting with the default locale</h1>
<jsp:useBean id="now" class="java.util.Date" />
Date: <fmt:formatDate value="${now}" pattern="yyyy-MM-dd HH:mm"/>
Number: <fmt:formatNumber value="${now.time}" />
</body>
</html>
I am using apache-tomcat-5.5.12 & java 1.5 on win XP
please help me out.....
thanks

Hi
Try using "sv_SE" locale.

Similar Messages

  • Jstl fmt:formatDate problem

    Hi everyone,
    I have been spending a lot of time on this "simple" issue and i hope someone is able to help. All i want to do is simple format a date and display it correctly.
    This is jsp page:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <html>
    <body>
         <jsp:useBean id="now" class="java.util.Date" />
         <fmt:formatDate pattern="yyyy-MM-dd" value="${now}" />
    </body>
    </html>This is the error i get when running this in the newest tomcat:
    org.apache.jasper.JasperException: Unable to convert string "${now}" to class "java.util.Date" for attribute "value": Property Editor not registered with the PropertyEditorManager
         org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:887)
         org.apache.jsp.index_jsp._jspx_meth_fmt_005fformatDate_005f0(index_jsp.java:135)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)I lib folder (version 1.1.2):
    - jstl.jar
    - standard.jar
    In WEB-INF/tld folder:
    - fmt.tld
    - c.tld
    Web.xml looks like this:
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd" >
    <web-app>
       <taglib>
        <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
      </taglib>
    </web-app>I really hope someone is able to help - let me know if you need more information!
    Thanks!
    /Kasper

    OK.
    1) Declare web.xml as Servlet 2.5. Tomcat supports it. Servlet 2.3 is legacy. Replace your DOCTYPE thing by:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID"
        version="2.5">
        <!-- Configuration here. -->
    </web-app>2) Remove all loose JSTL tld files from your classpath. Those are already included in the JSTL JAR file.
    3) Remove the TLD declarations from your web.xml. Those are already declared in the JSTL JAR's web.xml.
    4) I recommend to remove the JSTL and Standard JAR's and use JSTL 1.2 instead: [jstl-1.2.jar|https://maven-repository.dev.java.net/repository/jstl/jars/]. Just place it in the classpath (YourWebApp/WEB-INF/lib or Tomcat/lib) and declare the @taglib in your JSP to use it. Nothing more, nothing less. Do not extract the JAR and duplicate the stuff everywhere.

  • Problem: Localisation with JSTL FMT and Struts

    Hello!
    I am working on my first project with JSP / Servlets including JSTL and Struts Tag Libraries.(plus tiles from JSTL)
    I am trying to use localised messages, to deploy a webshop in multiplle languages.
    I allready managed to accomplish that the messages are read out of a file ApplicationResources.en.properties and another one ApplicationResources.de.properties which will be chosen by the preferences of the browser (JSTL FMT:message tag).
    The strange this is, this only works the first time the servlets are compiled. After I opened the servlet once in my browser, I am allways seeing the message in that language that was used first, even if I set the the locale trough a link in the URL. I am using this code:
    http://localhost:8080/Inkrement18/buchladenseite.jsp?lang=en
    <c:if test='${param.lang == "de"}'>
    DE <fmt:setLocale value="de" scope="session" />
    <fmt:setBundle basename="ApplicationResources" scope="session" />
    </c:if>
    <c:if test='${param.lang == "en"}'>
    EN <fmt:setLocale value="en" scope="session" />
    <fmt:setBundle basename="ApplicationResources" scope="session" />
    </c:if>It seems to me, the servlet is compiled once, and afterwards the locale does not get checked anymore. Is that possible?
    When I delete the compiled servlets from the work directory by hand, my link to change the locale manually works once, till I delete the servlets again (the session does not get killed by deleting the servlets!)
    My webserver is Jakarta Tomcat 5.5.9 and IDE Is eclipse.
    I am not sure if it matters here, but the main page consists of 4 parts like banner, menu, main-page, footer which gets assembled trough "tiles".
    Most submenues like shopping basket / catalogue are action servlets, realised with struts, calling another .jsp page by forward.
    Any ideas are really apreciated - I have no idea where to look for the error!
    If you need any more input from my side, please let me know!
    Best regards
    Jan

    Hey Experts!
    Nobofy has a clue on this? I have really no clue where to start to look for the problem...
    Cheers...Jan

  • JSTL fmt:param tag question

    <%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
    <fmt:message key="result_display">
         <fmt:param value="${resultBean.sourceNumber}"/>
         <fmt:param value="${resultBean.resultValue}"/>
    </fmt:message>
    As far as I can tell, the "value" attribute of the <fmt:param> tag is capable of taking an EL. And yet, the code above does not compile. I get the error message "According to TLD or attribute directive in tag file, attribute value does not accept any expressions". If I use the <fmt_rt:param> tag, everything works fine. Am I reading the spec wrong?

    You're not reading the spec wrong, but I think you are using the wrong version of JSTL. Are you using Tomcat 5? (Or another JSP2.0 container?)
    If so, you should be using JSTL1.1
    It has a uri of "http://java.sun.com/jsp/jstl/fmt"
    Note the extra /jsp in there.
    Tomcat 5 treats ${  } as runtime expressions. To a JSP2.0 container, they ARE runtime expressions. Thus in JSTL 1.1, the fmt:param tag does accept runtime expressions.
    In JSTL1.0 because the ${  } expressions WEREN'T understood by the container, they made the tags so as not to accept runtime expressions, and called their custom evaluator.
    You are using the 1.0 uri, which specifies that it doesn't accept runtime expressions. It is complaining that ${ } is a runtime expression - so you must be using a JSP2.0 container.
    In short: You probably have a JSP2.0 container, and should be using JSTL1.1 uri: <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    Cheers,
    evnafets

  • JSTL fmt:setBundle and JSF

    I am converting the code and JSP pages I had from jsf ea4 to jsf rel 1
    My bundle is Labels.properties (.properties file)
    Now, my JSTL fmt:setBundle is not recognized . My jsp code is:
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <%@ taglib prefix="s" uri="http://jakarta.apache.org/struts/tags-faces"%>
    <fmt:setBundle basename="Labels" scope="session" var="labelsBundle"/>
    <f:view>
    <s:html locale="true">
         <head>
         <title><fmt:message bundle="${labelsBundle}" key="form.heading.login"/></title>
         <s:base/>
         <link href="style/wless.css" rel="stylesheet" type="text/css">
         </head>
         <body>
    <!-- Log in -->
         <stf:form action="/listProjectTasks.do" method="post" focus="loginID" >
    <h:output_text value="#{labelsBundle.label.login.loginID}" />
    I get the following exception:
    There has been an unspecified exception (javax.servlet.jsp.JspException: Illegal Model Reference in this context for expression 'labelsBundle.label.login.loginID'.)!
    This used to work in ea4 when I had the key/bundle attributes.
    How can I access my properties file at sessionScope using the #{} notation or else?
    Thanks,
    Gisella

    Thanks for the response.
    Now it works but I ran into a different problem.
    In my .properties file I have escape characters like  
    and now with this JSF release 1, they show literally as, for example:
    Login ID:&nbsp
    So looking at the HTML generated:
    <td class="textLabel">Login ID: </td>
    instead of what it used to be
    <td class="textLabel">Login ID: </td>
    Also if I have the simple:
    <h:output_text value=" " />
    the text rendered is
    instead of a non-breaking space.
    Is there a way to represent these characters?
    Other related question:
    looking at the specs for f:loadBundle, it says that the resource bundle is loaded into a Map in the request
    scope. I find this annoying, that all the time, for each request, this bundle data will be loaded into
    a Map in the request scope. These are values needed at the session scope.
    Is there a way to have this resource bundle loaded at the session scope as you can do it in JSTL?
    The f:loadBundle seems to be missing the 'scope' attribute as the fmt:setBundle does.
    Any suggestions?
    Gis

  • JSTL - x:out problem

    Hi,
    I'm trying to use the JSTL - XML tag library, but I have problems using the x:out tag. I'm using JSTL 1.0.3
    My jsp is:
    <%@ taglib prefix="x" uri="http://tags/jstl-xml" %>
    <html>
    <head>
      <title>JSTL: XML Support -- Parse / Out</title>
    </head>
    <body bgcolor="#FFFFFF">
    <h3>Parse / Out</h3>
    <x:parse var="a">
      <a>
       <b>
        <c>
         foo
        </c>
       </b>
       <d>
         bar
       </d>
      </a>
    </x:parse>
    <x:out select="$a//c"/>
    <x:out select="$a/a/d"/>
    <hr />
    </body>
    </html>In Tomcat 4.0.6 I get the following error:
    java.lang.NoSuchMethodError
    at org.jaxen.dom.DOMXPath.(DOMXPath.java:101)
    at org.apache.taglibs.standard.tag.common.xml.XPathUtil.valueOf(XPathUtil.java:237)
    at org.apache.taglibs.standard.tag.common.xml.ExprSupport.doStartTag(ExprSupport.java:102)
    at org.apache.taglibs.standard.tag.el.xml.ExprTag.doStartTag(ExprTag.java:103)
    at org.apache.jsp.Out$jsp._jspService(Out$jsp.java:121)
    Using JBoss 3.2.2RC 2 I get the following error:
    javax.servlet.ServletException
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
    at org.apache.jsp.Out_jsp._jspService(Out_jsp.java:107)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    I already copied the 4 jars and the 8 tlds that come with Web Services Developing Pack 1.1
    Any idea what can be going wrong?
    Thanks
    Mary

    hi
    i dont have solution for your problem, but maybe you can help me with parsign xml-file. my jsp looks like this:
    <%@ taglib prefix="x" uri="/WEB-INF/x.tld" %>
    <%@ taglib prefix="c" uri="/WEB-INF/c.tld"%>
    <c:import var="xml" url="CV.xml"/>
    <x:parse varDom="dom" xml="${xml}"/>
    and im getting this error message:
    According to TLD or attribute directive in tag file, attribute xml does not accept any expression
    could you post the web.xml and the jsp file where the xml file is being parsed?
    Thanks!

  • ClassCastException: javax.servlet.jsp.jstl.fmt.LocalizationContext

    today i had the following exception, which blows my mind away. what can be wrong?
    java.lang.ClassCastException: javax.servlet.jsp.jstl.fmt.LocalizationContext
         at org.apache.taglibs.standard.tag.common.fmt.BundleSupport.getLocalizationContext(Ljavax.servlet.jsp.PageContext;)Ljavax.servlet.jsp.jstl.fmt.LocalizationContext;(BundleSupport.java:127)
         at org.apache.taglibs.standard.tag.common.fmt.MessageSupport.doEndTag()I(MessageSupport.java:152)
         at jsp_servlet._web_45_inf._jsp._templates.__template._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__template.java:235)environment: weblogic 8.1-sp4, jstl 1.0.6

    well the fact is that the JSPs are 100% correct. i'm migrating some legacy project, which builds, deploys and runs in its old state with no errors at all (and the old state is current PRO, so every bit of code is supposed to be correct). hence i presume it's not the JSPs that are wrong (because i never touched them), that's something else, probably the configuration of things, or conflicts between container libs and webapp libs, or sort of like that.
    so if this error doesn't ring a bell, then i'll try to fiddle around, i thought maybe that's something "famous" :).

  • JSF and JSTL fmt:message

    I have the following JSP:
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <html>
    Language: <fmt:message key="test.language"/>
    </html>When I run this without faces (http://localhost:8080/myapp/test.jsp), it works fine, the language for the message is choosen by the browsers language setting. If I run this thru faces servlet (http://localhost:8080/myapp/faces/test.jsp) the message is english always and the browser setting is ignored (english is the default language of the VM running tomcat).
    It may be a problem in JSTL because request.getLocale() returns the correct locale in both cases.
    Any ideas?
    I tried JSTL 1.0.5, Tomat 4.1.30 and 5.0.19
    Thanks a lot
    Andreas

    JSF sets the locale for the view to the locale specified by the Accept-Language request header (i.e., the user's browser language setting) that is the best match for the locales defined as the default or supported locales in faces-config.xml, or to the JVM default locale if none of them matches. The selected locale is made available for JSTL i18n actions (when you use JSP for the view), so as long as you define all locales you support in faces-config.xml, your page shouldwork fine.

  • JSTL fmt-localization

    Hello,
    I'm using Tomcat 5.5 as servlet provider and Apache 2 as proxy.
    My problem is that localization doesn't work.
    1. Choose locale -> Locale ok
    2. Choose another locale -> Locale ok
    3. Choose locale 1 -> locale still 2
    Order does not matter, second locale is used always, even if i change browser.
    jsp-code:
    <fmt:setLocale value="${requestScope.user_locale}"/>
    <fmt:bundle basename="messages">
    <fmt:message key="start.title"/>web.xml:
    <taglib>
                <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
                <taglib-location>/WEB-INF/fmt.tld</taglib-location>
         </taglib>     I print the value of requestScope.user_locale to page and it's ok. fi_FI or sv_SE
    I need help, please? :)

    Thank you for asking the right questions... i think :)
    le
    I'm changing with:
    <fmt:setLocale value="${requestScope.user_locale}"/>
    Cache is disabled:
    <%
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    %>
    requestScope.user_locale value is: fi_FI or sv_SE , it's Locale object (i'v printed it before fmt:setLocale
    ${javax.servlet.jsp.jstl.fmt.locale} does not print anything :(
    I do not know the version of JSTL, sorry :(
    web.xml is Servlet 2.3
    Thanks!

  • Where can I get an Html error report of all the syntax and tag problems?

    Where can I get an Html error report of all the syntax and tag problems?

    Thank you for your answer.
    Where is the DW validation for me?
    My files are in my computer so I don’t have an external URL.
    File > validation > as xml = closes DW... Maybe because it is not a correct command for HTML,
    And
    Window > results > validation = gives a partial mistakes (e.g. shows an open tag without closing tag, but doesn’t show a closing tag without an open tag).
    Thank you.

  • JSTL sql tags with jndi datasource

              Im trying to use JSTL sql tags but get "no suitable driver" when trying to connect
              to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

              I figured it out but I'll leave it up to BEA to tell everyone how to doit.
              "Fred Forester" <[email protected]> wrote:
              >
              >
              >Im trying to use JSTL sql tags but get "no suitable driver" when trying
              >to connect
              >to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

  • I18n fmt tags in jsp

    I have jsp's designed to support multi languages and for the purpose I am using the fmt tags in my code so in the jsp's I use <fmt:setBundle var="templatesbundle" basename="com.stem.templates"/>and then I try to access the message as follows
    <fmt:message key="page-label-login" bundle="${templatesbundle}"/>but for some reason it doesnot seem to be working. I have placed the templates file named templates.properties under
    WEB-INF/classes/com/stem

    Crossposted in JSP forum.
    http://forum.java.sun.com/thread.jspa?threadID=644100&tstart=0
    Continue discussion over there as it is more appropriate

  • Unable to use JSTL fn tags in WL 8.1

    hi,
              I am trying to use JSTL functions tags in my struts app, and I am seeing this error...
              Error in using tag library uri='http://java.sun.com/jstl/functions' prefix='fn': Tag Library Descriptor contains no Tag descriptions
              probably occurred due to an error in /newgui/customerservice/AdditionalLines.jsp line 4:
              <%@ taglib uri = "http://java.sun.com/jstl/functions" prefix = "fn"%>
              I have the entry in web.xml as below...
              <taglib>
              <taglib-uri>http://java.sun.com/jstl/functions</taglib-uri>
              <taglib-location>/WEB-INF/tlds/fn.tld</taglib-location>
              </taglib>
              I also have the fn.tld in the tlds folder along with other core and sql tlds. core tlds are working (they are 1.0.4 version), but I am having trouble using fn tags.
              btw, I am running the struts web-app on WL 8.1 Sp4 (or sp3) not sure...
              Any help is greatly appreciated...
              thanks,
              Kiran :)

    Update: I just looked up the WL version and it's 8.1 sp3
              So, I guess, JSTL 1.1 (which includes jstl fn tags) is not supported by WL.... Someone correct me if I am wrong.
              Thanks,
              pal :)

  • IBooks 1.3 video tag problem! Can any developer help me ?

    Probem with epub files. iBooks 1.3 video tag problem! Can any developer help me ?

    I solved a similar issue, by removing the oracle.xml shared library when deploying the application ...

  • Combing jstl/xml tags with jsf - can't pass parameter

    I'm using the jstl/xml tags to parse portions of an xml document. For some value of an attribute I want to render a search link, many of these links may be rendered on a page and I need to track which one has actually been selected using the id of the generating xml element.
    This is what I've tried, both using h:commandLink and a f:param and t:commandLink (tomahawk) and a t:updateActionListener.
    It doesn't seem to be possible to expose the resolved value of the xpath ="@id" in any way that either the tomahawk or core jsf tags can see.
    <x:when select="$control[@type='SEARCH']">
    <input type="text" id='<x:out select="@id"/>' disabled="true">
    <x:set var="selectedId" select="@id"/>
    <h:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <f:param value="${selectedID}" name="selectedID"/>
    </h:commandLink>
    <%--<t:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <t:updateActionListener property="#{pack.searchingId}" value="${searchId}"/>
    </t:commandLink>--%>
    </x:when>

    The JSF and JSTL tags don't really play well together.
    Particularly conditional and looping tags.
    My suggestion would be - if you're using JSF, don't use JSTL.
    You are right in that the JSF tags don't bother with the xpath expression.
    Would it be possible to shift the xml logic into an action/bean somewhere, and just present the jsp page with a list of relevant objects?
    If I understand you are trying to determine which link was clicked on a page? In the JSF action "pack.search"?
    What method of iterating are you using? an x:forEachLoop? A datatable?

Maybe you are looking for

  • Can't setup POP3 E-mail on mail client on my MacBook Pro

    So this problem is getting really out of hand and I'm not sure what options I have left. So here are the details: I'm trying to set up my work e-mail (the site host is Network Solutions) with Mail. There seem to be no problems with the online client.

  • Non Apple Display compatability

    Hello, I just joined this discussion and hope this is the appropriate place to ask my questions. I run a Powermac G-5 Dual processor with System System 10.4.6 and the ATI Radeon 9600 Pro graphics card. I have attached 1 Samsung SyncMaster 192 MP 19"

  • Error occured while signing in

    Trying to convert a PDF file with my adobe exportPDF. when i hit convert it says "error occured while signing in"? What should I do?

  • HT4623 can i instal ios 7 in ipad 1?

    can i instal ios 7 in ipad 1 ?

  • Account determination in SRM

    Hello, Can someone explain to me how the account determination in SRM works? I have a thorough understanding of MM. I would like to know what the possibilities are when configuring account determination (classic scenario). Thank you & Kind regards, D