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 阅读(416) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: