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!

Similar Messages

  • 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

  • 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" :).

  • 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

  • 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 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.

  • 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.

  • 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 fmt:setLocale can't support multi setLocale in a jsp?

    hi:
    a jsp has follow code:
    <fmt:setLocale value="iso-8859-1"/>
    <fmt:setBundle basename="Directory"/>
    <fmt:message key="name"/>
    <fmt:setLocale value="gbk"/>
    <fmt:setBundle basename="Directory"/>
    <%--change <fmt:setBundle basename="Directory_zh"/> no effect --%>
    <%--here in theory,the java.util.ResourceBundle must recall with new Locale --%>
    <fmt:message key="name"/>
    TOmcat 5.0.16/jdk1.4.2
    Always display iso-8859-1 (Directory.properties) directory.
    how to display multi language in a jsp?
    thanks

    Directory_zh.properties exists? In the same physical location as Directory.properties? Directory_zh.properties contains the key 'name'?

  • JSTL FMT multiple content-language headers

    hello
    this is my second post about htis same problem. I am alot smarter now (which isn't saying much). But on ASF bugzilla they claim this is a OC4J issue. I can easily reproduce the problem.
    the link is
    http://issues.apache.org/bugzilla/show_bug.cgi?id=28248
    A brief summary, each time i call fmt:formatNumber it ADDS a content-language header, eventually it overflows the browsers buffers or something similar and causes an error. Is there a work around for this problem?
    Please help
    thanks
    troy

    hi troy,
    i think, they'll dont fix it (it's too trivial), but i suggest a workaround. establish a simple filter (thanks servlet 2.3), that prevent subsequent setLocale calls to the response object.
    Here is my workaround.
    [web.xml]
    <filter>
    <filter-name>oc4jsetlocalefilter</filter-name>
    <display-name>SetLocaleFilter</display-name>
    <filter-class>workarounds.oc4j.setlocale.SetLocaleFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>oc4jsetlocalefilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    [SetLocaleFilter.java]
    package workarounds.oc4j.setlocale;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletResponse;
    public class SetLocaleFilter
    implements Filter
    public SetLocaleFilter()
    public void init(FilterConfig p0) throws ServletException
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
    throws IOException, ServletException
    if (response instanceof HttpServletResponse)
    SetLocaleResponseWrapper respWrapper =
    new SetLocaleResponseWrapper((HttpServletResponse)response);
    chain.doFilter(request,respWrapper);
    else {
    chain.doFilter(request,response);
    public void destroy()
    [SetLocaleResponseWrapper.java]
    package workarounds.oc4j.setlocale;
    import java.util.Locale;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpServletResponseWrapper;
    public class SetLocaleResponseWrapper extends HttpServletResponseWrapper
    public SetLocaleResponseWrapper(HttpServletResponse response)
    super(response);
    public void setLocale(Locale locale)
    if (containsHeader("Content-Language"))
    System.out.println("setLocale skipped by filter. Content-Language already set.");
    return;
    System.out.println("setLocale called.");
    super.setLocale(locale);
    Good luck,
    Daniel

  • Help needed with JSTL fmt:message encoding

    I'm using a greek resource bundle like
    <fmt:setLocale value="el"/>
    <fmt:setBundle basename="i18n.messages"/>
    I used UTF-8 for both the bundle file and JSP response encoding, but the values never prints out in the JSP response properly. If any non-english user can share some insight here, i'd really appreciate it...
    Thanks,
    Manos

    Have you considered using unicode for presentation. It might not be the prettiest way to do things, however, when I needed to present non-english characters. I would send them to JSP as a collection of unicode characters and than translate each one into character based on the desired locale.
    Hope it helps.

  • Tomcat 5.5 or 6.0 + JSTL 1.2 - fmt:message doesn't work (for me :(   )

    I have trolled many forum posts and mailing list threads. I'm sure this question has been asked thousands of times (in fact I've read answers and tried to implement but come up short every time).
    Q: How do you make fmt: message work with multiple bundle files?
    I have simple test page test.jsp that includes a taglibs fragment. The page attempts to localize a key from a Messages bundle. I get the following as output:
    ???shoop???
    This JSP has been deployed on Tomcat 5.5.23 and Tomcat 6.0.13 with the same result.
    I have configured the web.xml many different ways, but currently it's per the 2.4 servlet spec. I have jstl-1.2.jar located in WEB-INF/lib. This is the only webapp library included my deployment. The rest is "vanilla" Tomcat.
    I'm including the contents of the important files below.
    What could be wrong?
    test.jsp
    <%@ include file="/taglibs.jsp" %>
         <!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">
         <head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
         <title>Simple i18n Test</title>
         </head>
         <body>
              <fmt:setBundle var="msgBundle" basename="Messages"/>
              <p><fmt:message key="shoop" bundle="${msgBundle}"/></p>
         </body>
         </html>
    taglibs.jsp
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
         <context-param>
              <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
              <param-value>en</param-value>
         </context-param>
         <display-name>test</display-name>
         <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>
              <welcome-file>default.html</welcome-file>
              <welcome-file>default.htm</welcome-file>
              <welcome-file>default.jsp</welcome-file>
         </welcome-file-list>
    </web-app>
    ------------------

    Hi all -
    evnafets continues to grow his collection of platinum stars. :)
    The trick was to set basename in fmt:setBundle to i18n.Messages.Messages. It's not clear from the tag's javadoc, but it appears that the convention is
    path.to.bundledirectory.bundledefaultfilenamelessdotpropertiesextension
    So, for me
    since I have the following deployment structure
    WEB-INF/classes/i18n/Messages
    Messages.properties
    Messages_en.properties
    Messages_de.properties
    I had to specify
    <fmt:setBundle basename="i18n.Messages.Messages" var="msgBundle" />
         <p><fmt:message key="shoop" bundle="${msgBundle}" /></p>
    to finally see
    shoop
    If I add
    <fmt:setLocale value="de" /> before all that
    I get
    der shoop-a-loop
    Ha ha!
    I would mention that it is not necessary to add the localizationContext in web.xml. It's a convenience if you don't want to specify the default bundle in your JSPs. You cannot define more than one bundle in your web.xml.
    I am working with a webapp that has many different bundles, so I'll incurthe overhead of specifying bundle basenames and vars.
    Thanks!

  • Question on Issue with fmt:formatNumber tag of jstl

    Hi,
    We have a web application that uses struts framework. In the action class,i am setting an attribute of request object like
    request.setAttribute("Val",new Double(11.25489));
    I am using jstl fmt:formatNumber function in the jsp page to format the value to 2 decimal places.
    <fmt:formatNumber value="${Val}" maxFractionDigits ="2" />
    When i access the jsp page,there is no display of anything.
    If i access using <c:out value="${Val}"/> ,it does print the value.
    Interestingly,tomcat does not generate any corresponding java file in its work area.
    Any clues...anybody ?
    Edited by: gbhakta on Oct 31, 2007 12:23 PM

    Ok you are setting the value in request scope?
    How does the control transfer from the Struts Action to your JSP page?
    Check the struts-config to see if that forward is configured as a "redirect". If that is so, your request attribute would be lost, because a redirect causes a new request.
    The following code prints out all request attributes that are currently in scope.
    It might help checking to see if your "Val" is in scope or not.
    Request scope attributes:
    <table border="1">
    <c:forEach var="attr" items="${requestScope}">
      <tr><td><c:out value="${attr.key}"/>a</td><td><c:out value="${attr.value}"/></td></tr>
    </c:forEach>
    </table>Cheers,
    evnafets

  • NetBeans 6.5: using fmt in an included jsp

    I am using netBeans 6.5 and I have a probelms with FMT
    1) I create a resource bundle
    2) I create a simple jsp with the correct taglibs,
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <fmt:setBundle basename="localization.byr" var="bundleName" scope="request"/>
    <fmt:bundle basename="${bundleName}">
    <html>
    <body>
    <fmt:message key="ricerca.localita" />
    </body>
    </html>
    </fmt:bundle>
    3) in this scenario everything works fine, the resource bundle is correctly loaded and i can see the string translated
    4) If i create a new jsp
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <fmt:bundle basename="${bundleName}">
    <fmt:message key="ricerca.localita" />
    </fmt:bundle>
    and i include this jsp in the main one, nothing works, and both in the in the main and in the included page the string is not risolved!!
    Any Idea?
    Please help me:)

    I solved it by myself, maybe it can be useful to everybody:)
    The <fmt:bundle> and the <fmt:setBundle> should not be used together.
    1)When you use the <fmt:bundle> the parameter basename should be a string, the name of the resource bundle. Then, inside a <fmt:bundle> tag, you will be able to use fmt:message WITHOUT SPECIFYING THE BUNDLE.
    Example:
    <fmt:bundle basename="myLocalizationClass">
    <fmt:message key="mymessage"/>
    </fmt:bundle>
    When you use the fmt:message outside the fmt:bundle, you need to specify the bundle attribute for the fmt:message tag. This bundle attribute should be of localizationContext type, and has to be set with setBundle!
    Example:
    <fmt:setBundle bundleName="myLocalizationClass" var="myBundle"/ >
    <fmt:message key="mymessage" bundle="${myBundle}"/>
    My problem was dued to the fact that i was putting the bundle in a variable with the setBundle and retrieving it with the fmt:bundle. But the fmt:bundle was expecting the name of the class while I was passing to it a localizationContext!

  • Does localization work in EA3 ??

    I've got the impression that localization doesn't work properly. That could be one issue why the car-demo example doesn't work and the reason why you get such a weird result (code & chars).
    I've got the same problem when running this code:
    -----<start>-----
    <fmt:setBundle basename="Strings" var="strings" scope="session" />
    <faces:output_text bundle="strings" key="anyString" />
    -----<end>-----
    The result shows an empty page, although the String.properties was properly referenced.
    Can anyone verify this behaviour??

    It took a little work, but I think I was able to figure out where the problem is occuring (at least in the Java Server Faces Code). The problem occurs in the getKeyAndLookupInBundle method of the com.sun.faces.renderkit.html_basic.HtmlBasicRenderer class. (This class should be located in the jsf-ri.jar.)
    There is line of code in the method similar to the following:
    if(null == Thread.currentThread().getContextClassLoader().getResource("javax.servlet.jsp.jstl.fmt.LocalizationContext"))
    it appears that for some reason that JBoss is returning null for the getResource() method call. This forces the expression to evaluate to true, and a MissingResourceException to be thrown. I changed the method call from 'getResource' to 'loadClass' and it works fine. (Anybody have an idea why the 'getResource' method won't find the class in JBoss?)
    I am not sure if there is way to configure JBoss to fix this, I tried a variety of configuration tweaks before delving into the code with no results. I am using JBoss 3.0.6 bundled with Jetty.

Maybe you are looking for

  • Import/Export code using Memory ID in BO Method

    Hi experts, I am having a approver name and other relevant data in my report. I don't want to write the entire code I want to bring it into my BO method by using import/export memory id. Pl. guide me what should I do ? Is it possible or not? Thank yo

  • Problem building schema - Siebel OnDemand Web Services

    I'm trying to call a Siebel OnDemand Web Service from BPEL. I've downloaded the Contact.wsdl from OnDemand and imported it into my project. I've created a partner link and created variables for the input and output. The problem is that JDeveloper can

  • Issues with Oracle in a new location.

    Hello - I recently had to change the computer name of a Windows 2003 SP2 test server. Among other software installed was Oracle 10g r2. There were issues with Oracle in its new location where it was trying to reference the old computer name. I assume

  • Help!  BootCamp /Win XP NETWORK CONTROLLER

    I have Macbook Pro, and have installed Windows XP PRO quite long. It's working OK then after 2 month no using internet, now in window XP in prompt me to install Network Controller which i try to reinstall all BOOTcamp driver and online search for dri

  • Installing new hard drive when still in warranty

    I want to get a new MacBook Pro 2.4 and have a 200gb 7,500 hitachi drive fitted. How can I do this without messing up the warranty?