JSTL localizationContext and NitroX behavor

I have some project that i writing some time (about a year)... I uses J2EE 1.3 (web.xml and so other stuff like jstl 1.0.6, struts 1.2.4...).
My question is about a default resource bundles, particulary in my case this happens:
1. I have web.xml file and some of it's part is like this:
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
<param-value>en_US</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.basename</param-name>
<param-value>ApplicationResources</param-value>
</context-param>
2. I have in my classpath of the project one file ApplicationResources_en_US.properties (only one .properties file).
...and the plugin yeelds that he can't fine ApplicationResources ("The resource bundle "ApplicationResources" cannot be resolved.").
We all know that JSTL uses fallback algorithm for finding proper resource bundle (chap. 8.3 of spec).
Since web.xml context tag sets:
- javax.servlet.jsp.jstl.fmt.fallbackLocale (for fallback when the algorithm fails);
- javax.servlet.jsp.jstl.fmt.basename - for the basename... locale will be set via the first step of algorithm (sec 8.3 of jstl 1 spec).
Why i have the warrning that "The resource bundle "ApplicationResources" cannot be resolved." since i have fallbackLocale and thus my view of jsp pages doesnt have proper bundle settings (i get only key names like "error.NoAuth") ? It is done portable way - see 8.3 chap of jstl spec.
PS plugin works fine if i set the localizationContext... in my case it is:
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>ApplicationResources_en_US</param-value>
</context-param>
, but i prefer for my app to specify only basename and fallback alg like in case described first of this post.
...waiting for answer ;-)
Student from Poland (Technical University of Gdansk)
Luke.

...i must also mention about the last step of this algorithm - when everything fails the bundle with only basename is tried to retrieve (javax.servlet.jsp.jstl.fmt.basename) ... but this dosent work either when proper file with the [basename].properties file exists in classpath (output dir of eclipse project).
Best regards.
Luke.

Similar Messages

  • JSTL, HttpSession and Portlet Session

    Here's a mysterious problem.
    I am trying to use portlet with JSP together. Inside the portlet, I populate some data, put the data into portlet session and dispatch (include) to a jsp. On the jsp, if I use JSTL to access the http session data:
    <c:out value="{sessionScope.test}"/> I got the following excepiton:
    14:27:08,880 ERROR StandardWrapper[portlet:jsp]:727 - Servlet.service() for se
    vlet jsp threw exception
    java.lang.IllegalStateException: Cannot access session scope in page that does
    ot participate in any session
    at org.apache.jasper.runtime.PageContextImpl.doGetAttribute(PageContext
    mpl.java:264)
    at org.apache.jasper.runtime.PageContextImpl.getAttribute(PageContextIm
    l.java:249)
    at org.apache.taglibs.standard.lang.jstl.ImplicitObjects$3.getValue(Imp
    icitObjects.java:633)
    If I use jsp scriptlet to access the http session, everything is fine:
    <%= request.getSession("test") %>
    Has anyone seen this exception? I posted the question on portlet forum already and no one is able to answer it so far.
    What's the different between JSTL sessionScope and jsp scriptlet?
    thanks!

    Try the calls
    <%= session.getAttribute("test") %>
    and
    <%= request.getSession().getAttribute("test") %>
    Make sure do not have on your page anywhere:
    <%@ page session="false" %>

  • Jstl.jar and standard.jar

    I have an application in 9.2, it is deployed as an exploded directory. For some reason, I have to explicitly add jstl.jar and standard.jar to the weblogic system classpath. I have the jars in the /WEB-INF/lib directory. Weblogic is able to find the classes that are in my other jars that are also in that directory. I have a Spring servlet, and on startup, the application context is able to load and all of my classes and the Spring classes are correctly found.
    However, when I try to hit one of the pages, I get this error:
    java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEachTag
    I get the feeling that weblogic is correctly parsing through the standard.jar file and correctly finding the tld inside the META-INF directory in the jar. Otherwise, how would it know that it needs to load the "ForEachTag" class? I checked and I made sure that I don't have any .tld files anywhere on the server. I also double checked to make sure that I have the "1.1" version of both of those jars. I also checked and I made sure that my web.xml is the correct version: Here is the top of my web.xml file.
    <?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" >
    I also did a test where I explicitly added standard.jar and jstl.jar to the classpath (keeping them in the WEB-INF/lib directory, just adding that path to the CLASSPATH) and everything worked.
    Any help would be greatly appreciated. I really don't want to have to modify the startup script of my production servers to include those jars on the classpath.
    Thanks, Chris

    Yes, I tried that. No luck. But, unless I am misunderstanding something, that setting only works if weblogic finds more than one version of a class throughout the classpath. I thought that that setting would just tell weblogic to use the version that it finds in my WEB-INF/lib directory. If this setting were to apply, wouldn't that imply that weblogic is finding some version of this class and I wanted to indicate which one to use. From the error message that I get, weblogic can't find this class anywhere.

  • Jstl.jar and standard.jar in NetBeans

    how can i put jstl.jar, standard.jar in library folder and how can i run that in same ide???

    Which version of NetBeans are you using?
    In general though, you should be able to expand the NetBeans project, select the Libraries folder, right-click on it, select 'Add Jar/File...' option and add any jar to the library list for the project.
    Another method is to define a library by 'Tools | Library Manager | New Library | Name the library and click OK | add the jars you want to be part of the named library'. Once a library is defined, then select 'Add Library...' on the right-click menu of the Libraries folder of a project and add the named library from the library manager. This should add all the jars that are part of the named library to the project.
    In NetBeans 5.5, JSTL 1.1 is a pre-defined library. You should be able to select that from the library manager and add to any project.

  • Myfaces and nitrox

    Hello,
    is it possible to use nitrox for JSF with myFaces (more complete implementation) instead of the sun implementation of JSF?
    why is there no option to add third party componant to a project and add it to the tag library view?It really miss.

    [quote:abb471e150="Anonymous"]is it possible to use nitrox for JSF with myFaces (more complete implementation) instead of the sun implementation of JSF?[/quote:abb471e150]
    You can it's one of the options when creating a new web-application.
    [quote:abb471e150="Anonymous"]why is there no option to add third party componant to a project and add it to the tag library view?It really miss.[/quote:abb471e150]
    Just add the necessary JAR-files to the webapp and refresh the AppXRay-DB...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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

  • Date Formatting, JSTL tags and the Spring framework

    Hi all, i have a small problem and i am hoping maybe someone here knows the solution. I am using a date field in a search page, binding it using a customDateEditor, and using a validator for correct formatting. The problem i have is this: i am using the <spring:bind> tag so that the page will return with the value that caused a validation fault. But even if the page succeeds it is submitted back onto itself, this time carrying the search results. But this time the date field will return in a completly different format. I cannot use the <fmt:formatDate> tag because of <spring:bind>. How can i register a "reverse" bind editor if you will, something that will print my data according to a specific format depending on the class?
    Code snippet follows :
    <spring:bind path="filesRequest.fileEndDateSearch">
    <input type="text" id="fileEndDateSearch" name="fileEndDateSearch" class="txtBox" value="<fmt:formatDate value="${status.value}" type="date" pattern="yyyy-MM-dd" />"/>
    </spring:bind>
    Using <fmt:formatDate> for the ${status.value} will cause an exception in case the validator fails, as the format date tag will try to parse the erroneous input.
    Just in case i was not that clear in the first paragraphs, here's exactly what i'm trying to achieve: using the Spring framework i want to design a search page that submits back onto itself(with or without some search results) that takes advantage of the validator, the <spring:bind> tag (that is to say, if the user submits some erroneous data it is returned to him in the corresponding field so he can correct it) and somehow should format the data it receives from the form according to a specific format.

    If you don't want the default localized version, I think you might have to do your own logic for how to display the dates.
    <fmt:formatDate value="${now}" dateStyle="SHORT"/> might be close... but
    with the following you can set the patterns to what you want. No automagic though :(
    <fmt:formatDate value="${now}" pattern="MM-dd-yyyy"/>

  • JSTL parseDate and formatDate

    Hello I try to display a simple Date.
    In my Form I have a attribute called createTime of the type java.util.Date but I don't get it to parse into a well formed String.
    The code:
    <c:out value="${requestScope.obj.createTime}"/> Gives me:      Fri Jan 01 00:00:00 CET 2049 That is correct. But I will get a well formed format like 01.01.2049
    I try to parse this Attribute:
    <fmt:parseDate var="parse" value="${requestScope.obj.createTime}" />
    <fmt:formatDate value="${parse}" />I get the following error:
    : javax.servlet.jsp.JspException: In <parseDate>, value attribute can not be parsed: "${requestScope.obj.createTime}" The Attribute is the but I don't get it into well formed format. Can anybody help me? I think it could not be difficult to parse a standard java.util.date into da formated String with JSTL.
    Thanks

    I tried some other example from java-forum:
    <c:set var="currWinDateStr" value="02/01/2005 11:21:39" />
    <fmt:parseDate var="currWinDate" value="${currWinDateStr}" pattern="MM/dd/yyyy HH:mm:ss" />
    <fmt:formatDate var="currWinYear" value="${currWinDate}" pattern="yyyy" />
    <fmt:formatDate var="currWinMonth" value="${currWinDate}" pattern="MMMM" />
    <%-- lines below are for debugging --%>
    currWinDateStr:  <c:out value="${currWinDateStr}" /><br/>
    currWinDate:  <c:out value="${currWinDate}" /><br/>I get the following error:
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: In <parseDate>, value attribute can not be parsed: "${currWinDateStr}"
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: In <parseDate>, value attribute can not be parsed: "${currWinDateStr}"
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
         org.apache.jsp.test_jsp._jspService(test_jsp.java:138)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    java.text.ParseException: Unparseable date: "${currWinDateStr}"
         java.text.DateFormat.parse(DateFormat.java:335)
         org.apache.taglibs.standard.tag.common.fmt.ParseDateSupport.doEndTag(ParseDateSupport.java:178)
         org.apache.jsp.test_jsp._jspx_meth_fmt_005fparseDate_005f0(test_jsp.java:176)
         org.apache.jsp.test_jsp._jspService(test_jsp.java:112)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)But this example works (http://forum.java.sun.com/thread.jspa?threadID=614555&messageID=3408277)
    Anybody a idea?

  • How to access and display a Web Service from a WSDL in JSP or JSTL ?

    Dear All,
    We need to access a Web Service which is hosted as WSDL How to access a WSDL file from JSP or JSTL, parse and display the SOAP response in JSP page.
    Any simple example or URL as reference to an example will be useful for me.
    It seems io tags of jakarta is able to send soap message, but how to display it in JSP.
    Yours,
    Sankar.B

    Dear Sir,
    Yes. I would like to know more about the Forte and how to consume WSDL file from JSTL. The following are my querirs.
    1. How to connect the declared JNDI from a JSP page. i.e: the Datasource - ex: booksDS
    2. We connect the Tomcat server using JNDI as jdbc/scott. But, if I give jdbc/scott in JSTL as datasource={jdbc/scott}, we could not able to connect. We use the following code in a JSP page to connect the DB from a JSP page. (Its quite easy to modify, so we use the connection in a JSP page.)
    3. How to Consume a WSDL url from JSTL. Ex: If there is a URL : http://localhost/ws/MathService.asmx?wsdl OR http://www.xmethods.com/test/BabelFish
    4. How to display the result. We tried via SOAP from io taglib of Jakarta, but gives us an SOAP (it also looks like xml) response. But, how to use the value from that soap response in IE client thru JSTL/JSP.
    5. Whether this JSTL tool will be available with Forte Enterprise/Community Edition. If so EE, whats the price.
    Please Reply Immediatly. We tried, trying, going to try to display a wsdl response, but not able to display in IE thru JSP/JSTL. But, weve tested the www.gotdotnet.com examples of asp.net web services, we are thru. Its quite easy it seems in .NET. But, we feel whether even there is not even one example in JSTL/ Java Web Services Dev. Pack to utilise a web service in full cycle. The example which uve given is thru servlets. We dont use servlets. Cos, its very easy to edit JSP pages, instead of compiling the serv. and using it.
    I hope ull reply for all the above queries, since ur from SUN.
    Expecting your fav. reply.
    Yours,
    Sankar.B

  • Standard.jar and jstl.jar directory

    First off I probably should apologize in advance because my problem might be an eclipse config issue.
    I created a simple servlet and I tried to include a jstl library import javax.servlet.jsp.jstl.sql.Result;. It compiled cleanly but, when I ran the application (through a browser accessing tomcat through eclipse) I was getting this error...
    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 eventually found out what was wrong but I don't understand why it was wrong and that's my question. Originally I had jstl.jar and standard.jar in the projectHome/lib directory. When I moved those 2 files to the projectHome]/WEB-INF/lib directory, however, things ran correctly. Is this a setting somewhere within my tomcat config on eclipse perhaps? Or can someone point me in the right direction about this issue in general?
    Thanks in advance!

    Tomcat and Eclipse have different ideas of classpath.
    In Eclipse you set the classpath as part of the project properties: Java Build Path.
    Tomcat uses:
    - web-inf/classes directory
    - jar files in web-inf/lib
    - jar files in /shared/lib
    - jar files in /common/lib
    So in order to run on Tomcat, they need to be in the web-inf/lib directory.
    Cheers,
    evnafets

  • J2EE, JSTL and JSF questions

    I am trying to learn J2EE/JSTL/JSF and have quite a few general questions. Any help on any of these is appreciated.
    1) Is there a way, just by using J2EE/Java to "manipulate" an XML file. Not just parse and read it's data but actually add nodes to the file?
    2) I've been reading quite a bit on JSTL and JSF recently. Is JSF supposed to be an alternative to Struts and JSTL an alternative to scriptlet coding?
    3) I am also working on creating a message board but throwing around a couple of ways to implement it. Either (a) using a database to store posts and a JSP interface or (b) using an XML document to store postings. Which of these two seem best or is there a better option?
    4) Is there an easy way to call Php from a Java program? I need to invoke a php program when a user clicks on a link on a JSP page I have.

    1) The SDK provides JAXP (Java API for XML Processing) in javax.xml package.
    2) I wouldn't call it 'alternative'.
    3) Your choice. I'd to use a RDBMS. Less overhead, better suited, (much) more functions and better performance.
    4) If that program is available on the web, then just invoke a HTTP request. If not, I'd rather to rewrite it to Java.

  • Upgrade to JSTL 1.2 and JSF 1.2

    I created a Portal project in weblogic workspace studio 1.1 (weblogic portal 10.2). The portal was created with the default facets. I did not add JSF facet etc. Now all I am trying to do is upgrade to JSTL 1.2 from the add/remove project facets page. But I dont see 1.2 option in the dropdown. I can see the JSTL library in the C:\bea\wlserver_10.0\common\deployable-libraries folder. But for some freaking reason I am not able to select it. I thrn went to Window-&gt;Preferences-&gt;Workshop-&gt;Downloadable Libraries-&gt;JSTL library and tried adding the new JSTL 1.2 library but neither do I see JSTL 1.2 option in the drop down to download from BEA website and nor can I pick up that library from the existing JSTL installation.
    Also having the same issue with JSF. I cannot pick JSF 1.2 (i downloaded the myfaces JSF 1.2 libraries from the apache myfaces site)
    Its frustrating because I dont want to put a hack (dont want change configarations files etc). No idea why it has to this hard. Can someone please help.

    I'm not sure I would call this a hack but this is what I ended up doing to up grade the JSF Facet...
    [t-697865]

  • Where do I put the Jakarta files standard.jar and jstl.jar when developing with JSF 2.0 in OEPE using web logic server

    hi everybody, I am wondering what should i do with the standard.jar and jstl.jar files when using we logic. I tried putting both files into
    the directory c:\oracle\middleware\oracle_home\user_projects\domains\base_domain\bin.  I don't know if this is correct.  Thanks in
    in advance for the help.

    Anyways I found this link on www.oracle.com website by the same author of the book I am reading Deepak Vohra - Templating with JSF 2.0 Facelets.
    although here he is using Weblogic 11g although I don't think it makes a difference.  have a look at the Setting up the Environment section
    where he says to download the jstl.jar and standard.jar files.
    http://www.oracle.com/technetwork/articles/java/facelets-454361.html

  • Jsp and jstl

    Hi ,
    I was trying to use jstl to make my jsp's look clean and easliy manageable,but till now i have had no luck in making it work.
    I have added all the tld's and jars required for jstl to my war file and also i made the entry in my web.xml,in my jsp i put
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    and the place where i wanted to put my if statement i wrote this code
    <c:if test=${endVal==0}>
    <c:set var="endVal" value=<%=result.size()%> />
    </c:if>
    I tried with both
    uri="http://java.sun.com/jstl/core"
    uri="http://java.sun.com/jstl/core_rt" but it doesnt seem to be setting that value.plz advise what is wrong.
    Thanks

    thanks panyong-cs !
    Now atleast its tryign to set the value but the error i am getting is
    "cannot resolve symbol
    symbol : method setValue (int)
    location: class org.apache.taglibs.standard.tag.rt.core.SetTag
    _c_rt_set0.setValue(result.size()); "
    resong being that result.size() is an int ....so now how should i set that value....

  • Error in tomcat4.1 and JSTL

    sir
    now i am using tomcat 4.1 and jstl 1.0.6 and i have write on file in which i included ...
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    but when i compile it , it gives error that ,,,
    org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or the jar files deployed with this application
    please tell me that what changes should i made . i have put down jstl.jar and standard.jar in tomcat4.1 / common / lib
    thanks
    gaurav

    Spammer! Couldn't you keep your problems to one post?
    http://forum.java.sun.com/thread.jspa?threadID=621677
    http://forum.java.sun.com/thread.jspa?threadID=621337

Maybe you are looking for