Myfaces的配置

<!--   Myfaces Extensions Filter  -->

 <context-param>
  <param-name>
   org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
  </param-name>
  <param-value>20</param-value>
  <description>
   Only applicable if state saving method is &quot; server
   &quot;

   (= default). Defines the amount (default = 20) of the latest
   views are stored in session.
  </description>
 </context-param>
 <context-param>
  <param-name>
   org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
  </param-name>
  <param-value>true</param-value>
  <description>
   Only applicable if state saving method is &quot; server
   &quot;

   (= default). If true (default) the state will be serialized
   to a byte stream before it is written to the session. If
   false the state will not be serialized to a byte stream.
  </description>
 </context-param>
 <context-param>
  <param-name>
   org.apache.myfaces.COMPRESS_STATE_IN_SESSION
  </param-name>
  <param-value>true</param-value>
  <description>
   Only applicable if state saving method is &quot; server
   &quot;

   (= default) and if
   org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (=
   default) If true (default) the serialized state will be
   compressed before it is written to the session. If false the
   state will not be compressed.
  </description>
 </context-param>
 <context-param>
  <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
  <param-value>true</param-value>
  <description>
   This parameter tells MyFaces if javascript code should be
   allowed in the rendered HTML output. If javascript is
   allowed, command_link anchors will have javascript code that
   submits the corresponding form. If javascript is not
   allowed, the state saving info and nested parameters will be
   added as url parameters. Default: &quot; true &quot;
  </description>
 </context-param>
 <context-param>
  <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
  <param-value>false</param-value>
 </context-param>
 <context-param>
  <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
  <param-value>true</param-value>
  <description>
   If true, rendered HTML code will be formatted, so that it is
   &quot; human readable &quot;

   . i.e. additional line separators and whitespace will be
   written, that do not influence the HTML code. Default:
   &quot; true &quot;
  </description>
 </context-param>
 <context-param>
  <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
  <param-value>true</param-value>
  <description>
   If true, a javascript function will be rendered that is able
   to restore the former vertical scroll on every request.
   Convenient feature if you have pages with long lists and you
   do not want the browser page to always jump to the top if
   you trigger a link or button action that stays on the same
   page. Default: &quot; false &quot;
  </description>
 </context-param>
 <context-param>  
  <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
  <param-value>
   org.apache.myfaces.renderkit.html.util.DefaultAddResource
  </param-value>
  <description>
   A class implementing the
   org.apache.myfaces.shared.renderkit.html.util.AddResource
   interface. It is responsible to place scripts and css on the
   right position in your HTML document. Default:
   "org.apache.myfaces.shared.renderkit.html.util.DefaultAddResource"
   Follow the description on the MyFaces-Wiki-Performance page
   to enable StreamingAddResource instead of DefaultAddResource
   if you want to gain performance.
  </description>
  <!--param-value>
   org.apache.myfaces.component.html.util.StreamingAddResource
   </param-value-->
 </context-param>
 <context-param>  
  <param-name>
   org.apache.myfaces.CHECK_EXTENSIONS_FILTER
  </param-name>
  <param-value>true</param-value>
  <description>
   A very common problem in configuring
   MyFaces-web-applications is that the Extensions-Filter is
   not configured at all or improperly configured. This
   parameter will check for a properly configured
   Extensions-Filter if it is needed by the web-app. In most
   cases this check will work just fine, there might be cases
   where an internal forward will bypass the Extensions-Filter
   and the check will not work. If this is the case, you can
   disable the check by setting this parameter to false.
  </description>
 </context-param>


 <filter>
  <filter-name>MyFacesExtensionsFilter</filter-name>
  <filter-class>
   org.apache.myfaces.webapp.filter.ExtensionsFilter
  </filter-class>
  <init-param>
   <param-name>maxFileSize</param-name>
   <param-value>20m</param-value>
   <description>
    Set the size limit for uploaded files. Format: 10 - 10
    bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
   </description>
  </init-param>
 </filter>

下面的配置是把Myfaces应用到 名称为“Faces Servlet”的servlet上,“Faces Servlet”一般是JSF的Servlet.

<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages  -->
 <filter-mapping>
  <filter-name>MyFacesExtensionsFilter</filter-name>
  <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
  <servlet-name>Faces Servlet</servlet-name>
 </filter-mapping> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值