Is JSF the only option?
The HTML front end uses JQuery as a front-end scripting framework.
Is JSF the only option?
The HTML front end uses JQuery as a front-end scripting framework.
You can use a number of technologies to interact with applications. If you want to stay on the Java side, JSF, JSP are two big ones. JSF Depends on a big framework, but there are other frameworks that rely just on JSP/Servlets. You can incorporate JQuery into the HTML/JSP/JSF combinations.
On the other hand you could just use JQuery to send AJAX calls to Servlets that return HTML/Json to the client. The JQuery can then do whatever you want with that.
For the new hotness hook your jQuery up to a Java JAX-RS backend using Jersey. Will work very well with jQuery AJAX.
For example, create a POJO like this:
@Path("/users")
public class UsersService {
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Users getUsers() {
return UserQuery.getUsers();
}
}
That says this "service" can provide the UserList in either XML or JSON. Which you can then access via jQuery like this:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>User List</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>User List</h1>
<div>
<ul id="userlist">
</ul>
</div>
</body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$.getJSON("service/users",
function(data){
$.each(data.users, function(i,user){
$("#userlist").append("<li>"+user.email+"</li>");
});
});
</script>
</html>
Simples.
Take a look at Spring Web MVC framework which is pretty much a standard for java web app development nowadays.
Check DWR - synopsis from the site:
DWR is a Java library that enables Java on the server and JavaScript in a browser to interact and call each other as simply as possible.