This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF BackingBean organization

 
Anthony Taylor
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I seem to be a little confused about the ordering for a JSF Backing Bean. I know that I have the getters and the setters for the different methods that correspond to the different components on the page. Now the confusing part, if I am trying to incorporate ajax into the mix .. how or where do I add the code to perform the server-side processing for this Backing Bean. As an example, suppose I have a page connected to a backing bean. And lets suppose that I would like ajax to validate as the user typed information into the textbox component. As the request is sent to the "action" for this page .. I would imagine the logic for determining if an error occured and sending the appropriate message back to the user would have to go somewhere in the backing bean so it could get called. I know usually this logic would go into an event that is connected to a button or other component on the page, but this seems to be a little bit different for ajax based apps. Should this all occur in the constructor for the backing bean or is there another place this code should go? Any examples or code snippets would be greatly appreciated as I am thoroughly confused on this one.
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know nothing about this...but Apache has a Ajax Input Suggest box...source is as always open to all...you might want to check out their implementation..
 
rajani varma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using Ajax components in our jsf pages.
For Eg:

<h:selectOneMenu id="usage" value="#{registrationBean.usage}" styleClass="labelTextBlack" >
<f:selectItems value="#{registrationBean.usageList}"/>
<a4j:support event="onchange" action="#{registrationBean.changeUsage}" reRender="plateType,plateClass,expiration,issueYear1"></a4j:support>
</h:selectOneMenu>
<hutputText value="#{registrationBean.usage}" styleClass="labelTextBlack" rendered="#{!registrationBean.usageEditable}"></hutputText>

In the above example, we used the a4j:support component, to reRender only some particular fields in the page(to avoid submitting the whole page) and the action method, "changeUsage()" is defined in the backing bean.

Hope this is what you are looking for


Thanks
Rajani
 
rajani varma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can check this link for Ajax for JSF developer guide

https://ajax4jsf.dev.java.net/nonav/documentation/ajax-documentation/developerGuide.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!