|
Integrating JSF, Spring and Hibernate |
|
1g - 1 GB
</description>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter</filtername>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter</filtername>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servletname>
<servletclass>
javax.faces.webapp.FacesServlet</
servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servletname>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Creation of Beans :
Bean.java : This bean has been used for
registration page. This bean has properties
related to all the fields in the page and setter
and getter method corresponding to all the
properties. exist property has been used to
set true or false value to the “rendered” attribute
of the outputText tag responsible for presenting
the string “User is already registered”. If the
username is already present then the value for
exist property is set to “true”. dao object of
HibernateSpringDAO class is used to work with
the database.
package net.roseindia.web.ui;
import net.roseindia.web.common.*;
import net.roseindia.dao.*;
|
|
CheckValidUser.java
This bean has been used in the login page. All
the properties of the bean are related to the
fields of the login page. When the page is
submitted then checkUser() method is called
which checks the username and password. If
both are correct then the user is sent to the
next page which welcomes the user otherwise
message is displayed to the user in the same
login page. In this bean there is one exist
property which is set to true if username or
password doesn’t match with the database. So
this value is set to the “rendered” property of
the tag responsible for displaying the string
“User name or password is incorrect”.
package net.roseindia.web.ui;
import net.roseindia.web.common.*;
import net.roseindia.dao.*;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
public class CheckValidUser{
String userName;
String pwd;
boolean exist;
public void setUserName(String
userName){
this.userName=userName;
}
public void setPwd(String pwd){
this.pwd=pwd;
}
public void setExist(boolean exist){
this.exist=exist;
}
public String getUserName(){
return userName;
}
public String getPwd(){
return pwd;
}
|
|
Jan
2008 | Java Jazz Up | 66 |
|
|
View All Topics |
All Pages of this Issue |
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70 ,
71 ,
72 ,
73 ,
74 ,
75 ,
76 ,
77 ,
78 ,
79 ,
80 ,
81 ,
82 ,
83,
84 ,
85 ,
86,
87 ,
88,
89 ,
90 ,
91 ,
92 ,
93 ,
94 ,
95 ,
96 ,
97 ,
98 ,
99 ,
100 ,
101 ,
102 ,
103,
104 ,
105 ,
106,
107,
Download PDF |
|
|
|
|
|
|
|
|
|