JPractice

          JSF+Spring+Hibernate+MySQL 開發(fā)商務(wù)平臺實踐

             :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            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.....

          待續(xù)。。。

          posted on 2006-02-16 16:22 JPractice 閱讀(438) 評論(0)  編輯  收藏

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


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 凤山县| 贵德县| 蕲春县| 米泉市| 成都市| 珲春市| 麻栗坡县| 静海县| 盘锦市| 阜平县| 游戏| 宁明县| 平和县| 万荣县| 白沙| 南岸区| 濉溪县| 台安县| 奉节县| 德安县| 彰化市| 丹棱县| 肥乡县| 阳山县| 日土县| 开鲁县| 金寨县| 乐至县| 定边县| 乐亭县| 新沂市| 玉环县| 虞城县| 确山县| 扶绥县| 扬州市| 宁晋县| 贺州市| 湖北省| 五大连池市| 察雅县|