JPractice

          JSF+Spring+Hibernate+MySQL 開發商務平臺實踐

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            12 隨筆 :: 0 文章 :: 20 評論 :: 0 Trackbacks

          2006年2月16日 #

          在JSF中,用Tiles或jsp:include將其他頁包含進來的時候,被包含的頁面中,所有靜態HTML代碼都要用<f:verbatim></f:verbatim>括起來,否則就會出現布局錯位的問題,真是痛苦!JSF的這個弊端不知道要到什么版本才行解決!
          posted @ 2006-03-09 17:55 JPractice 閱讀(526) | 評論 (0)編輯 收藏

          JSF的東西本來就不好搞,加上Tiles就更麻煩了,特別是在頁面格式的布局方面,經常出現一些莫名其妙的東西,花了不是時間,現在還沒有完全解決,但基本功能已經可以進行測試了:
          目前的功能有:信息發布、導航菜單、欄目維護、文章維護、后臺登錄,完成了Tiles的組裝,首頁靜態頁面的布局分割。現在美工方面進一步加工一下,一個文章發布系統已具雛形,尚且叫它v0.1版吧:)

          另外需求稿方面已經進展到v0.7版本,現在這個剛有點形狀的文章發布系統是整個大系統的一小部分,不過功能雖少,但主要收獲是解決了一些JSF方面經常遇到的問題。


          posted @ 2006-03-08 16:11 JPractice 閱讀(307) | 評論 (1)編輯 收藏

          <h:outputLabel id="" value="#{category.name}" />

          上面這行在用sun-ri的應用中不會報錯
          但在MyFaces中就會報錯:
          原因就出在id="" 去掉就會好了

          description The server encountered an internal error () that prevented it from fulfilling this request.

          exception

          javax.servlet.ServletException: empty expr
          	javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
          	org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
          	com.bizcms.view.utils.SecurityFilter.doFilter(Unknown Source)
          

          root cause

          javax.faces.FacesException: empty expr
          	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
          	org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)
          	org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)
          	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
          	javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
          	org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
          	com.bizcms.view.utils.SecurityFilter.doFilter(Unknown Source)
          
          posted @ 2006-02-18 23:55 JPractice 閱讀(945) | 評論 (2)編輯 收藏

          一、Action Controller的Action方法中手工獲取請求信息
          ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
          HttpServletRequest request = (HttpServletRequest) context.getRequest();
          String email = request.getParameter("form2:email");

          二、保護/下面的jsp文件不被直接訪問
          在web.xml中加入:
          <security-constraint>
          <display-name>
              Prevent access to raw JSP pages that are for JSF pages.
          </display-name>
          <web-resource-collection>
              <web-resource-name>Raw-JSF-JSP-Pages</web-resource-name>
              <!-- Add url-pattern for EACH raw JSP page -->
              <url-pattern>/welcome.jsp</url-pattern>
              <url-pattern>/login.jsp</url-pattern>
              ......
          </web-resource-collection>
          <auth-constraint>
                <description>No roles, so no direct access</description>
          </auth-constraint>
          </security-constraint>

          三、加載國際化資源文件
          <f:view locale="#{facesContext.externalContext.request.locale}">
          <f:loadBundle basename="messages" var="msgs"/>

          /WEB-INF/classes目錄下,放messages_cn.properties,message_en.properties.....

          待續。。。

          posted @ 2006-02-16 16:22 JPractice 閱讀(437) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 若羌县| 阿克苏市| 乌拉特中旗| 油尖旺区| 泰和县| 甘泉县| 新平| 宜兰市| 泽库县| 南丹县| 黄冈市| 县级市| 蓝田县| 保靖县| 凤凰县| 调兵山市| 赤壁市| 乌兰察布市| 连州市| 达州市| 丹东市| 凤山县| 宁明县| 麻栗坡县| 金塔县| 苏尼特右旗| 金坛市| 永嘉县| 任丘市| 黑水县| 南平市| 繁昌县| 青田县| 侯马市| 阿瓦提县| 南溪县| 抚州市| 柳河县| 班戈县| 壤塘县| 财经|