Apache Click is a lightweight Java web framework that uses a page-based model and supports common features like JSP, Freemarker, and Hibernate. It provides an easy and simple way to build web applications using Java objects for pages and request handling. Key elements include pages, controls, containers, configurations, and properties to internationalize and customize messages.
2. Easy & Simple to Learn
POJO Based Lightweight Framework
Event Based Programming model
Servlet Requests &Velocity for rendering the response
JSP, Freemarker, Spring, Hibernate Etc.. Support
Apache Click
3. No New Feature
Easy, Simple
Fast to Development
Auto Create HTML
Recommend for Prototyping, Management tools
Recommendation
6. public class SimplePage extends Page {
public SimplePage() {
addModel("time", new Date());
}
}
SimplePage.java
<html>
<body>
Time : $time
</body>
</html>
SimplePage.htm
Page
7. public class SimplePage extends Page {
public SimplePage() {
addModel("time", new Date());
}
}
SimplePage.java
public class SimplePage extends Page {
@Bindable protected Date time = new Date();
}
SimplePage.java
<html>
<body>
Time : $time
</body>
</html>
SimplePage.htm
Page -Velocity
8. public class SimplePage extends Page {
public SimplePage() {
getHeadElements().add(new JsImport("/static/js/simplepage.js"));
getHeadElements().add(new JsScript("alert('Welcome to SimplePage');"));
getHeadElements().add(new CssImport("/static/css/simplepage.css"));
getHeadElements().add(new CssStyle("body { font-family: Verdana; }"));
setStateful(true);
}
@Override
public void onInit() {
super.onInit();
}
@Override
public void onGet() {
super.onGet();
}
@Override
public void onPost() {
super.onPost();
}
@Override
public void onRender() {
super.onRender();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
ClickServlet.handleRequest()
Page.onInit()
in session?
Page.onGet() Page.onPost()
Page.onRender()
Page.onDistory()
new Page
setSession removeSession
get post
is stateful ?
HTTP Request
HTTP Response
SimplePage.java
Page -Velocity
30. field-maxlength-error={0} must be no longer than {1} characters
field-minlength-error={0} must be at least {1} characters
field-required-error=You must enter a value for {0}
file-required-error=You must enter a filename for {0}
label-required-prefix=
label-required-suffix=<span class="required">*</span>
label-not-required-prefix=
label-not-required-suffix=
not-checked-error=You must select {0}
number-maxvalue-error={0} must not be larger than {1}
number-minvalue-error={0} must not be smaller than {1}
select-error=You must select a value for {0}
table-first-label=First
table-first-title=Go to first page
table-previous-label=Prev
table-previous-title=Go to previous page
table-next-label=Next
table-next-title=Go to next page
table-last-label=Last
table-last-title=Go to last page
table-goto-title=Go to page
table-page-banner=<span class="pagebanner">{0} items found, displaying {1} to {2}.</span>
table-page-banner-nolinks=<span class="pagebanner-nolinks">{0} items found, displaying {1} to {2}.</span>
table-page-links=<span class="pagelinks">[{0}/{1}] {2} [{3}/{4}]</span>
table-page-links-nobanner=<span class="pagelinks-nobanner">[{0}/{1}] {2} [{3}/{4}]</span>
table-no-rows-found=No records found.
table-inline-first-image=/click/paging-first.gif
table-inline-first-disabled-image=/click/paging-first-disabled.gif
table-inline-previous-image=/click/paging-prev.gif
table-inline-previous-disabled-image=/click/paging-prev-disabled.gif
table-inline-next-image=/click/paging-next.gif
table-inline-next-disabled-image=/click/paging-next-disabled.gif
table-inline-last-image=/click/paging-last.gif
table-inline-last-disabled-image=/click/paging-last-disabled.gif
table-inline-page-links=Page {0} {1} {2} {3} {4}
production-error-message=<div id='errorReport' class='errorReport'>The application encountered an unexpected error. </div>
Message Properties
31. Page scope messages :
Global scope messages :
Control scope messages :
Global Control scope messages :
/package/Page.properties
/click-page.properties
/package/CustomControl.properties
/click-control.properties
Message Properties