Java Web應用框架 WEB4J
WEB4J是一個Java Web應用框架,目標是讓使用者建立簡單,清晰和優雅的web應用。該框架同時也提供一個開發者工具來協助開發人員創建基于 WEB4J的 應用程序。
下面是一個 WEB4J 的Action類源碼:
package hirondelle.electricity.main.report;
import hirondelle.electricity.util.TemplatedPage;
import hirondelle.web4j.model.AppException;
import hirondelle.web4j.action.ActionImpl;
import hirondelle.web4j.request.RequestParser;
import hirondelle.web4j.action.ResponsePage;
import hirondelle.web4j.database.SqlId;
public class ReportAction extends ActionImpl {
public static final SqlId LIST_HIGH_SPENDING = new SqlId("LIST_HIGH_SPENDING");
public ReportAction(RequestParser aRequestParser){
super(FORWARD, aRequestParser);
}
@Override public ResponsePage execute() throws AppException {
ReportDAO dao = new ReportDAO();
addToRequest(ITEMS_FOR_LISTING, dao.list());
return getResponsePage();
}
// PRIVATE //
private static final ResponsePage FORWARD = TemplatedPage.get(
"Example Report", "view.jsp", ReportAction.class
);
}
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!