You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yong How Lim <yo...@yahoo.com.sg> on 2007/03/23 20:52:06 UTC

Pre-compiling for JSF (myfaces) using Weblogic.jspc

Hi All,

Need advice on how to precompile JSP and JSF using Weblogic.jspc.
I performed the precompile with the following ANT task without any problem :

   <target name="compile_jsp" depends="init">
      <echo message="Compiling JSPs ... "/>
      <java classname="weblogic.jspc" failonerror="true" fork="true" >
         <arg value="-compileAll"/>
         <arg value="-webapp"/>
         <arg value="${webapps_root}"/>
         <arg value="-d"/>
         <arg value="${webapps_classes}"/>
         <arg value="-keepgenerated"/>
         <classpath refid="project_class_path"/>
      </java>
   </target>

Package the compile classes under WEB-INF/classes
and the application runs with any problem.

The problem arises when I try to access a page that uses JSF.
The page still display, but the rendering is not done correctly.
The JSF page is name schedule.jsp, the caller page call it schedule.jsf
If I perform a mouse over the schedule object, a javascript error will appear (see attached screenshot)

Just a note, that the whole application was running smoothly before this precompile.

Please advice, thanks.





<!-- web.xml snippets -->
    <!-- ========================================== -->
    <!-- START of context param setting for MyFaces -->
  <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/myfaces-config.xml</param-value>
    <description>Comma separated list of URIs of (additional) faces config files.
            (e.g. /WEB-INF/my-config.xml)
            See JSF 1.0 PRD2, 10.3.2
            Attention: You do not need to put /WEB-INF/faces-config.xml in here.
    </description>
  </context-param>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    <description>State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.3</description>
  </context-param>
  <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 "server" (= 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 "server" (= 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 "server" (= 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: "true"</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 "human readable".
            i.e. additional line separators and whitespace will be written, that do not
            influence the HTML code.
            Default: "true"</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: "false"</description>
  </context-param>
    <context-param>
         <param-name>org.apache.myfaces.VALIDATE</param-name>
         <param-value>true</param-value>
      <description>
         Validate managed beans, navigation rules and ensure that forms are not nested.
      </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>
    <!--param-value>org.apache.myfaces.component.html.util.StreamingAddResource</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>
  </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>
  <context-param>
    <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
    <param-value>/faces/extensionResource</param-value>
    <description>
        Change the url-pattern from the ExtensionsFilter
        Default is "/faces/myFacesExtensionResource"
        Note: The filter-mapping for ExtensionsFilter, the url-pattern is
        this value + "/*", else there comes a exception
    </description>

  </context-param>

    <!-- END of context param setting for MyFaces -->
    <!-- ======================================== -->
    
    
    
    
    
    
    
  <filter>
    <filter-name>extensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    <init-param>
      <param-name>uploadMaxFileSize</param-name>
      <param-value>100m</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>
    <init-param>
      <param-name>uploadThresholdSize</param-name>
      <param-value>100k</param-value>
      <description>Set the threshold size - files
                    below this limit are stored in memory, files above
                    this limit are stored on disk.
                Format: 10 - 10 bytes
                        10k - 10 KB
                        10m - 10 MB
                        1g - 1 GB</description>
    </init-param>
  </filter>


  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>    


  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  
  <filter-mapping>
    <filter-name>extensionsFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
  </filter-mapping>

 		
---------------------------------
 
 Real people. Real questions. Real answers. Share what you know.

Re: Pre-compiling for JSF (myfaces) using Weblogic.jspc

Posted by jeffpstpst <je...@pstechnology.com>.
Wondering if you figured out why this happened. It just happened to us also.
We precompiled and the icon for the 
Tomahawk calendar was not showing up. Basically it appeared that the
ExtensionsFilter was unable to add the necessary javascript files to the
page while it was rendering. We changed to precompile during deployment and
that worked but is not the best option for us.

Let me know if you have found out why this occurs.


Yong How Lim wrote:
> 
> Hi All,
> 
> Need advice on how to precompile JSP and JSF using Weblogic.jspc.
> I performed the precompile with the following ANT task without any problem
> :
> 
>    <target name="compile_jsp" depends="init">
>       <echo message="Compiling JSPs ... "/>
>       <java classname="weblogic.jspc" failonerror="true" fork="true" >
>          <arg value="-compileAll"/>
>          <arg value="-webapp"/>
>          <arg value="${webapps_root}"/>
>          <arg value="-d"/>
>          <arg value="${webapps_classes}"/>
>          <arg value="-keepgenerated"/>
>          <classpath refid="project_class_path"/>
>       </java>
>    </target>
> 
> Package the compile classes under WEB-INF/classes
> and the application runs with any problem.
> 
> The problem arises when I try to access a page that uses JSF.
> The page still display, but the rendering is not done correctly.
> The JSF page is name schedule.jsp, the caller page call it schedule.jsf
> If I perform a mouse over the schedule object, a javascript error will
> appear (see attached screenshot)
> 
> Just a note, that the whole application was running smoothly before this
> precompile.
> 
> Please advice, thanks.
> 
> 
> 
> 
> 
> <!-- web.xml snippets -->
>     <!-- ========================================== -->
>     <!-- START of context param setting for MyFaces -->
>   <context-param>
>     <param-name>javax.faces.CONFIG_FILES</param-name>
>     <param-value>/WEB-INF/myfaces-config.xml</param-value>
>     <description>Comma separated list of URIs of (additional) faces config
> files.
>             (e.g. /WEB-INF/my-config.xml)
>             See JSF 1.0 PRD2, 10.3.2
>             Attention: You do not need to put /WEB-INF/faces-config.xml in
> here.
>     </description>
>   </context-param>
>   <context-param>
>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>     <param-value>server</param-value>
>     <description>State saving method: "client" or "server" (= default)
>             See JSF Specification 2.5.3</description>
>   </context-param>
>   <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 "server" (=
> 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 "server" (=
> 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 "server" (=
> 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: "true"</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 "human readable".
>             i.e. additional line separators and whitespace will be
> written, that do not
>             influence the HTML code.
>             Default: "true"</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: "false"</description>
>   </context-param>
>     <context-param>
>          <param-name>org.apache.myfaces.VALIDATE</param-name>
>          <param-value>true</param-value>
>       <description>
>          Validate managed beans, navigation rules and ensure that forms
> are not nested.
>       </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>
>    
> <!--param-value>org.apache.myfaces.component.html.util.StreamingAddResource</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>
>   </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>
>   <context-param>
>     <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
>     <param-value>/faces/extensionResource</param-value>
>     <description>
>         Change the url-pattern from the ExtensionsFilter
>         Default is "/faces/myFacesExtensionResource"
>         Note: The filter-mapping for ExtensionsFilter, the url-pattern is
>         this value + "/*", else there comes a exception
>     </description>
> 
>   </context-param>
> 
>     <!-- END of context param setting for MyFaces -->
>     <!-- ======================================== -->
>     
>     
>     
>     
>     
>     
>     
>   <filter>
>     <filter-name>extensionsFilter</filter-name>
>    
> <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
>     <init-param>
>       <param-name>uploadMaxFileSize</param-name>
>       <param-value>100m</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>
>     <init-param>
>       <param-name>uploadThresholdSize</param-name>
>       <param-value>100k</param-value>
>       <description>Set the threshold size - files
>                     below this limit are stored in memory, files above
>                     this limit are stored on disk.
>                 Format: 10 - 10 bytes
>                         10k - 10 KB
>                         10m - 10 MB
>                         1g - 1 GB</description>
>     </init-param>
>   </filter>
> 
> 
>   <servlet>
>     <servlet-name>Faces Servlet</servlet-name>
>     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet>    
> 
> 
>   <servlet-mapping>
>     <servlet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.jsf</url-pattern>
>   </servlet-mapping>
>   
>   <filter-mapping>
>     <filter-name>extensionsFilter</filter-name>
>     <url-pattern>*.jsf</url-pattern>
>   </filter-mapping>
> 
>  		
> ---------------------------------
>  
>  Real people. Real questions. Real answers. Share what you know.
>  
> 

-- 
View this message in context: http://www.nabble.com/Pre-compiling-for-JSF-%28myfaces%29-using-Weblogic.jspc-tf3456009.html#a9968553
Sent from the MyFaces - Users mailing list archive at Nabble.com.