Q: What does immediate="true" stands for?
=> When you use immediate=true, you bypass validation for e.g. mandatory fields.
Q: How do I rerender certain components/tables on a page?
=> Use AJAX reRender function. When calling reRender in AJAX components, make sure you enter a panel name and not a table name or anything else. In the example below, to rerender 2 panels use a ','.
Example:
<a4j: action="#{backingbean.retrieveSelectedData}" value="Show selected rows" rerender="selectedRowsPanel, allSelectionPanel">
<h:panelgroup id="selectedRowsPanel">
.....
</h:panelgroup>
<h:panelgroup id="allSelectionPanel">
.....
</h:panelgroup>
Q: How do I call a method in my backing bean, pass in parameter then return data to a page?
<h:commandLink immediate= "true" action= "#{backingBean.findProductByCategory}" value="Get product info">
<f:setPropertyActionListener target="#{backingBean.category}" value="#{category}"/>
</h:commandLink>
Backing bean:
public class ProductBean {
private cat;
public setCategory(Category category){
this.cat = category;
}
public String findProductByCategory( ){
....
}
}
Q: When the page is loaded, IE shows "Javascript runtime error" but not in firefox. What's wrong?
=> This maybe due to extra tags for example, form within form:
<h:form id="productInfo">
......
<h:form id="productForm">
....
</h:form>
......
</h:form>
Q: How do I call something like an onload( ) function that will be called once the page is loaded?
=> Here's a get around method:
Inside JSF: To be placed before your form/other code.
<h:inputHidden value="#{backingBean.resetValue}"/>
Inside backing bean: A string is returned as this is a getter. The value returned is not important, what we want is to run the codes to reset all values(for whatever reason)
public String getResetValue( ){
this.product = null;
...
return "";
}
Tuesday, May 5, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment