Building JSF application with Exadel IDE

«»

Model: JavaBeans.

As the MVC architecture mandates we got to implement our business logic and data model in separated layers composed of different JavaBean components. The easiest way to define a JSF managed bean is to select the Tree tab of Visual Editor of the faces-config.xml’s file and then click con the Add button. When the New Managed Bean wizard appears we fill it with the appropriate data as shown in Figure 5.

Figure 5.

In this example, we define a JavaBean with the following characteristics:

  • Scope: request
  • Class: javabeat.net.examples.User
  • Name: User

Make sure to check the Generate Source Code option; this way Exadel will generate the appropriate file for us (if it doesn’t exist). After you click the Finish button the managed bean were already included into the project.

Then we add the following properties for the JavaBean, by means of the Add button of the Property panel shown for the bean in the Visual Editor:

login java.lang.String
Password java.lang.String

The code should look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package javabeat.net.examples;
	/**
	 * @author marcelo.giorgi
	 *
	 */
	public class User {
		private java.lang.String login;
		private java.lang.String password;
		public User() {
		}
		public java.lang.String getLogin() {
			return login;
		}
		public void setLogin(java.lang.String login) {
			this.login = login;
		}
		public java.lang.String getPassword() {
			return password;
		}
		public void setPassword(java.lang.String password) {
			this.password = password;
		}
	}
email

«»

Comments

comments