CommandButton doesn't work in JSF fragment?

Hi all,
Why commandButton doesn't work in JSF fragment? while I set partialSubmit as true!
As following:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:h="http://java.sun.com/jsf/html">
<af:inputText label="Your Name" id="it1"/>
<af:inputDate label="BirthDate" id="id1"/>
<af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"/>
<af:outputText id="ot1"/>
</jsp:root>
Thanks in advance :)))

The full jsff code is:
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:h="http://java.sun.com/jsf/html">
<af:inputText label="Your Name" id="it1" binding="#{fragment_bean.it1}"/>
<af:inputDate label="BirthDate" id="id1" binding="#{fragment_bean.id1}"/>
<af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"
binding="#{fragment_bean.cb1}"
action="#{fragment_bean.cb1_action}"/>
<af:outputText id="ot1" partialTriggers="cb1" value="test"
binding="#{fragment_bean.ot1}"/>
<!--oracle-jdev-comment:auto-binding-backing-bean-name:fragment_bean-->
</jsp:root>
Java Bean is generated using "Auto Bind" feature in Jdeveloper 11.1.1.3.0:
public class fragment_bean {
private RichOutputText ot1;
private RichCommandButton cb1;
private RichInputDate id1;
private RichInputText it1;
public fragment_bean() {
public void setOt1(RichOutputText ot1) {
this.ot1 = ot1;
public RichOutputText getOt1() {
return ot1;
public void setCb1(RichCommandButton cb1) {
this.cb1 = cb1;
public RichCommandButton getCb1() {
return cb1;
public void setId1(RichInputDate id1) {
this.id1 = id1;
public RichInputDate getId1() {
return id1;
public void setIt1(RichInputText it1) {
this.it1 = it1;
public RichInputText getIt1() {
return it1;
public String cb1_action() {
// Add event code here...
System.out.println("Hi test !!!");
return null;
}

Similar Messages

  • Jsp:include doesn't work in JSF (Trinidad)

    Hallo,
    first: i'm a newbe in JSF - so sorry for stupid questions.
    I would like to include a page with some trinidad-tags in my jsf-page (into the body).
    But running the application the included page isn't shown. Looking to the generated html-code the included code is shown between the head- and body-tag -> not rendered as html-tag but still as trinidad-tags.
    I do not understand why :(
    I tried to integrate my jsp:inlcude with <f:subview> and also with <h:panelGroup> but without different results. Also I've tried to use <jsp:directive.include> but nothing different happens.
    Does anybody know what I'm doing wrong?
    Thanks for help

    The way I include another faces file is to use the following syntax:
    <body>
    <jsp:include page="/header.jsp"/>
    the header.jsp file is a file that contains JSF components, but its included using the jsp extension since you already within the mist of a request.
    And in the included file, you MUST have everything surround with a subview tag with an ID attribute...
    <f:subview id="headerView">
    </f:subView>
    And lastly, something to always remember...everything in your included page must be contained within JSF components. You cannot have straight html, it must be surrounded with verbatim tags. The reason being when the page is included, the components from the page are included into the main pages component tree. The HTML from those components is output and then any regular html markup in the page is output AFTER the components output.

  • Partial submit in a jsf fragment is not working

    Hi,
    i have a jsf page that is hosting a jsf fragment (using workflow), inside the jsf fragment i have a button that has partial submit = true, and an output text that has partial triggers pointing to the button.
    the button on the fragment page has a "set action listener" that update a variable in a managed bean.
    the output text on the fragment page is displaying the content of that variable (which the button is updating).
    the problem is that partial submit is not working and whenever the button is clicked and the value of the variable inside the managed bean is changed , it is not reflected in the output text.
    note that if you try to use this example in a normal JSF page it will work, so does anybody knows what is wrong.
    i'm using Jdeveloper 11.1.1.2
    ************************** source code of the jsf fragment page *********************************
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:f="http://java.sun.com/jsf/core">
    <af:commandButton text="commandButton 1" id="cb1" partialSubmit="true">
    <af:setActionListener from="#{not DepartmentInquiryBean.getterCriteriaPanelDisplayInd}"
    to="#{DepartmentInquiryBean.setterCriteriaPanelDisplayInd}"/>
    </af:commandButton>
    <af:outputText value="#{DepartmentInquiryBean.getterCriteriaPanelDisplayInd}" id="ot1"
    partialTriggers="cb1"/>
    </jsp:root>
    ************************** source code of the managed bean ************************************
    package Merch.Model;
    public class DepartmentInquiry {
    private boolean CriteriaPanelDisplayInd = true;
    public DepartmentInquiry() {
    public void setSetterCriteriaPanelDisplayInd(boolean p_CriteriaPanelDisplayInd) { 
    CriteriaPanelDisplayInd = p_CriteriaPanelDisplayInd;
    public boolean getGetterCriteriaPanelDisplayInd() {
    return CriteriaPanelDisplayInd;
    ********************************************************************************************

    Yes, try appending the region's id to the component inside that region.
    i.e.
    <af:outputText value="#{DepartmentInquiryBean.getterCriteriaPanelDisplayInd}" id="ot1"
    partialTriggers="r1:cb1"/>^ assuming 'r1' is your region's id.
    If your fragment is not inside a region...maybe try doing so.
    Also, see here:
    Referencing a component on a page fragment inside an <af:region>.
    Best of luck.
    Matthew.
    Edited by: Matthew Carrigy on 27/11/2009 10:42

  • Generated javascript by JSF doesn't works with IE

    Hi Everyone!!!
    I Have a big problem, the jaavascript code generated by JSF doesn't
    works using IE, I used a h:commanLink with actionListener to a funciton
    in the backing bean, and I use two f:params to send the parameter of an
    specific element to show its details, the problem is taht the
    javascript code generated shows an error: "
    'documents.forms.form.form:_idcl' is null or is not an object " or "
    'elements.idVar' is null or is not an object ". I'm not using MyFaces,
    or something similar because the application has a part built in
    ArcgisServer, and it 's not compatible with Myfaces, so I needed to use
    JSf only...
    Please I hope an answer, it has a big problem!!!
    it is the code of the jsp
    <code><h:commandLink actionListener="#{consultaEstadisticasMB.detalleEstadistica}">
    <f:param name="idVar" value="#{consultaEstadisticasMB.idColumna3}"/>
    <f:param name="idMun" value="#{registro[0]}" />
    <h:outputText title="#{consultaEstadisticasMB.columna3}" id="itColumna3" value="#{registro[2]}" />
    </h:commandLink>
    </code>

    Minor nit: MyFaces is JSF, an implementation at least, as is Mojarra, which I assume is what you mean. :)ye, MyFaces is an implementation... but at this time, we�re using "JSF 1.1.02 - Reference Implementation"...
    Now, I have noticed that is a problem of jsf implementation so i have tried to do the work in another way, usign outputLink, nad creating a new backing bean for the details page.. altough I'm having problems, this is what i'm trying to do:
    <h:outputLink value="/ConsultaEstadisticasGeo/detalleEstadisticas.jsf?idVar=#{consultaEstadisticasMB.idColumna3}">
              <h:outputText title="#{consultaEstadisticasMB.columna3}"id="itColumna3" value="#{registro[2]}" />
    </h:outputLink>but it shows me an error...
    GRAVE: Servlet.service() para servlet Faces Servlet lanz� excepci�n
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    And I don't kwon why. If you could help me, I would been so grateful

  • Changing form components by selectOneMenu - so easy, but doesn't work

    Hi,
    I have silly problem that makes me crazy: I have a little form and I want to change content of all components dependent on my choice made in selectOneMenu. But it doesn't work like it's supposed to in logical way. For instance I have a selectOneRadio component in which I want to display a proper radio marked dependent on my choice in selectOneMenu. So I am setting Radio's 'rodzaj' bean property (Integer) in the valueChangeListener (idZmWart) of Select element to the chosen value. Bean is updated, but no effect on the page at all, no matter of Select's choice. Am I completely misunderstanding JSF lifecycle (studied many times) or it's just a very stupid mistake?
    Code is below:
    code fragment in jsp page:
    <f:view>
      <h:form>
         <h:selectOneMenu id="wyborId" value="#{Backingbean.id}"
                       valueChangeListener="#{Backingbean.idZmWart}"
                       onchange="submit()">                                  
             <f:selectItems value="#{Backingbean.listaId}" />              
         </h:selectOneMenu>
        <h:selectOneRadio id="wyborRodzaj" value="#{Backingbean.rodzaj}"
                      valueChangeListener="#{Backingbean.rodzajZmWart}"
                      onchange="submit()">
             <f:selectItems value="#{Backingbean.listaRodzaj}"/> 
        </h:selectOneRadio>                              
       <h:commandButton value="button" action="#{Backingbean.button_action}" />                               
    </h:form>
    </f:view>Backingbean code:
    package com.jsf;
    import java.util.ArrayList;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    public class Backingbean {
       public Backingbean() {
       public String button_action()
          setRodzaj(getId());                
          return "success";
       private Integer id = new Integer(1);
       public Integer getId() {
          return id;
       public void setId(Integer id) {
          this.id = id;
       public void idZmWart(ValueChangeEvent ev) {
          if (ev.getNewValue() != null){
             Integer i = (Integer) ev.getNewValue();
             setRodzaj(i);          
       private ArrayList listaId = new ArrayList();
       public ArrayList getListaId() {     
          ArrayList tmpLista = new ArrayList();
          for (int j=1; j<5; j++) {
             Integer i = new Integer(j);           
             SelectItem si = new SelectItem(i, i.toString());           
             tmpLista.add(si);                    
          listaId = tmpLista;
          return listaId;
       public void setListaId(ArrayList listaId) {
          this.listaId = listaId;
       private Integer rodzaj = new Integer(1);
       public Integer getRodzaj() {
          return rodzaj;
       public void setRodzaj(Integer rodzaj) {
          this.rodzaj = rodzaj;
       private SelectItem[] listaRodzaj = {
          new SelectItem(new Integer(1), "przedmiot"), //value, label
          new SelectItem(new Integer(2), "pracownik"),     
          new SelectItem(new Integer(3), "strona"),     
          new SelectItem(new Integer(4), "menu"),     
       public SelectItem[] getListaRodzaj() {
          return listaRodzaj;     
       public void setListaRodzaj(SelectItem[] listaRodzaj) {
          this.listaRodzaj = listaRodzaj;
       public void rodzajZmWart(ValueChangeEvent ev) {
          if (ev.getNewValue() != null) {
             String sRodzaj = ev.getNewValue().toString();        
    }And fragment of faces-config.xml - in one of the many shapes I've tried
    <managed-bean>
       <managed-bean-name>Backingbean</managed-bean-name>
       <managed-bean-class>com.jsf.Backingbean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>listaId</managed-property>
    </managed-bean>
    <managed-bean>
       <managed-bean-name>listaId</managed-bean-name>
       <managed-bean-class>java.util.ArrayList</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>  
    </managed-bean>Thanks for any reply. Regards,
    savage82

    Yeh sorry the points are not linked so you either can do 1 or 2 or 3
    With 3)
    You would have to bind all the components that get updated by your value changed listeners to your backing bean (using the binding attribute)
    And in your value changed listeners you would call the .setValue() on the components whose variable values changed during the value changed code. When your finished you would call the .renderResponse(). The reason this works is that a straight call to .renderResposne() it seems JSF does something funny, it should call the getters() of your variables then use these values and call the .setValue() on your components. But it doesn�t so instead you call the .setValue() yourself. The problem is you have to update every component potentially allot of work
    point 2 is an easy solution
    from my blog
    public void changeMethod(ValueChangeEvent event)
    PhaseId phaseId = event.getPhaseId();
    String oldValue = (String) event.getOldValue();
    String newValue = (String) event.getNewValue();
    if (phaseId.equals(PhaseId.ANY_PHASE))
    event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
    event.queue();
    else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
    // do you method here
    }what this does the changeMethod will get called twice. First off it gets called when it is meant to during validation phase. So we catch this call in our if statment then we queue the value changed event until the update model phase. So then when the update model phase is called your value changed event will be fired again. Basically this just moves the value changed code after the setters are called. That way any changes you make to your component values in your value change code will not be overwritten by the setters.
    point 1)
    Sorry forgot to add you may need renderResponse() after navigation rule (should test this)
    using the navigation rule well i dont exactly understand why this works. But my educated guess is using a navigation rule forces jsf to recreate the view i.e. the component tree is lost so the values you change in your value changed listeners will be reflected in your components as the components get recreated with the changed variables values.
    So take the above code
    and replace // do you method here
    with whatever your value changed code would be
    This is possibly a bad solution not exactly sure the performance hit you would take on this one i have never noticed any problems with my system but never benched marked it either.

  • Why don't responseHeader's works in JSF Portlet

    Hi All,
    I have a JSF portlet where i want to save the contents of my Text area on the click of a button to a word document.(IBM Websphere portal) <h:inputTextarea id="text1" value="#{pc_TextAreaView.textAreaValue}" rows="10" cols="50" /> <h:commandButton id="save" value="Save As Word" action="#{pc_TextAreaView.SaveAsWord}"/> In my page bean i have written the follwoing code but the response.setHeader() doesn't seem to work.I am not getting any pop dialog and i cannot save my file.Please let me know what is wrong in this code snippet.How can i make it work in my portlet.
    public String SaveAsWord() {
      FacesContext context = FacesContext.getCurrentInstance();
      HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
      response.setContentType("application/vnd.ms-word");
         response.setHeader("Content-Disposition", "attachment; filename=myfile.doc");
         response.setHeader("Cache-Control", "no-cache");
         try{
         byte[] buf=new byte[4*1024];
         InputStream inStream=new ByteArrayInputStream(textAreaValue.getBytes());
         OutputStream outStream=response.getOutputStream();
         int sizeRead;
         while ( ( sizeRead=inStream.read(buf, 0, buf.length) ) != -1 )
           outStream.write(buf, 0, sizeRead);
         inStream.close();
         outStream.close();
         catch(IOException ex){
          ex.printStackTrace();
         return null;
      }Best Regards,
    Pallavi

    Hi ,
    I am working with jsf 1.2 and jasper 3.0.
    For this problem just try with "aFacesContext.responseComplete();" method. This will work!
    Here is my code for generating pdf file report.
    demoreport.jsp code:
    <h:commandLink immediate="true" actionListener="#{reportGenerator.generateReport}">
                                  <h:outputText value="Generate Report"/>
                             </h:commandLink>Here is bean method: (ReportGenerator.java)
    Note: Services is the user defined class for getting connection obj.
    public void generateReport(ActionEvent actionEvent)
                                       throws ClassNotFoundException, SQLException, IOException,JRException
              Connection connection;
              FacesContext aFacesContext = FacesContext.getCurrentInstance();
              HttpServletResponse response = (HttpServletResponse)aFacesContext.getExternalContext().getResponse();
              ServletContext context = (ServletContext)aFacesContext.getExternalContext().getContext();
              String reportFileName = context.getRealPath("/reports/DemoReport.jasper");
              System.out.println("reportFileName: "+ reportFileName);
              InputStream reportStream = aFacesContext.getExternalContext().getResourceAsStream("/reports/DemoReport.jasper");
              ServletOutputStream servletOutputStream = response.getOutputStream();
              //Class.forName("com.mysql.jdbc.Driver");
              connection = Services.getConnection(); //get the db connection.
              try{
              JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream, new HashMap(),connection);
              catch(JRException lJRException){
                   System.out.println("while run report");
                   lJRException.printStackTrace();
              //connection.close();
              response.setContentType("application/pdf");
              response.setHeader("Content-disposition","attachment; filename=DemoReport.pdf");
              servletOutputStream.flush();
              servletOutputStream.close();
              aFacesContext.responseComplete();
         }Regards,
    Nils

  • Dynamical HtmlDatTable - action Listeners still doesn't work

    HI everybody.
    i create HtmlDatTable with dynamic columns count. I bind methods for every component (commandButton) but all of them doesn't work!!! Please help? it take me a lot of time :-(
    some pice of my bean:
    public HtmlDataTable getDynamicDataTable()
    return null;
    * @param dynamicDataTable the dynamicDataTable to set
    public void setDynamicDataTable(HtmlDataTable dataTable)
    this.loadDataFromTable(this.getSelectedTableId()); // Reload to get most recent data.
    // First we remove columns from table
    dataTable.getChildren().clear();
    PlainDataModelCreator builder = new PlainDataModelCreator(this.getStructuresList());
    this.plainStructeresList = builder.deepToPlainDataConverter();
    // Get amount of columns.
         int columns = ((List) this.plainStructeresList.get(0)).size();
    // Set columns.
    for (int i = 0; i < columns; i++)
    // Set header (optional).
    UIOutput header = new UIOutput();
    header.setValue(this.headers);
    //UIOutput output = new UIOutput();
    UICommand comand = new UICommand();
    ValueBinding structureItem = FacesContext
    .getCurrentInstance()
    .getApplication()
    .createValueBinding("#{structureItem[" + i + "]}");
    comand.setValueBinding("value", structureItem);
    comand.setRendererType("javax.faces.Button");
    MethodBinding mbAction = FacesContext
                   .getCurrentInstance()
                        .getApplication()
                             .createMethodBinding("#{DynamicData.editRowAction}", null);
    comand.setAction(mbAction);
    comand.setTransient(true);
    // Set column.
    UIColumn column = new UIColumn();
    column.setHeader(header);
    column.getChildren().add(colimn)
    // Add column.
    dataTable.getChildren().add(column);
    this.dynamicDataTable = dataTable;
    public String editRowAction()
    String str = "editrow";
    return str;
    in my jsp i am use some code:
    <%@ page session="false" contentType="text/html;charset=utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
    <html>
         <body>
              <f:view>
                   <h:form>
                        <h:panelGroup id="body">
                             <%------------------------ Dynamic HtmlDatTable section ------------------------%>
                             <t:dataTable
                                  var="structureItem"
                                  id="dynamicData"
                                  value="#{DynamicData.plainStructeresList}"
                                  binding="#{DynamicData.dynamicDataTable}"
                                  style="summary"
                                  rowClasses="linkButton">
                             </t:dataTable>
                        </h:panelGroup>
                   </h:form>
              </f:view>
         </body>
    </html>
    all components are rendred, but any of actions by clicking on my button doesn't work , i am never entering in to editRowAction()
    what problem ? please help me

    See also:  http://forums.adobe.com/message/4662367#4662367
    -Noel

  • If statement doesn't work in JPanel

    Hi everybody.
    I'd like somebody tell me the reason why the "if" statement doesn't work in a Jpanel but works in a Japplet. I'm including the fragments of code that are relevant to the question.
    Thanks in advance.
    public class Applet_INVEN extends JApplet {
    jTabbedPane jTabbedPane1 = new JTabbedPane();
    Panel_1 p_1 = new Panel_1();
    JLabel jLabel1 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JButton jButton1 = new JButton();
    void jButton1_actionPerformed(ActionEvent e) {
    if (jTextField1.getText() != "0") //------Executes when the condition is true
    jLabel1.setText("bingo");
    public class Panel_1 extends JPanel {//------INSIDE a JPANEL
    JTextField jTextField1 = new JTextField();
    JTextField jTextField2 = new JTextField();
    JTextField jTextField3 = new JTextField();
    JButton jButton1 = new JButton();
    void jButton1_actionPerformed(ActionEvent e) {
    jTextField2.setText(jTextField1.getText()); //----Ever executes, of course!
    if(jTextField1.getText() != "0") //----Never executes, even when
    jTextField3.setText("ojo"); //----the condition is true!

    You shouldn't use the != operator to test equality of Objects. Use Object.equals() instead.
    if (jTextField1.getText() != "0")
    should be
    if ( ! jTextField1.getText().equals("0"))
    or better:
    if ( ! "0".equals(jTextField1.getText())) <-- avoids null pointer exception.

  • ActionListener not working in JSF

    Hi
    The use case for my application is as follows:-
    CommandToolbarButton - Clicked
    Quick Logic in Backing Bean using ActionListener / LaunchListener
    Popup Dialog opens up which has some data given by above code in Backing Bean
    For this my code in jspx is
    <af:toolbar>
    <af:commandToolbarButton immediate="true"
    icon="/ico_delete.gif"
    launchListener="#{TestBean.launchListener}" partialSubmit="true">
    <af:showPopupBehavior popupId="popupDialog"/>
    </af:commandToolbarButton>
    </af:toolbar>
    <!--Pop -->
    <af:popup id="popupDialog" contentDelivery="lazyUncached">
    <f:subview id="popupSubview">
    <jsp:include page="ShowPopup.jsff"/>
    </f:subview>
    </af:popup>
    and code in the TestBean is
    public void launchListener(LaunchEvent launchEvent) {
    System.out.println("TEST");
    // Add event code here...
    But, I am not able to invoke this Listener as I am getting the TEST message. I even tried the same thing by writing a ActionListener as
    public void actionListener(ActionEvent actionEvent) {
    System.out.println("TEST");
    // Add event code here...
    Even this is not working. I have also tried to use <af:commandImageLink> instead of commandToolbarButton, but it is still not working.
    Any help on this problem will be highly appreciated.

    Hi,
    I guess, I couldn't explain my problem clearly, so re-posting the code and the query.
    JSPX Page
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:form>
    <af:popup id="popupDialog">
    <af:dialog title="Test Dialog">
    <af:outputText value="TEST Dialog" />
    </af:dialog>
    </af:popup>
    <af:outputText value="test"/>
    <af:toolbar>
    <af:commandToolbarButton immediate="true" icon="/ico_delete.gif"
    launchListener="#{TestBean.launchListener}"
    partialSubmit="true"
    actionListener="#{TestBean.actionListener}">
    <af:showPopupBehavior popupId="popupDialog"/>
    </af:commandToolbarButton>
    </af:toolbar>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    Backing Bean
    public void actionListener(ActionEvent actionEvent) {
    System.out.println("actionListener called");
    // Add event code here...
    public void launchListener(LaunchEvent launchEvent) {
    System.out.println("launchListener called");
    // Add event code here...
    I want to execute some code in one of these listeners, so that I can display corresponding data in
    <af:popup id="popupDialog">
    <af:dialog title="Test Dialog">
    <af:outputText value="TEST Dialog" />
    </af:dialog>
    </af:popup>
    I have tried keeping only one Listeners(from actionListner and launcListener), but it doesn't work.
    Any help will be highly appreciated.

  • Nested UIData doesn't work with command broadcasting

    In November 2004 I submitted the bug report below, and I also reported it on this forum. Other than the automated acknowledgment, I have received no followup. The posting on this forum seems to have been deleted. I'm re-posting it here in case it can be of help to someone, as I've noticed others mentioning nested UIData problems.
    The JSF RI UIData caches its data model, which can cause problems if the UIData value references some row data in an outer UIData if two UIData are nested. The RI tries to compensate for this by removing the cached information during certain instances such as encoding and decoding. But the RI neglects to uncache during event broadcasting.
    When UIData iterates over its data set (during encoding or decoding, for instance), it iterates through the row index which, after loading the data model, places the correct variable in the request map. Because the data model is cached, the inner UIData would return an unpredictable data model---the data model from the last iteration, for instance, not the data model based upon the outer data model's current row.
    UIData compensates for this during encoding and decoding by checking to see if it is nested inside another UIData. For example, within UIData.processUpdates() you'll see:
    if (isNestedWithinUIData()) {
        model = null;
    }This allows a test case to render correctly the nested data set, and even allows a UICommand to queue an event when it is selected. However, UIData.broadcast() does not clear the cache, so by the time the event is actually broadcast, the data model for the row is still set at some other row.
    Adding the above code to UIData.broadcast() solves the problem.
    (I'm suspicious of this whole caching thing in UIData anyway---what if I construct my own UIData-like thing and nest a UIData inside it? How would I keep UIData from caching its data?)

    All right, I've found a solution; I'll post it for anyone in need. It's not particularly elegant but still functional.
    First of all I've created a .cmd file in the folder where is located the executable of my interest.
    In it, using notepad, I've written as following:
    start /affinity 8 FreeTrack.exe
    ping 1.1.1.1 -n 1 -w 2000 > nul
    wmic process where name="FreeTrack.exe" CALL setpriority 256
    Note that the /affinity command is optional and not required (however, I needed it). Replace "FreeTrack.exe" with the name of your executable.
    The ping part pings a fake IP once and then waits 2000 milliseconds (set a higher waiting time if this one doesn't work).
    The third line changes the priority for all the processes under the name of "FreeTrack.exe" to, in my case, realtime.
    Priority legend:
    Low: 64 Below Normal: 16384 Normal: 32 Above Normal: 32768 High: 128 Realtime: 256
    Since the command prompt window appears for 2 seconds and I don't like that, I've created a .vbs file in the same folder of the .cmd file and executable. This hides the cmd window.
    I've put the following into the .vbs file (edited with notepad):
    Set WshShell = CreateObject("WScript.Shell" )
    WshShell.Run chr(34) & "FreeTrack.cmd" & Chr(34), 0
    Set WshShell = Nothing
    Replace "FreeTrack.cmd" with your .cmd file name.
    I've then created a shortcut on the desktop to the .vbs file and changed the icon to the one of the executable.
    Surely this solution won't work if the program keeps reverting back its priority while running.

  • My Custom Converter Doesn't Work With DataModel

    Hi,
    I have this simple object with its custom converter taken from the Core JSF Book. It works fine, but when I put it in DataModel, somehow it didn't get updated. I don't put the whole codes here, only the important parts.
    Any1 knows what is the reason? I have been looking for an answer but I haven't found one. Plz help.
    public class CreditCard {
    private String number;
    public CreditCard(String number) { this.number = number; }
    public String toString() { return number; }
    public class CreditCardConverter implements Converter, Serializable {
    private String separator;
    public void setSeparator(String newValue) { separator = newValue; }
    public Object getAsObject(............);
    return new CreditCard(builder.toString());
    public String getAsString(..............)
    throws ConverterException {
    return result.toString();
    public class MyBackBean{
    private DataModel creditCardDataModel;
    private static final CreditCard[] ccs = {
    new CreditCard("1111 111 111 111"),
    new CreditCard("2222 222 222 222")
    public DataModel getCards(){
    if (creditCardDataModel == null) {
    creditCardDataModel = new ArrayDataModel(ccs);
    return creditCardDataModel;
    <h:dataTable value="#{myBackBean.cards}" var="card">
    <h:column>
    <h:inputText id="card" value="#{card}"/>
    </h:column>
    </h:dataTable>
    Edited by: JW77 on Dec 3, 2009 12:47 AM

    Please explain.
    What does "cellcom line doesn't work with my iPhone" mean?
    What are you trying?  What is happening?
    Where did you buy the iphone?
    Any info abnout your issue at all?

  • Clicking an element in a list doesn't work

    Sorry about my rather vague subject - my problem is not so easy to sum up in a few words.
    I am working on an application that
    - Displays a list of items from a MySQL table
    - Each item should be clickable, and on clicking should open an edit page with the clicked item pre-loaded
    This must have been done millions of times before and should be simple. It doesn't work, presumably because I know too little. This is what I have done:
    The clickable item list looks like this (without all the trimmings):
    <h:dataTable id="users" value="#{userlist.userList()}" var="ul">
    <h:commandLink action="#{ul.edituser}" value="#{ul.uid}"/>
    This displays a list of the right sort of items, but the clickable item (the UID) doesn't do anything. Also, the resulting html looks the same no matter what I put into the action element - this is the inside of the a-tag:
    href="#" onclick="mojarra.jsfcljs(document.getElementById('j_idt9'),{'j_idt9:users:1:j_idt15':'j_idt9:users:1:j_idt15'},'');return false"
    I'm not entirely sure what that means; all I know is that it does not call the edituser() method.
    But what is the right way, then? I haven't found any examples that highlight this particular situation although it must be used all the time, I expect.

    #{userlist.userList()
    #{ul.edituser}Spot the difference there. I do believe "ul" should be "userlist"; in other words it will link to an action method "edituser()" in a JSF managed bean which I assume will be named Userlist. Its really simple when you run into the problem of an action method not working: 99/100 times the action method EL declaration is wrong. Now it could be typo, but I've been known to forget the #{} part too...
    I use the JBoss Tools Eclipse plugin myself; it has nice JSF additions that add EL validation and autocompletion to the editor. That way I know already from the code view when I've made a mistake in stead of "at runtime". A missing action method turns up as a warning in the jsf editor for example. That is of course only helpful when you're actually using Eclipse ;)

  • F:viewParam doesn't work for me

    Hi All,
    I'm exploring the new stuff in JSF 2.0 and hitting some basic problem with f:viewParam tag, - it doesn't set the specified value (have been tried to deploy the war on JBossAS 6)
    Here is the war directory (exploded war and zipped) with single template and view : http://www.diligesoft.com/sales-ui.war.zip
    If anybody can tell me what's wrong it will be greatly appreciated.
    Thanks,
    Dmitry

    I know what the problem (or Bug in JSF?) now, in case anybody will hit it, here are the details
    Here is top level template.xhtml and f:viewParam inserted using ui:insert :
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:view contentType="text/html">
    <ui:insert name="metadata"/>
    </f:view>
    </html>
    the view (view.xhtml) is using this template specified above :
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    template="template.xhtml">
    <ui:define name="metadata">
    <ui:include src="metadata.xhtml"/>
    </ui:define>
    </ui:composition>
    the metadata.xhtml composition :
    <ui:composition xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:metadata>
    <f:viewParam name="id" value="#{customerBean.id}" />
    <f:event type="preRenderView" listener="#{customerBean.loadPersonProfile}"/>
    </f:metadata>
    </ui:composition>
    It doesn't work! The customerBean.loadPersonProfile() got called but customerBean.id is never set
    Looks like the ui:include can't be used for including f:metadata tag, so if you take f:metadata out of metadata.xhtml and put it into the view.xhtml ui:define section :
    <ui:define name="metadata">
    <f:metadata>
    <ui:include src="/sections/customer/metadata.xhtml"/>
    </f:metadata>
    </ui:define>
    It works, but don't put it into the template.xhtml :
    <f:view contentType="text/html">
    <f:metadata>
    <ui:insert name="metadata"/>
    </f:metadata>
    Doesn't work! Very confusing and looks like a Bug to me.
    Hope it will save somebody time.
    Dmitry.

  • @postconstruct doesn't work in managed bean

    Hi,
    I'm using JBOSS 6, JSF 2 and EJB 3.1, i have an ear with
    - EJB folder (@postconstruct is working)
    - JSF folder with manged bean where @postconstruct doesn't work
    This my manged bean :
    package com.galhauban.geriex;
    import java.util.ArrayList;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.ejb.EJB;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    import javax.servlet.ServletContext;
    import org.richfaces.event.ItemChangeEvent;
    @ManagedBean
    @ViewScoped
    public class AdministrationController {
    @EJB
    private VilleBean ville;
    private List<SelectItem> villes = new ArrayList<SelectItem>();
    private String commune;
    private String communeId;
    private String cp;
    private String labelListCommune;
    @EJB
    private BisBean bisBean;
    private String bis;
    private Integer bisId;
    private List<SelectItem> bisList = new ArrayList<SelectItem>();
    @EJB
    private RueBean rueBean;
    private String rue;
    private String rueId;
    private List<SelectItem> ruesList = new ArrayList<SelectItem>();
    //boolean desactives pour n'afficher que ce que l'on souhaite a partir du menu
    private boolean bCommune =false;
    private boolean bBis =false;
    private boolean bRue =false;
    private UIComponent selectedChild = null;
    //Pour connaitre l'item du menu actif
    private String selectedTab;
    private List<String> renderComponents = new ArrayList<String>();
    public AdministrationController(){
    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
    System.out.println("============================================================================");
    System.out.println("==================================CONSTRUCTEUR==============================");
    System.out.println("Servlet : "+servletContext.getEffectiveMajorVersion()+"."+servletContext.getMinorVersion());
    System.out.println("============================================================================");
    @PostConstruct
    public void postConstruct(){
    setSelectedTab("rue");
    System.out.println("###################################################");
    System.out.println(" POST CONSTRUCT MANAGED BEAN ");
    System.out.println("###################################################");
    JanusController multi = new JanusController();
    * AFFICHAGE DES MODIFS/SUP/AJOUT EN FONCTION DU MENU SELECTIONNE
    public void updateCurrent(ItemChangeEvent event){
    setSelectedTab(event.getNewItem().getId());
    System.out.println("====> SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    setbCommune(true);
    setbBis(false);
    setbRue(false);
    renderComponents.add("gCommune");
    else if (selectedTab.equals("bis")) {
    setbBis(true);
    setbCommune(false);
    setbRue(false);
    renderComponents.add("gBis");
    else if (selectedTab.equals("rue")) {
    setbRue(true);
    setbBis(false);
    setbCommune(false);
    renderComponents.add("gRue");
    else System.out.println("----> pas dans le if " + selectedTab.toString());
    public void ajouter(){
    System.out.println("====> AJOUTER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    System.out.println("ajouter commune ");
    ville.ajouter(commune, cp);
    else if (selectedTab.equals("bis")) {
    System.out.println("ajouter iBbis ");
    bisBean.ajouter(bis);
    else if (selectedTab.equals("rue")) {
    System.out.println("ajouter rue: "+commune);
    rueBean.ajouter(rue, Integer.parseInt(communeId));
    else System.out.println("----> pas dans le if de l'ajouter " + selectedTab.toString());
    public void modifier(){
    System.out.println("====> MODIFIER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    ville.modifier(Integer.parseInt(communeId), commune);
    else if (selectedTab.equals("bis")) {
    bisBean.modifier(bisId, bis);
    else if (selectedTab.equals("rue")) {
    rueBean.ajouter(rue, Integer.parseInt(communeId));
    else System.out.println("----> pas dans le if de modifier " + selectedTab.toString());
    public void supprimer(){
    System.out.println("====> SUPRIMER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    System.out.println("ajouter commune ");
    ville.ajouter(commune, cp);
    else if (selectedTab.equals("bis")) {
    System.out.println("supprimer iBbis ");
    bisBean.supprimer(bisId);
    else if (selectedTab.equals("rue")) {
    System.out.println("ajouter rue: "+commune);
    rueBean.ajouter(rue, villes.indexOf(ville));
    else System.out.println("----> pas dans le if de l'ajouter " + selectedTab.toString());
    * LISTENER
    public void selectListener(ValueChangeEvent vce){
    System.out.println("new value : "+vce.getNewValue());
    public void listAdminCommune(ValueChangeEvent vce){
    System.out.println("listener*************");
    ruesList.clear();
    ruesList = rueBean.listRue(Integer.parseInt(vce.getNewValue().toString()));
    * AUTRES FONCTIONS
    public boolean invbool(boolean vrai){
    if (vrai == true) return false;
    else return true;
    * GETTER AND SETTER
    Any help will be highly appreciated.
    Regards
    Couse1

    Hi,
    First of all thanks for your help.
    I've some problems to add a new mojarra version (2.1.2) to jboss 6
    1- I modified the file META-INF\jsf-integration-deployer-jboss-beans.xml
    <entry>
              <key>Mojarra-2.1.2</key>
              <value>${jboss.server.home.url}deployers/jsf.deployer/Mojarra-2.1.2</value>
    </entry>
    <bean name="JSFUrlIntegrationDeployer-212" class="org.jboss.jsf.deployer.JSFUrlIntegrationDeployer">
        <property name="JSFConfigName">
          <value>Mojarra-2.1.2</value>
        </property>
        <property name="JSFImplManagementDeployer">
          <inject bean="JSFImplManagementDeployer"/>
        </property>
      </bean>2- I added this code in my web.xml(war)
    <context-param> 
            <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name> 
            <param-value>Mojarra-2.1.2</param-value> 
          </context-param>3- And in the folder ...\deployers\jsf.deployer\Mojarra-2.1.2, i've got :
    - jsf-libs with jars
    - META-INF with web.xml
    I took the web.xml from Mojarra-2.0 :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">
       <!-- ======================== Introduction ============================== -->
       <!-- This document defines default values for the Mojarra-2.0 JSF config  -->
       <!--                                                                      -->
       <!-- WARNING:  Do not configure application-specific resources here!      -->
       <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->
       <!-- =========== Common Context Params ================================== -->
       <!-- Regular expression to determine if two different URLs actually point -->
       <!-- to the same jar file.  This keeps faces-config files from being      -->
       <!-- read twice.                                                          -->
       <context-param>
         <param-name>com.sun.faces.duplicateJARPattern</param-name>
         <param-value>^tmp\d+(\S*\.jar)</param-value>
       </context-param>
       <!-- JBossInjectionProvider provides resource injection for managed beans. -->
       <!-- See JSF 1.2 spec section 5.4 for details.                             -->
       <context-param>
         <param-name>com.sun.faces.injectionProvider</param-name>
         <param-value>org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider</param-value>
       </context-param>
       <!-- ================== Common filter Configuration ==================== -->
       <!-- ================== Common Listener Configuration ==================== -->
       <!-- Configures JSF 2.0 -->
       <listener>
         <listener-class>org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener</listener-class>
       </listener>
    </web-app>And of course i've got this error :
    org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener: java.lang.ClassNotFoundException: org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener
    I don't know where to find the listener-class, and in fact i don't know to configure this web.xml.
    Help or sugestion will be appreciated.
    Best regards
    couse1

  • Do some processing before loading jsf fragment created using adf task flow

    Hi,
    I am working on JDev11g.
    I want to create SelectItems of SelectOneChoice dynamically before loading jsf fragment created using adf task flow
    I tried by implementing RegionController class's method RefreshRegion in my backing bean of jsf page fragement to do some processing before loading region
    But it seems to be not feasible approach because it is getting called every time any component on fragement gets partially submitted.
    Is there any method which is called only first time when region is loaded ?
    Or any other solution to achieve this.
    Regards,
    Devang

    Hi,
    don't think so. You would need a phase listener, but I don't see how you get it in. Wha about using a dynamic region and then use the method that is called from the dynamic region first time it is rendered?
    Frank

Maybe you are looking for

  • IPod can be seen in iTunes but not charging

    I can view the iPod, sync music in Tunes but it doesn't fully charge. Any idea what the issue might be? Thanks in advance.

  • Error in Idoc to XML conversion

    Hi, I am doing Idoc to XML conversion using standard program RSEINB00. Can anyone plz tell me what are the pre-requisites to executing this program? I am getting an error message Port XXX segment defn YYYYY in IDoc type ZZZZZ CIM type do not exist. W

  • What is the best way to create a dot matrix effect

    Hi. I want to print something with a single solid (pantone) colour (not process), but I also want to give my simple graphic some shading. I have added some transparency to see the effect, but as far a printing the final product I need a solid single

  • Explain Plan across a DBLink

    We are using Oracle 8.1.7.2, but this problem seems pretty generic across most of the versions. The situation: We have several queries that access data in two different databases, across a dblink. These queries both do joins across the dblink, and al

  • How to add security for webservice invoke

    Hi All, Please let me know how to invoke the webservice in BPEL process with security details. Thanks, Suresh