Implementing AJAX Components in the JWL Framework
- Create a new Java class ThreeStringsConcatenatorBean.java with three variables: text1, text2, text3.
- In ThreeStringsConcatenatorBean.java, generate getter and setter methods for the variables. Add a new getConcatenateThreeFields() method that will concatenate text1, text2, and text3 and return the result.
- Select ajaxRefreshSubmitExample.jsp. Under the Page Data view, select Faces Managed Beans → New → Faces Managed Bean.
- Register the ThreeStringsConcatenatorBean JavaBean in faces-config.xml.
- Map fields in the JavaBean with fields in the JSP page by dragging fields from the bean onto the page.
Click here for a larger image.
Figure 11: Create New Java Class—ThreeStringsConcatenatorBean.java
Listing 6: Implementation Of getConcatenateThreeFields() Method
public String getConcatenateThreeFields() { return text1 + text2 + text3; }
Figure 12: Create a New Faces Managed Bean
Click here for a larger image.
Figure 13: Register a New Faces Managed Bean
Click here for a larger image.
Figure 14: Map Bean Fields to Input Field on the Page
Page 4 of 6
This article was originally published on April 17, 2008