I will try to summarize as best as I can.
Option 1: Go with SPA (Singe-page Application). You may add another JavaScript framework on to top of jQuery to make your life easier. More information on: http://en.wikipedia.org/wiki/Single-page_application
Option 2: You can create your own JavaScript MVC Framework using jQuery (or whatever is available in the market).
Notice that after deciding between Option1 and Option2 you will have two layers: Presentation Layer + Business Layer.
Finally, you can make Ajax calls to your Web Service and control any redirect or display behaviour from the presentation layer. In conclusion, your presentation is totally independent from your business layer.
Let's see if I can illustrate an example:
This would be part of our login.html
<script type="text/javascript">
$(document).ready(function(){
$("#singInButton").click(function{
var parameters = {SignIn:{username:"userNameFromField", password:"passwordFromField"}};
$.post("signin", parameters, function(data, status){
if(data.message === "SUCCESS") {
alert("Welcome back.");
}else{
alert("Invalid credentials. Please, try again.");
}
});
});
});
</script>
Let's suppose this would generate a request like: {SignIn:{username:"userNameFromField", password:"passwordFromField"}}
On the server side it was verified that these are valid credentials. So, you would return something like (sorry, I'm not familiar with Struts, but I am sure you can figure it out):
response.setContentType("application/json");
response.setResponseBody("SUCCESS");
Finally, the user interface would alert "Welcome back.". You do not have to dispatch your response, just return what you want in the correct format. Of course, there are hundreds of frameworks to make life easier and convert json or xml objects into JavaObject so you do not have to parse strings manually.
I hope this example can clarify what I am trying to say.
Cheers,