1

I am trying to invoke a Save method in a bean with Openfaces 3. While Firefox is not rendering the page, Internet Explorer does.

I'm currently using this code lines:

<o:commandLink value="Save" action="#{beanX.save}">
  <h:graphicImage url="/images/save_48.png" />
</o:commandLink>

but I was trying o:ajax as well:

<o:commandLink value="Save" action="#{beanX.save}">
  <h:graphicImage url="/images/save_48.png" />
  <o:ajax event="click" render="@none" />
</o:commandLink>

Any ideas?


I've found a way to deal with using standard JSF components. Any ideas how to solve this issue with o:commandLink?

Thomas
  • 8,357
  • 15
  • 45
  • 81
  • Which IE version? Any JS errors in the console? I don't do OpenFaces, but this sounds much like that there's a JS error and therefore the ajax stuff broke and thus JSF page degrades gracefully as ajaxless page. If this is the case, try upgrading OpenFaces. – BalusC May 25 '11 at 17:13
  • IE 6 and 8. No JS errors. However, I've found a way to deal with. Have a look at my own reply to this question. Thank you for your help. – Thomas May 25 '11 at 17:18

2 Answers2

1

You can use <f:ajax> and render attribute in jsf2.0

<h:form> 
      <h:inputText value="#{managedBean.val1}" > 
         <f:ajax event="keyup" render="result" listener="#{managedBean.someThingToDoListener}"/> 
      </h:inputText> 
      <h:inputText value="#{managedBean.val2}" > 
        <f:ajax event="keyup" render="result" listener="#{managedBean.someThingToDoListener}"/> 
      </h:inputText> 

      <h:outputText id="result" value="#{managedBean.result}"/>
</h:form>

@ManagedBean(name = "managedBean") 
public class Bean { 
   private String val1; // getter and setter 
   private String val2; // getter and setter 
   private String res; // getter and setter 
   ... 

   public void someThingToDoListener(AjaxBehaviorEvent event) { 
       //res = some processing
    }

}

Also See

Community
  • 1
  • 1
jmj
  • 237,923
  • 42
  • 401
  • 438
1

Thank you Jigar Joshi. You've given me the key hint. It works with this code lines:

<h:commandLink value="Save">
  <h:graphicImage url="/images/save_48.png" />
  <f:ajax event="click" render="@none" listener="#{beanX.save}" />
</h:commandLink>

I've been to this website before, I was not thinking in assuming that o:commandLink might not be able to handle this, might be a bug?

Using h:commandLink instead of o:commandLink and f:ajax with the listener attribute solved my problem.

Thomas
  • 8,357
  • 15
  • 45
  • 81