JPractice

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

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

          一、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 on 2006-02-16 16:22 JPractice 閱讀(440) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 九江市| 永州市| 西丰县| 定南县| 揭西县| 高台县| 城口县| 鄂托克旗| 读书| 招远市| 嘉义县| 柳林县| 凤凰县| 郁南县| 扶绥县| 夹江县| 灵武市| 类乌齐县| 阳东县| 青岛市| 开化县| 高安市| 厦门市| 安达市| 乳源| 蒙山县| 中江县| 如皋市| 成安县| 重庆市| 宁乡县| 宁城县| 横峰县| 晋中市| 綦江县| 兴城市| 盘锦市| 甘孜县| 乃东县| 台南县| 昂仁县|