Java Web框架 Aranea
Aranea 是一個 Java 的MVC 框架,提供一個通用簡單的方法來構建 Web 應用組件,以及可重用的業務邏輯和界面。
下面是一個登錄界面:
public class LoginWidget extends TemplateBaseWidget {
/* Widget we will create and attach to this widget. */
private FormWidget form;
protected void init() throws Exception {
/* Sets the view selector that will be used for rendering this widget.
* The path to real JSP file is determined by:
*
* StandardJspFilterService field jspPath (configured in aranea-conf.xml)
* + viewselector
* + ".jsp" */
setViewSelector("login");
/* Register a global proxying eventlistener - it receives all widget events and upon
* receiving event named "someEvent" proxies it to "handleEventSomeEvent" method
*
* This listener is added by default in super class and is only shown here for
* illustrative purposes. It can also be cleared and overridden when needed.
*/
addGlobalEventListener(new ProxyEventListener(this));
/* Create a new FormWidget with two self-described input fields. */
form = new FormWidget();
// Add the input fields. Arguments taken by addElement():
// String elementName, String labelId, Control control, Data data, boolean mandatory
form.addElement("username", "#User", new TextControl(), new StringData(), false);
form.addElement("password", "#Password", new TextControl(), new StringData(), false);
// attach created form to our widget.
addWidget("loginForm", form);
}
// event handlers
}
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!