JSF 1.2 LoadBundle Problems

Hi guys
So I update my application from JSF 1.1 to 1.2
I use Bundle resources.
So in the last version I only declare my resources by using the tag loadBundle
But now it seems that its not working anymore. If I declare it in the faces-config.xml , its okay. But I have several files.properties
So If there is a better way than to declare 30 files in the xml file, I'm listening.
Thx guys.
ps: I found that https://issues.apache.org/jira/browse/MYFACES-1238 , so changes as been done, but logicaly the old way should continue to work no ?

I have moved my Resources.properties file under WEB-INF\classes\demo and I used this tag <f:loadBundle basename="demo.Resources" var="msgs" />to access. It seems to be working. Thanks to Jason Lee (JSFT Developer) for the recommendation. Hope this help
Edited by: HobiOne2007 on Nov 28, 2007 5:27 PM

Similar Messages

  • OC4J 9.04 and JSF 1.1.0 problem

    Our problem scenario is related to JSF and OC4J.
    When an exception is generated that is not handled by our application and thrown to the web container, the user is redirected to an error page. If the user refreshes the error page then the whole application gets into an illegal state i.e. blank pages are shown for all the pages. It seems like the problem is related to JSF 1.1.0 and OC4J 9.0.4 (uses J2EE 1.3).
    The application works fine on OC4J 10 R3 (uses J2EE 1.4), Tomcat 4 (uses J2EE 1.3) and Tomcat 5 (uses J2EE 1.4).
    Anyone experiencing the same kind of problem? Any ideas?

    Our problem scenario is related to JSF and OC4J.
    When an exception is generated that is not handled by our application and thrown to the web container, the user is redirected to an error page. If the user refreshes the error page then the whole application gets into an illegal state i.e. blank pages are shown for all the pages. It seems like the problem is related to JSF 1.1.0 and OC4J 9.0.4 (uses J2EE 1.3).
    The application works fine on OC4J 10 R3 (uses J2EE 1.4), Tomcat 4 (uses J2EE 1.3) and Tomcat 5 (uses J2EE 1.4).
    Anyone experiencing the same kind of problem? Any ideas?

  • JSF 1.0 HTML problem

    I updated my JSF version to the beta version 1, and I get a problem that was not present in the previous version:
    I generate HTML processing xml data, and put the data in a bean, when I output the variable I only get text and the browser does not format it into html !
    Did I miss something, is there anything I need to change from the previous version.
    The line is just :
    <h:output_text id="html" value="#{userInfo.userKeywords}"/>
    Thanks if someone has any idea.
    Franck

    I updated my JSF version to the beta version 1, and I
    get a problem that was not present in the previous
    version:
    I generate HTML processing xml data, and put the data
    in a bean, when I output the variable I only get text
    and the browser does not format it into html !
    Did I miss something, is there anything I need to
    change from the previous version.
    The line is just :
    <h:output_text id="html"
    value="#{userInfo.userKeywords}"/>
    Thanks if someone has any idea.
    FranckTo protect against the potential for cross site scripting attacks, by default the <h:output_text> tag will filter the output for characters that are sensitive in HTML and XML, including the "<" character, which is output as "@lt;" instead. If you want to turn off this filtering (and you are sure that you've protected yourself), add escape="false" to the tag invocation.
    Craig McClanahan

  • Visual Web JSF and Java Script problem

    Hi i am using Visual Web JSF for development in my project. AJAX to update data from server when users enters data in one text box its an chat application. i am getting data from server but unable to update my <webuijsf:textarea> component with the new data on my chat page ... I am facing another problem in java script that it is not accepting relational operators (< . >) in JSF Application.... i am attaching some code here for reference...result =http.responseText.split(","); /// this is the response text from AJAX based call
    var obj=document.getElementById('form1:chatter_box'); /// this text area is to be updated...
    var txt=document.createTextNode(http.responseText);
    ///document.getElementById('form1:chatter_box').innerHTML = txt;
    for(i=0;i < size;i++){
    var txt1=document.createTextNode(result);
    obj.appendChild(txt1);

    Try changing onclick to onClick and try...
    regards
    shanu

  • JSF Drop Down Converter Problems

    I am having problems with JSF 1.1_01 (MyFaces 1.1.1).
    I have created page called page.jsp as follows:
    <h:selectOneMenu value="#{test.selectedDevice}" id="deviceTypeList" styleClass="dropdown">
    <f:selectItems value="#{test.deviceTypes}" />
    <ajax:support action="#{test.loadDevice}" event="onchange" reRender="t2,t3,t4,t5"/>
    </h:selectOneMenu>
    It is uses managed bean called TestBean.java:
    public class TestBean {
    public List getDeviceTypes(){
         logger.info(" *** In getDeviceTypes Backing Bean*** ");
         List<SelectItem> models = new ArrayList<SelectItem>();
         List<SelectItem> deviceTypes = new ArrayList<SelectItem>();
    // Gets Data from Hibernate Query . It returns List of Device Types
         models = deviceManager.getDeviceTypes();
         logger.info(" *** DeviceType List Size=*** "+models.size());
         for (Iterator it = models.iterator(); it.hasNext();) {
              System.out.println("Inside For Loop Iterator size="+models.size());
              Object[] row = (Object[]) it.next();
         System.out.println("ID: " + row[0]); // prints data
         System.out.println("Name: " + row[1]); //prints data
    // Below line results in error : does not have a Converter
         deviceTypes.add(new SelectItem(row[0],row[1]+""));
              return deviceTypes;
    During page rendering, page.jsp throws following exception:
    javax.servlet.ServletException: Value is no String and component _id0:deviceTypeList does not have a Converter
    Is this bug with MyFaces 1.1.1 or I have made something wrong?
    I am a newbie & didnt know much about Converters hence read some examples from the web saying to have getObject() & getString methods . So i added below Class but not sure how to align with page.jsp page.
    public class DeviceTypeConverter implements Converter{
         protected final Log logger = LogFactory.getLog(getClass());
         public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) throws ConverterException {
                   DeviceDao dao = new DeviceDao();
                   return dao.getdeviceTypes().(Long.decode(s));
                   public String getAsString(FacesContext facesContext, UIComponent
                   uiComponent, Object o) throws ConverterException {
                   if(o!= null)
                   logger.debug(o.toString());
                   try {
                   if((o!= null) && (o instanceof DeviceType)){
                   DeviceType dt = (DeviceType) o;
                   return ""+dt.getId();
                   else
                   return "0";
                   } catch (Exception e) {
                   logger.error(e);
                   throw new ConverterException();
    Any pointers/suggestions on how to write a Converter & help in resolving the error will be highly appreciated
    Regards
    Bansi

    Glad you found a way to make it work. I've got some ideas on improving this, as it is a little hacked together right now.
    But first things first...
    Does the models ArrayList really contain SelectItem
    objects??? If so, why would you bother transfering
    each SelectItem if it's already built.The models ArrayList doesnt contain SelectItems objects. It stores List of
    DeviceType objects retrieved from Database via Spring business layer i.e.
    models = deviceManager.getDeviceTypes() Then this line of code is wrong.
        List<SelectItem> models = new ArrayList<SelectItem>();You are not creating a list of SelectItem objects. You are creating a list of DeviceType objects. It should be:
        List<DeviceType> models = new ArrayList<DeviceType>();
    What are the objects represented by row[0] and
    row[1]?As models ArrayList contains Array of Objects i.e. multiple records (or
    rows) i am using Object[] row to store the values. That means row[0] &
    row[1] will contain column values for e.g. row[0] contains id values viz. 1,2,3
    etc
    What object does setSelectedDevice expect to
    receive?setSelectedDevice sets the selected Device id value submitted from JSF
    page into Backing BeanThis isn't what I was asking. I just want to know the java type object represented by row[0], row[1], and the java type object passed into setSelectedDevice. e.g: String, Integer, DeviceType, etc, or perhaps even the java primitive (int, char, boolean, etc...) if that's the case.
    These two questions are related and important. The java object represented by row[0] needs to be the java object passed into the setSelectedDevice. Actually, just by looking at your code, I can tell you the setSelectedDevice requires a String argument. My bet is that row[0] is not a String.
    As a side note... You shouldn't be making DB calls
    from your bean getters or setters. DB calls can mean
    a performance hit, and JSF will call the getters and
    setters multiple times per page request (which means
    you'll be doing multiple DB calls).... i started working on JSF-Spring-Hibernate project i always asked the
    question on Best Practices and i totally agree with your point. Hence i use
    Spring in the middle layer therefore i always call my Managers from
    Backing Bean for e.g. TestBean calls deviceManager for
    save,update,delete, getDeviceTypes,getDeviceTypes(String id)
    Also i have a question for you on the best practice. What should be the
    arguments to these save, update methods.
    Do you think it should be individual field values as specified in backing
    bean or should it be an objectUmm, I don't know. I'm sorry, I won't be much help to you here. I have not worked with Spring or Hibernate (yet). I can't advise you on those technologies (or how JSF would interface best with them).
    Check out this topic and you might be able to glean some useful information from it.
    http://forum.java.sun.com/thread.jspa?threadID=784351
    Hope I've been of some help!
    CowKing

  • JSF value change Simple problem

    I am having a small difficulty understanding which approach should be used to initialize data in JSF.
    Take this simple example:
    There is a drop down with 2 items: 1, 2
            <h:selectOneMenu value="#{bean.value}"
              valueChangeListener="#{bean.change}" onchange="submit()">
              <f:selectItem itemLabel="1" itemValue="1"/>
              <f:selectItem itemLabel="2" itemValue="1"/>
            </h:selectOneMenu>Now, when page loads, it really shows the second value of the drop down selected.
    But, when I simply add a "valueChangeListener" method, I can see that there is a problem:
      public void change(ValueChangeEvent event)
        System.out.println("I was here");
      }Whenever switching from value: 1 to: value: 2, the event is not activate. Since I was setting each time the constructor is built, the value "manually".
    The problem gets much deeper when, for exmaple, I would like to show a table that changes according to several filters. Initially the data is loaded on the constructor. But when filter changes, the data should be reloaded. So I load it twice: Once in the constructor, then I have to rebuild data in the event itself.
    Am I missing here something ? Or the JSF mechanism is missing somthing ... ;-)

    It's beacuse its ValueChangeListener :) no a "LabelChangeListener".
    Value for those two items should be different :)
    Itemlabel is what you see in combobox, and itemValue is real value for item.
    If you change your code to :
    <f:selectItem itemLabel="1" itemValue="1"/>
    <f:selectItem itemLabel="2" itemValue="2"/>it will work :)
    Martin

  • JSF Hello World trivial problem

    Hi,
    I followed http://otn.oracle.com/oramag/oracle/04-jul/o44dev_ojdev.html "Developing faces" article and can't quite get the simpliest JSF app to work.
    I keep getting a 404 error when requesting index.jsp, which simply redirects to /faces/HelloFaces.jsp
    My web.xml looks OK (see below). In fact, I double-checked all the instuctions in the article.
    Another problem I saw is that, when I tried "Importing sample JSF apps" the article mentions jsf-cardemo.war which is cannot find in my jdev1013 directory.
    Thanks, regards,
    Pawel
    <?xml version = '1.0' encoding = 'windows-1250'?>
    <web-app 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" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    </web-app>

    Ok I answered my own question. New Dreamweaver extensions are
    available for download. That fixed it up.

  • JSF & Tomcat 5 session problems

    I am implemeting a web application using JSF and tomcat authentication. The problem is that tomcat is losing the session when I hit refresh on any of the pages which are marked as havign a security constraint.
    e.g. you go to index.html -> takes you to login.jsp (as you need to log in first), you log in successfuly and go to index.html, you hit refresh and get taken back to login.jsp.
    Any help would be much appreciated.
    If anyone has implementign an app using tomcat authentication and jsf, I would be grateful if they could tell me how they are managing to overcome this issue.

    I have a similar question, but not about session timeout, but managing the data within your session. In our previous homegrown JSP Model 2 Framework, we had various methods in place to cleanup the session for a page (essentially allowing you to cleanup the managed beans after you were done with a page). Due to constant activity, the sessions never timeout, but there is "dead" data in the session. How would you do this in JSF? For example, lets say you go through a wizard set of screens, where once complete, you don't want the managed beans to exist in the session anymore. Where would you tap into the JSF lifecycle to do this?
    Thanks in advance,
    Dave

  • JSF page 'Initial load' problem

    I've found several threads touching on this already, but none seem to have a solution.
    When JSF loads a JSP page for the first time, it goes through the restore view phase which creates an initial view (as there isn't a current one to restore). It then goes directly to the render response phase.
    My problem is, I have a JSP/JSF page that I pass paramaters to via html GET. For example:
    http://localhost:8080/jsf/region.jsp?locationForm:directorate=1&locationForm=locationForm
    Because the first load goes directly to the render response phase, the parsing of these paramaters is never done & the page does not update as expected.
    The second time you perform the same request, JSF goes through the standard request processing lifecycle and works as you would expect, setting directorate to 1 in the backing bean and displaying an updated page.
    Is there any way to change JSF's default behaviour on a JSP initial load to do the whole lifecycle? Is there another way to get around this, short of loading the page twice to ensure it has the right information in it (which would be quite a hack)?
    I need to use html GET (as opposed to html POST) because:
    I'm using a technique of a hidden iframe that loads dynamically created javascript to update a dropdown list (DDL) on the main page without reloading the page in its entirity. This is to minimise network chatter as the system will be run on a 56k network. I have an onchange event on my JSF DDL that calls javascript to reload the hidden iframe.

    Thanks for the replies.
    I tried both of the suggested options
    1. If your bean is managed (declared as managed bean in faces_config), you can set the initial value of the property as, for example, #{param.locationFor }.
    Unfortunately I can't use this option as the backing bean i'm using has to be session scope. This is because the DDL options are set by the iframe page, not the main page. There could be many request/responses between client/server before the user finally presses the submit button. If I change the backing bean to request scope, I end up getting "Validation Error: Value is not valid" for the DDL because the selected ID is not in the backing bean's list of possible values for the DDL.. #{param} can't be used for session level BBs.
    2. If you don't want to use the managed bean properties, you can go get your parameters in your bean's constructor.
    I'm unable to use this option either. The backing bean is shared between the main page and the hidden iframe page. When the main page loads, the backing bean's constructor is called but that isn't the time when parameters need to be parsed. When the iframe page is loaded for the first time (via javascript onchange on a DDL on the main page) using http://localhost/iframe.jsf?iframeForm:ddlId=1&iframeForm=iframeForm is when I need to parse the parameters, by which time the backing bean is already instanciated and the constructor has already been called.
    I'm looking at where else I could get the parameters other than the constructor. I might be able to do it elsewhere.
    My guess as to why the following code works is it's not using a backing bean & isn't updating backing bean values on the first run:
    <f:view>
    <h:outputText value="param= #{param}"/>
    </f:view>To replicate the problem, create a simple backing bean, for example:
    public class sample {
        private Integer selectedId
        public String getSelectedId() {
            return selectedId
        public void setSelectedId(Integer selectedId) {
            this.selectedId = selectedId;
    }Then create the following sample.jsp:
    <!doctype html public "-//w3c//dtd html 4.01 transitional//en">
    <!--
      Copyright 2004 ArcMind, Inc. All Rights Reserved.
    -->
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
    <head>
    <f:view>
      <h:form id="iframeForm">
        <h:panelGroup>
          <h:inputText id="selectedId" value="#{sample.selectedId}" />
        </h:panelGroup>
      </h:form>
    </f:view>
    </head>
    </html>Then try going to sample.jsp?iframeForm:selectedId=10&iframeForm=iframeForm (Similar to the request my main page is doing via javascript to populate the hidden iframe)
    The first time you do this, the text box will be populated with 0 (ie, it skipped the JSF lifecycle and ignored your 10 input). The second time and subsequent times it works as expected, with the text box containing the number 10.

  • Visual Web JSF Portlet Upload file Problem in Websynergy

    Hello,
    I am using Websynergy milestone 3 release. I have tried to build AS A PORTLET the sample code, "Uploading Files in NetBeans Visual Web JSF Applications" (http://www.netbeans.org/kb/60/web/intro.html) using netbeans 6.5. The solution deploys successfully but unfortunately, the file Upload control does not work in the websynergy portlet environment. No file seems to be uploaded. The same code works very well in non-portlet environment. Is there a work-around for the Portlet environment?
    Looking forward to some help!
    Pius

    Hello,
    I am using Websynergy milestone 3 release. I have tried to build AS A PORTLET the sample code, "Uploading Files in NetBeans Visual Web JSF Applications" (http://www.netbeans.org/kb/60/web/intro.html) using netbeans 6.5. The solution deploys successfully but unfortunately, the file Upload control does not work in the websynergy portlet environment. No file seems to be uploaded. The same code works very well in non-portlet environment. Is there a work-around for the Portlet environment?
    Looking forward to some help!
    Pius

  • JSF in a portlet problem

    I have a page with a dropdown JSF element in it. I have tried doing this two ways. The first way in a JSF Web Application, the second in a portlet.
    I have a valuechangelistener on the dropdown and I call submit() in onChange. The goal is to process some stuff and add it to another dropdown on the page when it is refreshed. In the JSF Web Application the dropdown is submitted and the value is still selected upon refresh and everything looks good. (The new stuff is there)
    However, when the page refreshes in the portlet it goes back to its default value and I don't get my changes. I see the the query to get the new stuff is being run put the page goes back to its defaults. It seems like the page is getting refreshed twice in the portlet situation and everything I want is getting cleared out. I see that the intialize of the JSF Page java class is getting called there twice in the logs for the portlet situation but onece for the JSF Web Applicaion.

    Hello Edmund,
    The "jsf-naming" tag library you are importing is from the WLP "native" JSF 1.1 portlet bridge, which uses an entirely different way to render JSF as portlets than the new JSR329 JSF 1.2 to Java Portlet 2.0 bridge that you are using (the "GenericFacesPortlet"). Unfortunately, the jsf-naming tags are not compatible with the JSR329 bridge.
    I'm not a JSF expert, so unfortunately I can't suggest an equivalent way of doing what you want to do, but I am sure it is possible. Hopefully someone else on here with JSF expertise can help you out.
    Kevin

  • JSF+tiles+newbie = navigation problem.

    Hi all,
    I've got two pages: test.jsp, filter.jsp.
    I've got JSF forms on both of them.
    Code for the form is:
    <f:view>
    <h:form>
    <p>
    Riigi id: <h:inputText value="#{backing_test.id}"/>
    </p>
    <p>
    Kood: <h:inputText value="#{backing_test.kood}"/>
    </p>
    <p>
    <h:commandLink action="#{backing_test.goFilter}" value="action" />
    <h:commandButton value="push me" action="#{backing_test.goFilter}"/>
    </p>
    </h:form>
    </f:view>
    The idea was that I enter data into form, push the button and I'm forwarded to page with database info, selected according to parameters I've entered into form.
    Everything works fine until I uncomment
    <definition name="/test.tiles" extends="layout">
    <put name="body" value="/test.jsp"/>
    </definition>
    <definition name="/filtered.tiles" extends="layout">
    <put name="body" value="/filtered.jsp"/>
    </definition>
    in tiles.xml
    I haven't used tiles at all before, I can't understand - where is the error?
    May such data filter can be implemented in different way?

    This probably won't help much but it will reduce the amount of things you need to check to see what's going wrong.
    Remove the following from faces-config.xml:
    <navigation-case>
    <from-outcome>failure</from-outcome>
    <to-view-id>/test.jsp</to-view-id>
    </navigation-case>
    Then in your action return null during failure. Returning null means use the same page.

  • JSF h:selectManyCheckbox rendering problem

    Hi All,
    I would like to appreciate for your previous valuable suggestions. Currently i am working on a requirement "Clear All" functionality which should clear any previously selected checkboxes.
    My requirement is as below.
    I have a Infragistics gridView component (ig:gridView) in which we will display a group of records. Each record will have a property "availableCrossSellOptions" which is basically a group of checkboxes.
    <ig:column>
    <h:selectManyCheckbox id="cs" value="#{DATA_ROW.crossSellOptions}">
         <f:selectItems id="crossSellList1" value="#{DATA_ROW.availableCrossSellOptions}" />
    </h:selectManyCheckbox>
    <ig:column>
    Now the problem is when user clicks on "Clear All" button , nothing happens and the checkboxes still remain as checked.
    Any help will be highly appreciated. Thanks in advance.

    Hi BalusC,
    I fixed the issue. I forgot to refresh the Grid once i made changes to the checkboxes in the backing bean. So its working fine now. Thanks for your earlier response. I will explain in detail for further issues.

  • JSF with JavaScript ! Problem with OnLoad()

    Hello,
    I have a .js (javascript) file which has one function. I want to call this function in my jsf-jsp page form.
    The javascript run successfully without onload. But when i use onlod it is giving me error like "
    com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: /Webcam.jsp(11,109) Attribute onload invalid for tag body according to TLD
    1. How can i use the onload event with forms or body with jsf ?
    After this, i want to use some if else code with my jsp page. Normally we do this using scriptlets in jsp. So how can i do this on the jsf-jsp. Should i use backing bean to write the same code ?
    Actually i want to invoke different applications based on coditions on the return of my javascrit function.
    Can anybody has tips, solution on this ?
    -Sachin
    EpiComm Technologies Ltd.

    BalusC,
    If we want to set focus to a particular element, then
    this won't work.
    If runScript() function is referring to any form
    element we get an error stating that
    "document..forms.formname.elements is null.
    any ideas how to set focus when the form loads?Then put the script in the bottom of the JSF code, straight before the end body tag. At this place all JSF components are finished with generating.
    <html>
        <head>
        </head>
        <body>
            <f:verbatim>
                <script>
                    setFocus('</f:verbatim><h:outputText value="#{myBean.focusId}" /><f:verbatim>');
                </script>
            </f:verbatim>
        </body>
    </html>

  • JSF: output textfield rendered problem

    Hi!
    In JSF 1.1, in my page when I click the radio button with valuechangelistener brings to the page a text field (rendered = true / false).
    When I give a value to the text field the value doesn�t go the backing bean field when I go to the next page.
    How I can get the value from the output textfield to bean?
    Thanks!
    SpalGuru

    I am not surprised by this behavior. During the Restore View phase, the rendered attribute is re-resolved and may be false when before it was true. When this happens the event for the button is not registered.
    I can't speak to whether or not this is a bug, but it appears to be the as designed behavior. If you think it is a bug, pursue it with the vendor of the JSF implementation you are using.

Maybe you are looking for

  • Memory on a nokia 6234

    Could someone give me some advice on the memory on nokia 6234 as my phone does not have much memory on ot even though i have saved everything to the memory card which is less than half full???

  • LOGS PROVIDER HAS STOPPED ,WHAT DO I DO TO FIX PROBLEM?

    GALAXY S4  -"LOGS PROVIDER HAS STOPPED .HOW DO I FIX PROBLEM?

  • Fm for export to DMS

    Hello, What is the function module for exporting data into a doc file saved to DSM ? Thanks

  • Return by Reference/Return by Value

    Okay. I am suppose to create this accessor method that is not suppose to return by reference so as to protect the private variables. Firstly, I suppose for primitive data type I can : public int rtnInt() { int i = 0; int j; int j = i;//Primitive type

  • Palm Desktop software for Mountain Lion

    I just upgraded to Mountain Lion and my Palm Desktop software will not work.  I've searched but have not found an update.  Anyone know where I might find one?  Thanks!