|
Integrating JSF, Spring and Hibernate |
|
public boolean getExist(){
return exist;
}
public String checkUser() throws Exception
{
String status = “failure”;
HibernateSpringDAO dao =
(HibernateSpringDAO)
ServiceFinder.findBean(“SpringHibernateDao”);
if(dao.validateUser
(getUserName(),getPwd())!=null){
exist=false;
status = “success”;
}
exist=true;
return status;
}}
MessageFactory.java :
This java code is used to get the message
from message bundle of specific locale. This
class has been used in the Bean class to set
the appropriate message for different fields
when the defined condition doesn’t meet.
package net.roseindia.web.ui;
import net.roseindia.web.common.*;
import java.util.*;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
public class MessageFactory {
ResourceBundle bundle;
Locale locale;
public MessageFactory() {
locale =
FacesContext.getCurrentInstance().
getViewRoot().getLocale();
bundle = ResourceBundle.getBundle
(“net.roseindia.web.ui.messages”, locale);
}
public String getMessage(String key) {
return bundle.getString(key);
}} |
|
Creation of Properties File :
This is the file containing the messages strings
that are to be shown in different pages.
# Registration Page
errorPasswordConfirm=Passwords are not
same.
errorUserId=User ID can not be less than 4
characters.
errorUserName=User Name can not be less
than 4 characters.
errorPasswordLength=Password can not be
less than 6 characters.
errorEmail=Invalid Email Address.
already_registered_msg=User is already
registered.
# Messages.properties file of JSF
javax.faces.component.UIInput.REQUIRED=Cannot
be blank
Creating CSS :
body{
background-color:#fff2f2;
margin-left:0;
margin-right:0;
margin-top:0;
margin-bottom:0;
}
.top_bg{
background-image:url(../images/TOP_BG.gif);
background-repeat:repeat-x;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sansserif;
font-weight: bold;
font-size: 12px;
}
.style2 {
font-family: Verdana, Arial, Helvetica, sansserif;
font-size: 10px;
font-
}
|
|
|
Jan
2008 | Java Jazz Up | 67 |
|
|
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 |
|
|
|
|
|
|
|
|
|