How to write simple code in jsf with XHTML
While writing code in jsf we are using
1.Xhtml front end design code.
2.Bean class in java.
1.Simply we are writing code as
Example :
<html>
<head>
< title>Test Jsf page<title>
</head>
<body>
Hello #{test.name}
<body>
</html>
Save with .xhtml extension
2.Java Bean Class
This class is nothing but reusable component class.It uses annotation(@) to provide additional information about class.
For above example :
@Name("test")
public class Test
{
private String name="Robot";
public void setName(String Name)
{
this.name=Name;
}
public String getName()
{
return name;
}
}
Here #{test.name} represents expression in JSF which maps front end value with java bean class.
1.Xhtml front end design code.
2.Bean class in java.
1.Simply we are writing code as
Example :
<html>
<head>
< title>Test Jsf page<title>
</head>
<body>
Hello #{test.name}
<body>
</html>
Save with .xhtml extension
2.Java Bean Class
This class is nothing but reusable component class.It uses annotation(@) to provide additional information about class.
For above example :
@Name("test")
public class Test
{
private String name="Robot";
public void setName(String Name)
{
this.name=Name;
}
public String getName()
{
return name;
}
}
Here #{test.name} represents expression in JSF which maps front end value with java bean class.

0 comments: