当前位置: 软件>java软件
Web框架 Aranea
本文导语: Aranea 是一个 Java 的MVC 框架,提供一个通用简单的方法来构建 Web 应用组件,以及可重用的业务逻辑和界面。 下面是一个登录界面: public class LoginWidget extends TemplateBaseWidget { /* Widget we will create and attach to this widget. */ private FormW...
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
}