Q:

Web front-end programming - Good way to make html pages dynamic

There is a web project use Java as backend & html5 as front-end.
In a single signin feature, there are several static html pages:

signin.html, get user info,
signin_confirm.html, tip signin succeed, and need check email to confirm signin,
signin_confirm_succeed.html, succeed to confirm,
signin_confirm_expired.html, tip when error click an expired confirm link,
signin_confirm_failed.html, failed to confirm, due to email not exists or confirm code not match,

Obviously, this is not a good approach, I want to reduce count of static html to 1 or 2 pages for this feature, and more features to be developed. 
What js library do you think is suitable to do that job?

A:

In a recent project I've used AngularJS, I came across the same question. What I've done then was using ui-router to simply add a main content-div into my html-file, which would provide me a 'include' like behaviour. For little addings, like <section>s or <div>s, I've used my own directives.
At the end you are able to provide external html templates through a directive into your main view, gathering up all together and setting up your final view - dynamically.
Here's a pretty neat example of how to use custom directives: http://www.ng-newsletter.com/posts/directives.html

