Средства разработки web приложений (Web frameworks)

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

  • + guest20ccc1 guest20ccc1 2 years ago
    Очень интересная презентация!
Post a comment
Embed Video
Edit your comment Cancel

1 Group

Средства разработки web приложений (Web frameworks) - Presentation Transcript

  1. Средства разработки web приложений (Web frameworks) Малышкин Фёдор 2 ноября 2007
  2. Содержание
    • Введение
    • Основа архитектуры «тонких» клиентов
    • Средства разработки веб-приложений:
      • JSP
      • Struts
      • Spring
      • Tapestry
      • JSF
    • Сравнение
  3. Введение
    • Данная презентация познакомит Вас с существующими библиотеками разработки веб-приложений на языке Java.
    • Будут описаны основополагающие моменты, лежащие в их основе, приведены примеры их использования, описаны их преимущества и недостатки.
    • Так же будут описаны классические модели реализации «тонких» клиентов, коим веб-приложение и является.
  4. Основа архитектуры «тонких» клиентов
    • В качестве основы для всех клиентов, связанных с пользовательским вводом (не обязательно «тонких»), используется MVC (Model-View-Controller).
    • Эта архитектура разделяет приложение на:
      • Модель данных ( Model ) , занимающуюся хранением данных, обработкой данных (бизнес - логикой), а так же всем остальными «не визуальными» вещами.
      • Представление ( View ), занимающуюся отображением и представлением данных
      • Контроллер ( Controller ), занимающийся коммуникацией между данными и представлением.
    • В веб-приложениях данная модель называется « Model-2 » (что бы отделить от настольной реализации MVC ) и указать, на то что она является приемником « Model-1 » .
  5. Основа архитектуры «тонких» клиентов
  6. JSP (Краткая характеристика)
    • Положительные стороны:
      • ?
    • Отрицательные стороны:
      • ?
  7. JSP ( Жизненный цикл )
  8. Struts (Краткая характеристика)
    • Положительные стороны:
      • Много проектов реализованных с помощью данной библиотеки, подтверждает её стабильность и надёжность
      • Огромное количество примеров и документации
      • HTML библиотека тэгов одна из лучших
    • Отрицательные стороны:
      • Программирование «контроллера» - ActionForms – задача не из лёгких
      • Невозможно автономное тестирование
      • Ходят слухи, что проект «мёртв»
  9. Spring ( Краткая характеристика )
    • Положительные стороны:
      • Переопределение правил связки данных на форме и в приложении, правил навигации и проверки введённых значений
      • Прозрачная интеграция с многочисленными средствами представления данных: JSP/JSTL, Tiles, Velocity, FreeMaker, Excel, XSL, PDF.
      • Удобная среда для автономного тестирования
    • Отрицательные стороны:
      • Много XML (в области конфигурирования)
      • Требует большого количества кода в JSP
      • «Слишком» гибок
  10. Spring (Жизненный цикл GET)
  11. Spring (Жизненный цикл POST)
  12. «Контроллер» Spring
    • public class UserController implements Controller {
    • private final Log log = LogFactory.getLog(UserController.class);
    • private UserManager mgr = null;
    • public void setUserManager(UserManager userManager) {
    • this.mgr = userManager;
    • }
    • public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    • if (log.isDebugEnabled()) {
    • log.debug("entering 'handleRequest' method...");
    • }
    • return new ModelAndView("userList", "users", mgr.getUsers());
    • }
    • }
  13. «Контроллер» Spring
    • public class UserController implements Controller {
    • private final Log log = LogFactory.getLog(UserController.class);
    • private UserManager mgr = null;
    • public void setUserManager(UserManager userManager) {
    • this.mgr = userManager;
    • }
    • public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    • if (log.isDebugEnabled()) {
    • log.debug("entering 'handleRequest' method...");
    • }
    • return new ModelAndView("userList", "users", mgr.getUsers());
    • }
    • }
  14. Конфигурирование Spring
    • <bean id=&quot;userController&quot; class=&quot;org.appfuse.web.UserController&quot;>
    • <property name=&quot;userManager&quot; ref=&quot;userManager&quot;/>
    • </bean>
  15. Конфигурирование Spring
    • <bean id=&quot;userController&quot; class=&quot;org.appfuse.web.UserController&quot;>
    • <property name=&quot;userManager&quot; ref=&quot;userManager&quot;/>
    • </bean>
    • <bean id=&quot;viewResolver&quot;
    • class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;>
    • <property name=&quot;viewClass&quot; value=&quot;org.springframework.web.servlet.view.JstlView&quot;/>
    • <property name=&quot;prefix&quot; value=&quot;/&quot;/>
    • <property name=&quot;suffix&quot; value=&quot;.jsp&quot;/>
    • </bean>
  16. Конфигурирование Spring
    • <bean id=&quot;userController&quot; class=&quot;org.appfuse.web.UserController&quot;>
    • <property name=&quot;userManager&quot; ref=&quot;userManager&quot;/>
    • </bean>
    • <bean id=&quot;viewResolver&quot;
    • class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;>
    • <property name=&quot;viewClass&quot; value=&quot;org.springframework.web.servlet.view.JstlView&quot;/>
    • <property name=&quot;prefix&quot; value=&quot;/&quot;/>
    • <property name=&quot;suffix&quot; value=&quot;.jsp&quot;/>
    • </bean>
    • <bean id=&quot;urlMapping&quot;
    • class=&quot;org.springframework.web.servlet.handler.SimpleUrlHandlerMapping&quot;>
    • <property name=&quot;mappings&quot;>
    • <value>
    • /users.html=userController
    • </value>
    • </property>
    • </bean>
  17. JSP представление Spring
    • <form:form commandName=&quot;user&quot; method=&quot;post&quot;>
    • <form:errors path=&quot;*&quot; cssClass=&quot;error&quot;/>
    • <form:hidden path=&quot;id&quot; />
    • <table class=&quot;detail&quot;>
    • <tr>
    • <th><label for=&quot;firstName&quot;>
    • <fmt:message key=&quot;user.firstName&quot;/>:</label></th>
    • <td>
    • <form:input path=&quot;firstName&quot; id=&quot;firstName&quot;/>
    • <form:errors path=&quot;firstName&quot; cssClass=&quot;fieldError&quot;/>
    • </td>
    • </tr>
    • <tr>
    • <th><label for=&quot;lastName&quot; class=&quot;required&quot;>
    • * <fmt:message key=&quot;user.lastName&quot;/>:</label></th>
    • <td>
    • <form:input path=&quot;lastName&quot; id=&quot;firstName&quot;/>
    • <form:errors path=&quot;lastName&quot; cssClass=&quot;fieldError&quot;/>
    • </td>
    • </tr>
  18. JSP представление Spring
    • <form:form commandName=&quot;user&quot; method=&quot;post&quot;>
    • <form:errors path=&quot;*&quot; cssClass=&quot;error&quot;/>
    • <form:hidden path=&quot;id&quot; />
    • <table class=&quot;detail&quot;>
    • <tr>
    • <th><label for=&quot;firstName&quot;>
    • <fmt:message key=&quot;user.firstName&quot;/>:</label></th>
    • <td>
    • <form:input path=&quot;firstName&quot; id=&quot;firstName&quot;/>
    • <form:errors path=&quot;firstName&quot; cssClass=&quot;fieldError&quot;/>
    • </td>
    • </tr>
    • <tr>
    • <th><label for=&quot;lastName&quot; class=&quot;required&quot;>
    • * <fmt:message key=&quot;user.lastName&quot;/>:</label></th>
    • <td>
    • <form:input path=&quot;lastName&quot; id=&quot;firstName&quot;/>
    • <form:errors path=&quot;lastName&quot; cssClass=&quot;fieldError&quot;/>
    • </td>
    • </tr>
  19. Velocity представление Spring
    • <form method=&quot;post&quot; action=&quot;#springUrl('/editUser.html')&quot;>
    • #springFormHiddenInput(&quot;user.id&quot; '')
    • <table>
    • <tr>
    • <th><label for=&quot;firstName&quot;>#springMessage(&quot;user.firstName&quot;):</label></th>
    • <td>
    • #springFormInput(&quot;user.firstName&quot; 'id=&quot;firstName&quot;')
    • #springShowErrors(&quot;<br/>&quot; &quot;fieldError&quot;)
    • </td>
    • </tr>
    • <tr>
    • <th><label for=&quot;lastName&quot;>#springMessage(&quot;user.lastName&quot;):</label></th>
    • <td>
    • #springFormInput(&quot;user.lastName&quot; 'id=&quot;lastName&quot;')
    • #springShowErrors(&quot;<br/>&quot; &quot;fieldError&quot;)
    • </td>
    • </tr>
  20. Spring Web Flow
    • Инфраструктура позволяющая определять последовательность переходов между страницами
    • Определяется программно или через XML
    • Правила навигации активируются на основании строковых значений, возвращённых вызванными методами (подобно JSF )
  21. Spring Web Flow
    • <webflow id=&quot;userFlow&quot; start-state=&quot;setupForm&quot;>
    • <action-state id=&quot;setupForm&quot;>
    • <action bean=&quot;userFormAction&quot;/>
    • <transition on=&quot;success&quot; to=&quot;display.nameForm&quot;/>
    • </action-state>
    • <view-state id=&quot;display.nameForm&quot; view=&quot;flow/name&quot;>
    • <transition on=&quot;submit&quot; to=&quot;display.addressForm&quot;>
    • <action bean=&quot;userFormAction&quot; method=&quot;bindAndValidate&quot;/>
    • </transition>
    • <transition on=&quot;cancel&quot; to=&quot;finish&quot;/>
    • </view-state>
    • <view-state id=&quot;display.addressForm&quot; view=&quot;flow/address&quot;>
    • <transition on=&quot;previous&quot; to=&quot;display.nameForm&quot;>
    • <action bean=&quot;userFormAction&quot; method=&quot;bindAndValidate&quot;/>
    • </transition>
    • <transition on=&quot;submit&quot; to=&quot;display.otherForm&quot;>
    • <action bean=&quot;userFormAction&quot; method=&quot;bindAndValidate&quot;/>
    • </transition>
    • <transition on=&quot;cancel&quot; to=&quot;finish&quot;/>
    • </view-state>
  22. Tapestry ( Краткая характеристика )
    • Положительные стороны:
      • Очень эффективна после изучения
      • Шаблоны являются HTML , что очень хорошо для дизайнеров
      • Хорошее сообщество пользователей
    • Отрицательные стороны:
      • Документация достаточно сложна для восприятия
      • Крутая кривая обучения
      • Мало примеров
      • Долгие циклы релизов – ведущие релизы 1-2 раза в год
  23. Tapestry ( Жизненный цикл )
  24. Класс Tapestry
    • public abstract class UserForm extends BasePage {
    • public abstract UserManager getUserManager();
    • public abstract void setUser(User user);
    • public abstract User getUser();
    • public void save(IRequestCycle cycle) {
    • if (log.isDebugEnabled()) {
    • log.debug(&quot;entered 'save' method&quot;);
    • }
    • getUserManager().saveUser(getUser());
    • UserList nextPage = (UserList) cycle.getPage(&quot;users&quot;);
    • nextPage.setMessage(getMessages().format(&quot;user.saved&quot;, getUser().getFullName()));
    • throw new PageRedirectException(nextPage);
    • }
  25. Конфигурирование Tapestry
    • <application name=&quot;tapestry&quot;>
    • <page name=&quot;Home&quot; specification-path=&quot;/pages/home.page&quot;/>
    • <page name=&quot;users&quot; specification-path=&quot;/pages/users.page&quot;/>
    • <page name=&quot;userForm&quot; specification-path=&quot;/pages/userForm.page&quot;/>
    • <library id= “ contrib ” specification p ath=&quot;/org/apache/tapestry/contrib/Contrib.library&quot;/>
    • </application>
  26. Конфигурирование Tapestry
    • <page-specification class=&quot;org.appfuse.web.UserForm&quot;>
    • <bean name=&quot;delegate“ class=&quot;org.apache.tapestry.valid.ValidationDelegate&quot;/>
    • <component id=&quot;form&quot; type=&quot;Form&quot;>
    • <binding name=&quot;delegate&quot; value=&quot;ognl:beans.delegate&quot;/>
    • <binding name=&quot;clientValidationEnabled&quot; value=&quot;true&quot;/>
    • </component>
    • <property name=&quot;user&quot;/>
    • <inject property=&quot;userManager&quot; object=&quot;spring:userManager&quot;/>
    • <component id=&quot;lastNameField&quot; type=&quot;TextField&quot;>
    • <binding name=&quot;value&quot; value=&quot;user.lastName&quot;/>
    • <binding name=&quot;validators&quot; value=&quot;validators:required&quot;/>
    • <binding name=&quot;displayName&quot; value=&quot;message:lastName&quot;/>
    • </component>
    • </page-specification>
  27. HTML представление Tapestry
    • <form jwcid=&quot;@Form&quot; delegate=&quot;ognl:beans.delegate&quot; name=&quot;userForm&quot;>
    • <input type=&quot;hidden&quot; jwcid=&quot;@Hidden&quot; value=&quot;ognl:user.id&quot;/>
    • <table class=&quot;detail&quot;>
    • <tr>
    • <th>
    • <label for=&quot;firstName&quot;><span key=&quot;firstName&quot;>First Name</span></label>:
    • </th>
    • <td><input jwcid=&quot;@TextField&quot; type=&quot;text&quot; value=&quot;ognl:user.firstName&quot; id=&quot;firstName&quot;/></td>
    • </tr>
    • <tr>
    • <th>
    • <label jwcid=&quot;@FieldLabel&quot; field=&quot;ognl:components.lastNameField&quot;>Last Name</label>:
    • </th>
    • <td><input jwcid=&quot;lastNameField&quot; type=&quot;text&quot; id=&quot;lastName&quot;/></td>
    • </tr>
    • <tr>
    • <th>
    • <label for=&quot;birthday&quot;><span key=&quot;birthday&quot;>Birthday</span></label>:
    • </th>
    • <td>
    • <input jwcid=&quot;@DatePicker&quot; format=&quot;message:date.format&quot; type=&quot;text ”
    • size=&quot;11&quot; value=&quot;ognl:user.birthday&quot; id=&quot;birthday&quot;/>
    • </td>
    • </tr>
  28. HTML представление Tapestry
    • <form jwcid=&quot;@Form&quot; delegate=&quot;ognl:beans.delegate&quot; name=&quot;userForm&quot;>
    • <input type=&quot;hidden&quot; jwcid=&quot;@Hidden&quot; value=&quot;ognl:user.id&quot;/>
    • <table class=&quot;detail&quot;>
    • <tr>
    • <th>
    • <label for=&quot;firstName&quot;><span key=&quot;firstName&quot;>First Name</span></label>:
    • </th>
    • <td> <input jwcid=&quot;@TextField&quot; type=&quot;text&quot; value=&quot;ognl:user.firstName&quot; id=&quot;firstName&quot;/> </td>
    • </tr>
    • <tr>
    • <th>
    • <label jwcid=&quot;@FieldLabel&quot; field=&quot;ognl:components.lastNameField&quot;>Last Name</label> :
    • </th>
    • <td> <input jwcid=&quot;lastNameField&quot; type=&quot;text&quot; id=&quot;lastName&quot;/> </td>
    • </tr>
    • <tr>
    • <th>
    • <label for=&quot;birthday&quot;><span key=&quot;birthday&quot;>Birthday</span></label>:
    • </th>
    • <td>
    • <input jwcid=&quot;@DatePicker&quot; format=&quot;message:date.format&quot; type=&quot;text ”
    • size=&quot;11&quot; value=&quot;ognl:user.birthday&quot; id=&quot;birthday&quot;/>
    • </td>
    • </tr >
  29. HTML представление Tapestry
    • <form jwcid=&quot;@Form&quot; delegate=&quot;ognl:beans.delegate&quot; name=&quot;userForm&quot;>
    • <input type=&quot;hidden&quot; jwcid=&quot;@Hidden&quot; value=&quot;ognl:user.id&quot;/>
    • <table class=&quot;detail&quot;>
    • <tr>
    • <th>
    • <label for=&quot;firstName&quot;><span key=&quot;firstName&quot;>First Name</span></label>:
    • </th>
    • <td><input jwcid=&quot;@TextField&quot; type=&quot;text&quot; value=&quot;ognl:user.firstName&quot; id=&quot;firstName&quot;/></td>
    • </tr>
    • <tr>
    • <th>
    • <label jwcid=&quot;@FieldLabel&quot; field=&quot;ognl:components.lastNameField&quot;>Last Name</label>:
    • </th>
    • <td><input jwcid=&quot;lastNameField&quot; type=&quot;text&quot; id=&quot;lastName&quot;/></td>
    • </tr>
    • <tr>
    • <th>
    • <label for=&quot;birthday&quot;><span key=&quot;birthday&quot;>Birthday</span></label>:
    • </th>
    • <td>
    • <input jwcid=&quot;@DatePicker&quot; format=&quot;message:date.format&quot; type=&quot;text ”
    • size=&quot;11&quot; value=&quot;ognl:user.birthday&quot; id=&quot;birthday&quot;/>
    • </td>
    • </tr >
  30. Улучшения в следующей версии Tapestry
    • Богатая поддержка аннотаций
    • Высокий уровень конфигурирования – базирование на IoC контейнере Hivemind
    • Требует меньше кода – более простая реализация классов реализующих логику страниц
    • Поддержка URL дружественных к пользователю
    • Компоненты Tacos AJAX
  31. JSF ( Краткая характеристика )
    • Положительные стороны:
      • J2EE Стандарт
      • Быстрая и простая разработка
      • Богата библиотека навигации (аналог Spring Web Flow )
    • Отрицательные стороны:
      • Мешанина из JSP тэгов
      • Плохая поддержка «легковесных» вызовов ( REST )
      • Нет единого источника реализации
  32. JSF ( Жизненный цикл )
  33. Бин страницы JSF
    • public class UserForm {
    • private String id;
    • public User user = new User();
    • public UserManager mgr;
    • public void setId(String id) {
    • this.id = id;
    • }
    • public void setUser(User user) {
    • this.user = user;
    • }
    • public void setUserManager(UserManager userManager) {
    • this.mgr = userManager;
    • }
    • public String edit() {
    • if (id != null) {
    • // assuming edit
    • setUser(mgr.getUser(id));
    • }
    • return &quot;success&quot;;
    • }
  34. Конфигурация JSF
    • <application>
    • <variable-resolver>
    • org.springframework.web.jsf.DelegatingVariableResolver
    • </variable-resolver>
    • <locale-config>
    • <default-locale>en</default-locale>
    • <supported-locale>en</supported-locale>
    • <supported-locale>es</supported-locale>
    • </locale-config>
    • <message-bundle>messages</message-bundle>
    • </application>
    • <navigation-rule>
    • <from-view-id>/userForm.jsp</from-view-id>
    • <navigation-case>
    • <from-outcome>cancel</from-outcome>
    • <to-view-id>/userList.jsp</to-view-id>
    • </navigation-case>
    • <navigation-case>
    • <from-outcome>success</from-outcome>
    • <to-view-id>/userList.jsp</to-view-id>
    • <redirect/>
    • </navigation-case>
    • </navigation-rule>
  35. Конфигурация JSF
    • <application>
    • <variable-resolver>
    • org.springframework.web.jsf.DelegatingVariableResolver
    • </variable-resolver>
    • <locale-config>
    • <default-locale>en</default-locale>
    • <supported-locale>en</supported-locale>
    • <supported-locale>es</supported-locale>
    • </locale-config>
    • <message-bundle>messages</message-bundle>
    • </application>
    • <navigation-rule>
    • <from-view-id>/userForm.jsp</from-view-id>
    • <navigation-case>
    • <from-outcome>cancel</from-outcome>
    • <to-view-id>/userList.jsp</to-view-id>
    • </navigation-case>
    • <navigation-case>
    • <from-outcome>success</from-outcome>
    • <to-view-id>/userList.jsp</to-view-id>
    • <redirect/>
    • </navigation-case>
    • </navigation-rule>
  36. Конфигурация JSF
    • <managed-bean>
    • <managed-bean-name>userForm</managed-bean-name>
    • <managed-bean-class>org.appfuse.web.UserForm</managed-bean-class>
    • <managed-bean-scope>request</managed-bean-scope>
    • <managed-property>
    • <property-name>id</property-name>
    • <value>#{param.id}</value>
    • </managed-property>
    • <managed-property>
    • <property-name>userManager</property-name>
    • <value>#{userManager}</value>
    • </managed-property>
    • </managed-bean>
  37. JSP представление JSF
    • <f:view>
    • <f:loadBundle var=&quot;messages&quot; basename=&quot;messages&quot;/>
    • <h:form id=&quot;userForm&quot;>
    • <h:inputHidden value=&quot;#{userForm.user.id}&quot;>
    • <f:convertNumber/>
    • </h:inputHidden>
    • <h:panelGrid columns=&quot;3&quot; styleClass=&quot;detail&quot; columnClasses=&quot;label&quot;>
    • <h:outputLabel for=&quot;firstName&quot; value=&quot;#{messages['user.firstName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.firstName}&quot; id=&quot;firstName&quot;/>
    • <h:message for=&quot;firstName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;lastName&quot; value=&quot;#{messages['user.lastName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.lastName}&quot; id=&quot;lastName&quot; required=&quot;true&quot;/>
    • <h:message for=&quot;lastName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;birthday&quot; value=&quot;#{messages['user.birthday']}&quot;/>
    • <t:inputCalendar monthYearRowClass=&quot;yearMonthHeader&quot;
    • weekRowClass=&quot;weekHeader&quot; id=&quot;birthday&quot;
    • currentDayCellClass=&quot;currentDayCell&quot; value=&quot;#{userForm.user.birthday}&quot;
    • renderAsPopup=&quot;true&quot; addResources=&quot;false&quot;/>
    • <h:message for=&quot;birthday&quot; styleClass=&quot;errorMessage&quot;/>
  38. JSP представление JSF
    • <f:view>
    • <f:loadBundle var=&quot;messages&quot; basename=&quot;messages&quot;/>
    • <h:form id=&quot;userForm&quot;>
    • <h:inputHidden value=&quot;#{userForm.user.id}&quot;>
    • <f:convertNumber/>
    • </h:inputHidden>
    • <h:panelGrid columns=&quot;3&quot; styleClass=&quot;detail&quot; columnClasses=&quot;label&quot;>
    • <h:outputLabel for=&quot;firstName&quot; value=&quot;#{messages['user.firstName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.firstName}&quot; id=&quot;firstName&quot;/>
    • <h:message for=&quot;firstName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;lastName&quot; value=&quot;#{messages['user.lastName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.lastName}&quot; id=&quot;lastName&quot; required=&quot;true&quot; />
    • <h:message for=&quot;lastName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;birthday&quot; value=&quot;#{messages['user.birthday']}&quot;/>
    • <t:inputCalendar monthYearRowClass=&quot;yearMonthHeader&quot;
    • weekRowClass=&quot;weekHeader&quot; id=&quot;birthday&quot;
    • currentDayCellClass=&quot;currentDayCell&quot; value=&quot;#{userForm.user.birthday}&quot;
    • renderAsPopup=&quot;true&quot; addResources=&quot;false&quot;/>
    • <h:message for=&quot;birthday&quot; styleClass=&quot;errorMessage&quot;/>
  39. JSP представление JSF
    • <f:view>
    • <f:loadBundle var=&quot;messages&quot; basename=&quot;messages&quot;/>
    • <h:form id=&quot;userForm&quot;>
    • <h:inputHidden value=&quot;#{userForm.user.id}&quot;>
    • <f:convertNumber/>
    • </h:inputHidden>
    • <h:panelGrid columns=&quot;3&quot; styleClass=&quot;detail&quot; columnClasses=&quot;label&quot;>
    • <h:outputLabel for=&quot;firstName&quot; value=&quot;#{messages['user.firstName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.firstName}&quot; id=&quot;firstName&quot;/>
    • <h:message for=&quot;firstName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;lastName&quot; value=&quot;#{messages['user.lastName']}&quot;/>
    • <h:inputText value=&quot;#{userForm.user.lastName}&quot; id=&quot;lastName&quot; required=&quot;true&quot; />
    • <h:message for=&quot;lastName&quot; styleClass=&quot;errorMessage&quot;/>
    • <h:outputLabel for=&quot;birthday&quot; value=&quot;#{messages['user.birthday']}&quot;/>
    • <t:inputCalendar monthYearRowClass=&quot;yearMonthHeader&quot;
    • weekRowClass=&quot;weekHeader&quot; id=&quot;birthday&quot;
    • currentDayCellClass=&quot;currentDayCell&quot; value=&quot;#{userForm.user.birthday}&quot;
    • renderAsPopup=&quot;true&quot; addResources=&quot;false&quot;/>
    • <h:message for=&quot;birthday&quot; styleClass=&quot;errorMessage&quot;/>
  40. Улучшения в следующей версии JSF (1.2)
    • Унифицированный EL – лучшая поддержка JSTL
    • Фокусировка на лёгком использовании
    • Расширенная поддержка AJAX
    • Дополнительные реализации: ADF Faces, Facelets
  41. Сравнение . Критерии
    • Сортируемые / Листаемые списки – насколько просто создать список данных с листаемыми страницами и возможностями сортировки.
    • Возможность создания закладок – может ли пользователь создавать закладки на страницы для последующего обращения к ним?
    • Валидация - проверка введённых значений.
    • Тестируемость – возможности для автономного тестирования классов, составляющих клиента, вне контейнера.
  42. Сравнение . Критерии
    • Интернационализация
    • Модификация «на лету» - принятие исправлений без необходимости перекомпиляции или перезапуска контейнера
    • Поддержка разработчиками
    • Производительность / Масштабируемость
    • «Компонетность» - возможность создания повторно-используемых, параметризуемых модулей
    • Возможности языка выражений
  43. Сортируемые / Листаемые списки
    • JSP – никакой поддержки
    • Spring & Struts могут использовать библиотеки тэгов, типа “DisplayTag”
    • Tapestry имеет contrib:Table компонент
    • JSF имеет h:dataTable компонент без возможностей сортировки – необходимо писать свою собственную логику для реализации данного функционала
  44. Возможность создания закладок
    • JSP, String & Strut имеют полный контроль над строкой запроса
    • Tapestry имеет слегка корявую поддержку создания закладок, но всё же все возможности реализованы
    • JSF делает POST для всего – закладки даже не рассматриваются (но при желании и это можно обойти)
  45. Валидация
    • JSP – «собственные» решения, либо перенос проверки в модель данных
    • String & Struts используют проект Apache – Commons Validator – надёжное и зрелое решение
    • Tapestry – хорошая архитектура валидации – хорошие сообщения (даже без необходимости корректировки под свои нужды)
    • JSF – «некрасивые» сообщения об ошибках по-умолчанию (но легко исправляется)
  46. Тестируемость
    • Struts – необходимо использование StrutsTestCase
    • JSP, Spring – легко тестируется с использованием средств генерации «заглушек» ( mock ) (EasyMock, jMock, Spring Mock…)
    • Tapestry – неочевидное тестирование, т.к. классы абстрактные – класс Creator помогает
    • JSF – самое простая архитектура для тестирования – классы – просто бины
  47. Интернационализация
    • JSTL <fmt:message> позволяет делать это легко почти в любой реализации
    • JSP, Struts, Spring, JSF – используют один ResourceBundle на язык
    • Tapestry – предпочитает отдельные файлы для страниц / компонентов
    • JSF требует, что данные с локализацией были объявлены на каждой странице
  48. Модификация «на лету»
    • JSP – самый гибкий в данном случае (конечно при корректном использовании). JSP файлы перекомпиливаются при каждом изменении, а вот классы нет.
    • Tapestry, Spring & Struts – всё (страницы, компоненты, библиотеки и конфигурационные файлы) (кроме классов) перечитывается при изменении.
    • JSF – не перечитываются конфигурационные файлы.
  49. Поддержка разработчиками
    • JSP & JSF – стандарт, большое сообщество разработчиков и множество документации
    • Spring – большое количество примеров и документации, хорошая поддержка разработчиками библиотеки
    • Tapestry – мало хорошей, понятной документации. Мало примеров.
    • Struts – отсутствие поддержки со стороны разработчиков, но при этом много документации и примеров использования в больших проектах
  50. Производительность / Масштабируемость
    • JSP – хорошие показатели, в связи с отсутствием каких-либо промежуточных уровней
    • Tapestry – после версии 4.0 (где было удалено широкое использование интроспекции) скорость стала сравнима с JSP
    • JSF – не самые лучшие показатели…
    • Spring & Struts – адекватные показатели.
  51. «Компонетность»
    • JSP – тэг-файлы и тэги.
    • Tapestry – очень ориентированная на создание и использование компонетов, хорошая интеграция с JavaScript.
    • JSF – хорошие возможности по созданию компонентов, но создавать не так легко как в Tapestry.
    • Spring & Struts – лишь то же, что даёт JSP.
  52. Возможности языка выражений
    • JSP, JSF, Spring, Struts – богатые возможности EL говорят сами за себя.
    • Tapestry – вместо EL используется OGNL , который предоставляет ещё большие возможности.
  53. Финал
    • Выбирайте с умом…

+ Fedor MalyshkinFedor Malyshkin, 2 years ago

custom

2144 views, 0 favs, 0 embeds more stats

Средства разработки web прил more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 2144
    • 2144 on SlideShare
    • 0 from embeds
  • Comments 1
  • Favorites 0
  • Downloads 6
Most viewed embeds

more

All embeds

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories

Groups / Events