JSF properties file

Using JSF and JSTL, i am trying to use a properties file, to import an xml file.
PROPERTIES FILE:
name > messages.properties
content > url=/home/index.xml
JSP FILE:
<f:loadBundle basename="jsfks.bundle.messages" var="msg"/>
<h:outputText value="#{msg.url}"/>
<c:import url="#{msg.url}" var="xmlSource" />
<x:parse xml="${xmlSource}" var="xmlDocument" />
The outputText works, it does display my URL, but the c:import dont work.
I want to value that is in my properties file, to be imported i.e
<c:import url="/home/index.xml" var="xmlSource" />
how can i do this using the above method?
Thanks

Like I said here http://forum.java.sun.com/thread.jspa?threadID=5175073
Your approach won't work as the value is completely out of the scope.
Load it manually in the same scope, using java.util.ResourceBundle for example.

Similar Messages

  • JSF Properties File for Images

    I got a .war file where all my jsps are, including my JSF properties file that include a path(outside my .war file), for example:
    urlWatermark=file:///C:/SA/images/watermark.jpg
    Then in my JSP page:
    <f:loadBundle basename="jsfks.bundle.image" var="msgImage" />
    <c:set var="pageWater" scope="session">               <h:outputText value="#{msgImage.urlWatermark}" />
    </c:set>
    <img src="${pageWater}" />
    but it dont want to display my image, as when i view the source in the browser, it shows:
    <img src="file:///C:/wesbankSA/images/watermark.jpg" />
    how can i change this so that the image will display.
    thanks

    so I have to write 2000 lines of code just to reference images, outside my war
    file, using a JSP props file?No. Re-count the lines of the last given ImageServlet example (you may skip comments) and read the given examples how to use it.
    Isnt there a simpler way of doinig thisYes, copypaste the ImageServlet code, change it where needed (at least the base path, the rest can be kept default), define this servlet in your web.xml, change your <img> or <h:graphicImage> tags to make use of it and run it.

  • Externalizing the Properties file in JSF

    Hi,
    I want to access a properties file located in "C:\" drive in JSF.
    In case if i move the file to some "D:\" location, only changing its path
    should work for me. Is there anyway of externalizing the properties file
    rather than keeping it in WEB-INF?
    Thanks in advance

    It depends on how the code is written.
    I assume you're calling the files using the ResourceBundle.getResourceBundle method: if you do this during the initialization (server startup) you need just to restart the ejb module to make it re-read the files.
    I'm quite in a similar situation (WAS4, lots of .properties)and every time I make some changes to my files I need to restart the applications in order to make them read such modifications.
    In no case you should redeploy the ejb module (if this is the case, there must be something wrong somewhere else...)
    bye

  • JSF and XML propertie File instead DOTpropertie File

    Hello
    I'll would like to load resources in JSF (<f:loadBundle>)
    Coming out by a xml File instead a .propertie File.
    I've got no problem get resources stored in .properties
    I try to change the files. Al I get is a exception throw by
    org.apache.myfaces.taglib.core.LoadBundleTag resolveBundle
    Resource bundle 'com.webapp.navigation.' could not be found.
    Where did I find some information about?
    Where is it to configure?
    The Servletcontainer is Tomcat.
    Thank You
    esion
    .

    Thank You,
    it's realy a good idea to rtfm :-)
    esion

  • Html tags in .properties files.

    Hi all,
    I want a small clarification regarding the .properties file in JSF.
    I want to execute html tags in the properties file. my resource file is...
    code = Section Code
    I want to make the Section Code as bold. If i give like this
    code = < b > Section Code < /b >
    all the html tags are displayed as it is on UI. In struts this works fine. means "Section Code" is displayed in Bold.
    In JSF, is there any way to do this?
    Thanks.

    Use escape attribute of outputText tag.
    <h:outputText value="#{employee.dataText}" escape="false"/>

  • Accessing properties files in jspx page in ADF Generic application

    Hi All
    I have created an genric application .I have jdevloper 11.1.1.3.I need to add the .properties file in my application and access that properties file in my .jspx page.
    so i have created the Resources folder and added the properties file in that folder and now i am trying to access that contents of that properties file in my jspx page using below code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
              <f:loadBundle basename="Resources.sampleproperty" var="props"/>
               <af:panelGroupLayout id="pgl1">
                 <af:outputText value="testing"  id="ot1" />
                  <af:outputText value="#{props['sample.label.text1']} " />
                  <af:outputText value="#{pageFlowScope.UserId}" />
              </af:panelGroupLayout>
    </jsp:root>but iam not able to access the propert and blank page is only displayed
    so what more steps i need to do to access it?
    Note:-previously i created the application of type Fusion Web Application ,where it added the folder named view and we used to add the .property file in it and accessed the contents of the .property file using above code and tthe above code was running fine.
    Thanks and Regards
    Bipin Patil

    Hi All
    I solved this issue
    by adding the following code in faces config.xml
    <application>
    <resource-bundle>
         <base-name>com.property.sampleproperty</base-name>
          <var>props</var>
        </resource-bundle>
    </application>note :The sampleproperty.properties should be present in java package com.property.sampleproperty
    please visit below link for more details.
    http://www.laliluna.de/articles/posts/jsf-2-evaluation-test.html

  • Log4J - reading properties file from /WEB-INF directory issue..

    I'm just learning to implement Log4J; the approach I am taking for my JSF application running under Tomcat 5.5x is to create an initialization servlet to initialize the logger, and then access the logger instance within my backing beans and application module services. I include log4j.jar file in /WEB-INF/lib and log4j.properties in /WEB-INF.
    First I wanted to see if this was a good approach, and secondly I'm having trouble accessing the log4j.properties file from the /WEB-INF directory (see below) - any suggestions on how to set up the path so that the properties file can be found (I receive a java.io.filenotfoundexception)?
    Where I'm looking for direction is how to define a single instance of the logger and then access that instance from my java classes versus re-creating the logger in each class.
    ----- web.xml --------
    <servlet>
    <servlet-name>LogServlet</servlet-name>
    <servlet-class>com.sidehire.view.util.LogServlet</servlet-class>
    <init-param>
    <param-name>setup</param-name>
    <param-value>/WEB-INF/log4j.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    ------ LogServlet class ------
    public void init()
    throws ServletException {
    String config = getInitParameter("setup");
    PropertyConfigurator.configure(config);
    Thanks
    Message was edited by:
    javaX

    Try to put the log4j.properties in your WEB-INF/classes/ directory.
    You could wrap one log4j instance in a static method in a utility class, but then you would probably lose other information depending on your logger configuration.
    If you create an instance in each class, which after all is just one line like this:
    static Logger logger = Logger.getLogger(ChangePasswrdAction.class.getName());
    then you are able to get time and method information.

  • URGENT!!! can I borrow a valid jserv.properties file for a JSP application ?

    Hi there !
    I'm running Oracle enterprise edition on NT with oracle http server under apache.
    I created a JSP application using jdeveloper
    and deployed it to the web server.
    Now I'm still getting getting nullPointer exceptions after I have modified the jserv.properties file according to the documentation
    Can someone give me a file that is working for her/him under the above described circumstances ?
    Many Thanaks in advance
    Tony
    null

    laredotornado wrote:
    Hi,
    This might not be a JSF question, but I thought I'd start here as I'm building a JSF application. Upon startup of my Weblogic 9.2.2 server, I see these error messages
    log4j:WARN No appenders could be found for logger (org.apache.myfaces.webapp.StartupServletContextListener).
    log4j:WARN Please initialize the log4j system properly.
    One complication, my log4j.properties file is actually called "my.properties" (bizarre company reason). Is there somewhere in my faces-config.xml file or an equivalent where I can indicate what log4j properties file I'd like to use?Your company policy is to use non-standard names so that things must be configured manually? Interesting.
    In the past people created a servlet those sole purpose was to configure log4j in the initialization sequence and then do nothing.

  • About properties file values in descendind order

    hi,
    I have one query . I have one properties file ab.txt in that
    user       marks
    a    =           1
    b     =           5
    c      =           8
    here my query is  now i want to display marks in descendindgorder
    can any one give idea about this one

    Fine that it works for you, but please keep in mind: writing raw java code in a JSP file is a bad practice. Whenever you need to do so, your design is flawed. You should be using tablibs (JSTL, JSF, etc), EL and/or Java classes (servlets, beans, etc).
    You´ve been warned.

  • UIResources.properties file

    I would like to create a "Global help" page for my ADFBC/JSF application. The page will have more than 64000 characters. Is it a good idea to keep that text in the UIResources.properties file? I am following SRDemo application as the standards for doing things.
    Does changing the "value" in the UIResources.properties file require re-deploying of the application?
    Please advice!
    Thanks.

    Hi,
    The use of UIResources.properties make easy to change the texts you want to display, also for an help page that should be useful.
    If you think one UIResources can not contain all that you need (i don't know if there is a limit?), it's easy to add more resource files and you can use these separated file for organize the text they contain.
    For the need of a redeployement, i'm not sure but i don't think it's needed.
    Regards,
    Tif

  • Where should .properties file go

    In a JSF Application being developed with NetBeans
    should a properties file go with my Java source code files somewhere under
    src/java
    or is it better to create a
    web/WEB-INF/classes
    directory and put the properities file there?

    Put it outside of the project. So that you don't need to redeploy/reinstall the application/EAR to the appserver when you change the propertiesfile. For example /ext/appserver/properties or something like. Of course put this map in the classpath.

  • Externalize JSF bundle files ?

    Hello,
    I would like to know if it's possible to externalize my JSF bundle files running on Weblogic 9.1 ?
    And if I modify them, will it be reloaded by server without start/stop ?
    Best regards,
    Arlo.

    Hello Arlo,
    you probably mean to store the properties file outside the war file. I do not have experience with Weblogic but it should be similar. I have asked about that here a week ago: http://forum.java.sun.com/thread.jspa?threadID=5171120&messageID=9657852#9657852.
    You can search for the file in the classpath as it is explained in the link. Or you can use a static absolute path like /home/xy/ - then you can load it directly of course - which is quite improbable.
    Another possibility is to have the file somewhere outside the classpath (like /home/xy/) without direct addressing. For such a case I would use two properties files: the main file at the place you choose and the additional file which will have just one entry - the absolute path to the main file. The latter file must be in a directory accessible by the webserver (see the link above).
    Jan

  • Error reading properties file upon deployment

    hi. i'm still relatively new with regards to the Java programming language. in any case... i am developing a simple project wherein the application has to make a database connection to a server. the application is finished already however.. i am having problems deploying it.
    my project has a "resources" package containing the file "config.properties" which contains various information (connection details among others). correct me if im doing something wrong, but in deploying in, i copied the "dist" folder of my compiled code and then tried to run the java exe independently which resulted in an error. i already tried copying the "config.properties" file to the dist folder and even creating a "resources\config.properties" file but it still results in an error. could you please help me figure out how to deploy the application with the properties file. the code i used in referencing my .properties file is as follows:
    Properties configFile = new Properties();
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("Resources\\config.properties"));
                String username = configFile.getProperty("username");
                String password = configFile.getProperty("password");
                String url = configFile.getProperty("url");
                String dbtype = configFile.getProperty("dbtype");
                Class.forName(dbtype);
                conn = DriverManager.getConnection(url, username, password); thanks in advance. ^^

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • Error reading Properties file

    I have a main method which i am using to call a servlet located in the same Development Component. Until recently i had the servlet location hard coded and it was working without issues. Now i decided to make the location configurable. For this i created an sap.application.global.properties file in the EAR DC which contains the WAR of this DC.
    The contents of the above file are as follows:
    SAP application properties
    SERVLET.LOCATION=http://<server-name>/ControllerServlet/servlet/com.nike.xapps.eqptsp.swem.controller.ControllerServlet
    The code i am using in the main method to call this properties file and access the property is as follows:
    Context ctx = new InitialContext();
    ApplicationConfigHandlerFactory cfgHdlr = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");          
    Properties props = cfgHdlr.getApplicationProperties();
    String servlet = props.getProperty("SERVLET.LOCATION");
    contained in a try...catch block.
    On dubugging i get a NoInitialContextException repeatedly in the statement where the lookup is performed.
    These are all the additions i have made for reading this properties file. Does anyone know if there is anything more that needs to be done for this to work.
    Thanks,
    Murtaza.

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • Display data on ADF table using a VO binded to a message.properties file

    Hi,
    I want to display data in a JSPX page using ADF table which is based on a ViewObject. The attributes of the ViewObject should get it's value from a abc.properties file(static file).How can i achieve this.
    thanks in advance.
    regards,
    Himanshu.

    Hi Himanshu,
    When you create a VO based on static values, all of the records from your VO are generated into the MessageBundel.properties file like this
    devguide.entity.ViewObj.SL_0_0=1
    devguide.entity.ViewObj.SL_0_1=<val1>
    devguide.entity.ViewObj.SL_0_2=<val2>
    devguide.entity.ViewObj.SL_1_0=2
    devguide.entity.ViewObj.SL_1_1=<val1>
    devguide.entity.ViewObj.SL_1_2=<val2>
    You could add more lines to the properties files maintaining the same pattern. Also noticed that you can read all the values from a CSV file as well.
    The last resource is to programmatically read the file and start creating new rows on the VO, which won't use any of the declarative tools for VOs.
    -Juan Camilo.

Maybe you are looking for

  • What is difference between adjusting columns these two ways?

    Hi everyone, In my last post I learned that I could create a new Master Page that is designed as a 1-column format and apply it to the body pages I want to have as 1-column. (I have a doc that has 2-column formatted L and R master pages; only 1 page

  • HP Laserjet1213nf scanner issue on windows 7 OS

    Hi, I have HP Laserjet 1213nf Printer with network enabled and i am using ScanTo app for users to access the printer instead of full MFP setup. when i am trying to run this program to scan documents its giving error on windows 7 OS 64Bit.  Event View

  • Can I replace the internal hard drive if my old one died?

    I guess the questions should be should I replace it? My iMac's (early 2006 model) internal hard drive is totally dead, but I think if I install a new internal hard drive it will work again. If I get it up and running, I will use it in my classroom. W

  • Lumia 1020 NFC Tab+Share function doesnt work afte...

    I was able to use NFC tab+share function with lumia Cyan. It means, I was able to send files to my NFC enabled PC by tabbing my phone to my PC. But after Lumia Denim update I cannot use this function. Devices are not responding to each other. I see t

  • Text Box Value in the Query Bind Parameter

    Hi I have to use text box value in the query bind parameter Thanks to help...