You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dean Hiller <de...@xsoftware.biz> on 2006/03/21 00:26:41 UTC

Re: newBee question : what are these additional declaration in web.xml for jsf stuff.

yes, I use *.jsf.  when a url http://localhost:8080/webapp/page.jsf is 
called, it calls the jsp in webroot of your war file.  I also personally 
put this in my web.xml.....

<context-param>
   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
   <param-value>.jspx</param-value>
</context-param>

This allows me to name all my JSF jsps xxxx.jspx and I can name all my 
normal jsps(that are not for JSF) xxxxx.jsp.  I tried to figure out how 
I could use jsf in the url and in the file name in the war file, but it 
seems that cannot be done right now(or I could not figure it out).
later,
dean



Legolas Woodland wrote:

> There are two declaration in web.xml that i can not understand
> these are :
>
> <servlet>
>        <servlet-name>Faces Servlet</servlet-name>
>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>        <load-on-startup>1</load-on-startup>
>    </servlet>
>
>    <!-- Faces Servlet Mapping -->
>
>    <servlet-mapping>
>        <servlet-name>Faces Servlet</servlet-name>
>        <url-pattern>/faces/*</url-pattern>
>    </servlet-mapping>
>
>
> I just can not understand , in some places they set another 
> url-pattern , for example :
>        <url-pattern>*.faces</url-pattern>
> and thier application works file.
>
> but for me with the first url-mapping , i should navigate to
> http://localhost:8080/testApp/faces/index.jsp to works
> so my understanding is that :
> when i navigate to that url , the pattern matches and filter applies 
> to my request.
>
> but when people uses *.faces in url-pattern , how they navigate to jsp 
> pages ?
> should they change the file extensions to use jsf pages , or there is 
> some other triks ?
>
>
> Thank you



Re: newBee question : what are these additional declaration in web.xml for jsf stuff.

Posted by Dean Hiller <de...@xsoftware.biz>.
works for me.  I changed mine to *.leg and left all my files to be 
called *.jsp with this web.xml file......
My index.jsp does a redirect to my home.leg url.

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <display-name>webAppTest2</display-name>
 <context-param>
  <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</description>
  <param-name>javax.faces.CONFIG_FILES</param-name>
  <param-value>/WEB-INF/faces-config.xml</param-value>
 </context-param>
 <context-param>
  <description>State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.2</description>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>server</param-value>
 </context-param>
 <context-param>
  <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>
  <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
  <param-value>true</param-value>
 </context-param>
 <context-param>
  <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: "false"

            Setting this param to true should be combined with 
STATE_SAVING_METHOD "server" for
            best results.

            This is an EXPERIMENTAL feature. You also have to enable the 
detector filter/filter mapping below to get
            JavaScript detection working.</description>
  <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
  <param-value>false</param-value>
 </context-param>
 <context-param>
  <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>
  <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
  <param-value>true</param-value>
 </context-param>
 <context-param>
  <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>
  <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
  <param-value>true</param-value>
 </context-param>
 <!--filter>
  <filter-name>extensionsFilter</filter-name>
  
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
  <init-param>
   <description>Set the size limit for uploaded files.
                Format: 10 - 10 bytes
                        10k - 10 KB
                        10m - 10 MB
                        1g - 1 GB</description>
   <param-name>uploadMaxFileSize</param-name>
   <param-value>100m</param-value>
  </init-param>
  <init-param>
   <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>
   <param-name>uploadThresholdSize</param-name>
   <param-value>100k</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>extensionsFilter</filter-name>
  <url-pattern>*.jsf</url-pattern>
 </filter-mapping>
 <filter-mapping>
  <filter-name>extensionsFilter</filter-name>
  <url-pattern>/faces/*</url-pattern>
 </filter-mapping-->
 <!-- Listener, that does all the startup work (configuration, init). -->
 <listener>
  
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
 </listener>
 <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>*.leg</url-pattern>
 </servlet-mapping>
 
 
 <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>index.html</welcome-file>
 </welcome-file-list>
</web-app>


Legolas Woodland wrote:

> Hi Dean,
> I have changed my web.xml  file as follow :
>
>
> <servlet>
>        <servlet-name>Faces Servlet</servlet-name>
>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>        <load-on-startup>1</load-on-startup>
>    </servlet>
>
>    <!-- Faces Servlet Mapping -->
>
>    <servlet-mapping>
>        <servlet-name>Faces Servlet</servlet-name>
>        <url-pattern>*.leg</url-pattern>
>    </servlet-mapping>
>
> I have *No* .leg file in my web root file.
> i have files like :
> index.jsp
> logout.jsp
> login.jsp
>
> When i tried to access my index.jsp using the following url :
> http://127.0.0.1:8080/test/index.leg
> it return
>
> *HTTP Status 404 -
> *
>
> *what else i should configure to use .leg extension ?
> should i change all of myfiles extension to .leg?
> *
>
>
> before this i used the formal /faces/* as a url pattern , on that time 
> i could access my jsp files  using
> http://localhost:8080/test/faces/index.jsp
>
>
> Thanks
>
>
> Dean Hiller wrote:
>
>> yes, I use *.jsf.  when a url http://localhost:8080/webapp/page.jsf 
>> is called, it calls the jsp in webroot of your war file.  I also 
>> personally put this in my web.xml.....
>>
>> <context-param>
>>   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>>   <param-value>.jspx</param-value>
>> </context-param>
>>
>> This allows me to name all my JSF jsps xxxx.jspx and I can name all 
>> my normal jsps(that are not for JSF) xxxxx.jsp.  I tried to figure 
>> out how I could use jsf in the url and in the file name in the war 
>> file, but it seems that cannot be done right now(or I could not 
>> figure it out).
>> later,
>> dean
>>
>>
>>
>> Legolas Woodland wrote:
>>
>>> There are two declaration in web.xml that i can not understand
>>> these are :
>>>
>>> <servlet>
>>>        <servlet-name>Faces Servlet</servlet-name>
>>>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>>        <load-on-startup>1</load-on-startup>
>>>    </servlet>
>>>
>>>    <!-- Faces Servlet Mapping -->
>>>
>>>    <servlet-mapping>
>>>        <servlet-name>Faces Servlet</servlet-name>
>>>        <url-pattern>/faces/*</url-pattern>
>>>    </servlet-mapping>
>>>
>>>
>>> I just can not understand , in some places they set another 
>>> url-pattern , for example :
>>>        <url-pattern>*.faces</url-pattern>
>>> and thier application works file.
>>>
>>> but for me with the first url-mapping , i should navigate to
>>> http://localhost:8080/testApp/faces/index.jsp to works
>>> so my understanding is that :
>>> when i navigate to that url , the pattern matches and filter applies 
>>> to my request.
>>>
>>> but when people uses *.faces in url-pattern , how they navigate to 
>>> jsp pages ?
>>> should they change the file extensions to use jsf pages , or there 
>>> is some other triks ?
>>>
>>>
>>> Thank you
>>
>>
>>
>>
>


Re: newBee question : what are these additional declaration in web.xml for jsf stuff.

Posted by Dean Hiller <de...@xsoftware.biz>.
I am pretty much a newb myself to all this, but what do you have in your 
welcome file list.  If you have index.jsp, that could be screwing things 
up maybe?  I read in a book that a JSF app usually bootstraps with an 
index.html that redirects to the first jsf page sort of like

index.html -> home.leg

I have not tried index.leg which many not work for me either.  Run a 
quick test and create a test.jsp page and type in the url 
http://localhost:8080/test/test.leg and see if that works.  If it does, 
it could have something to do with welcome-file-list.
dean

Legolas Woodland wrote:

> Hi Dean,
> I have changed my web.xml  file as follow :
>
>
> <servlet>
>        <servlet-name>Faces Servlet</servlet-name>
>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>        <load-on-startup>1</load-on-startup>
>    </servlet>
>
>    <!-- Faces Servlet Mapping -->
>
>    <servlet-mapping>
>        <servlet-name>Faces Servlet</servlet-name>
>        <url-pattern>*.leg</url-pattern>
>    </servlet-mapping>
>
> I have *No* .leg file in my web root file.
> i have files like :
> index.jsp
> logout.jsp
> login.jsp
>
> When i tried to access my index.jsp using the following url :
> http://127.0.0.1:8080/test/index.leg
> it return
>
> *HTTP Status 404 -
> *
>
> *what else i should configure to use .leg extension ?
> should i change all of myfiles extension to .leg?
> *
>
>
> before this i used the formal /faces/* as a url pattern , on that time 
> i could access my jsp files  using
> http://localhost:8080/test/faces/index.jsp
>
>
> Thanks
>
>
> Dean Hiller wrote:
>
>> yes, I use *.jsf.  when a url http://localhost:8080/webapp/page.jsf 
>> is called, it calls the jsp in webroot of your war file.  I also 
>> personally put this in my web.xml.....
>>
>> <context-param>
>>   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>>   <param-value>.jspx</param-value>
>> </context-param>
>>
>> This allows me to name all my JSF jsps xxxx.jspx and I can name all 
>> my normal jsps(that are not for JSF) xxxxx.jsp.  I tried to figure 
>> out how I could use jsf in the url and in the file name in the war 
>> file, but it seems that cannot be done right now(or I could not 
>> figure it out).
>> later,
>> dean
>>
>>
>>
>> Legolas Woodland wrote:
>>
>>> There are two declaration in web.xml that i can not understand
>>> these are :
>>>
>>> <servlet>
>>>        <servlet-name>Faces Servlet</servlet-name>
>>>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>>        <load-on-startup>1</load-on-startup>
>>>    </servlet>
>>>
>>>    <!-- Faces Servlet Mapping -->
>>>
>>>    <servlet-mapping>
>>>        <servlet-name>Faces Servlet</servlet-name>
>>>        <url-pattern>/faces/*</url-pattern>
>>>    </servlet-mapping>
>>>
>>>
>>> I just can not understand , in some places they set another 
>>> url-pattern , for example :
>>>        <url-pattern>*.faces</url-pattern>
>>> and thier application works file.
>>>
>>> but for me with the first url-mapping , i should navigate to
>>> http://localhost:8080/testApp/faces/index.jsp to works
>>> so my understanding is that :
>>> when i navigate to that url , the pattern matches and filter applies 
>>> to my request.
>>>
>>> but when people uses *.faces in url-pattern , how they navigate to 
>>> jsp pages ?
>>> should they change the file extensions to use jsf pages , or there 
>>> is some other triks ?
>>>
>>>
>>> Thank you
>>
>>
>>
>>
>


Re: newBee question : what are these additional declaration in web.xml for jsf stuff.

Posted by Legolas Woodland <le...@gmail.com>.
Hi Dean,
I have changed my web.xml  file as follow :


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

   <!-- Faces Servlet Mapping -->

   <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.leg</url-pattern>
   </servlet-mapping>

I have *No* .leg file in my web root file.
i have files like :
index.jsp
logout.jsp
login.jsp

When i tried to access my index.jsp using the following url :
http://127.0.0.1:8080/test/index.leg
it return

*HTTP Status 404 -
*

*what else i should configure to use .leg extension ?
should i change all of myfiles extension to .leg?
*


before this i used the formal /faces/* as a url pattern , on that time i 
could access my jsp files  using
http://localhost:8080/test/faces/index.jsp


Thanks


Dean Hiller wrote:
> yes, I use *.jsf.  when a url http://localhost:8080/webapp/page.jsf is 
> called, it calls the jsp in webroot of your war file.  I also 
> personally put this in my web.xml.....
>
> <context-param>
>   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>   <param-value>.jspx</param-value>
> </context-param>
>
> This allows me to name all my JSF jsps xxxx.jspx and I can name all my 
> normal jsps(that are not for JSF) xxxxx.jsp.  I tried to figure out 
> how I could use jsf in the url and in the file name in the war file, 
> but it seems that cannot be done right now(or I could not figure it out).
> later,
> dean
>
>
>
> Legolas Woodland wrote:
>
>> There are two declaration in web.xml that i can not understand
>> these are :
>>
>> <servlet>
>>        <servlet-name>Faces Servlet</servlet-name>
>>        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>        <load-on-startup>1</load-on-startup>
>>    </servlet>
>>
>>    <!-- Faces Servlet Mapping -->
>>
>>    <servlet-mapping>
>>        <servlet-name>Faces Servlet</servlet-name>
>>        <url-pattern>/faces/*</url-pattern>
>>    </servlet-mapping>
>>
>>
>> I just can not understand , in some places they set another 
>> url-pattern , for example :
>>        <url-pattern>*.faces</url-pattern>
>> and thier application works file.
>>
>> but for me with the first url-mapping , i should navigate to
>> http://localhost:8080/testApp/faces/index.jsp to works
>> so my understanding is that :
>> when i navigate to that url , the pattern matches and filter applies 
>> to my request.
>>
>> but when people uses *.faces in url-pattern , how they navigate to 
>> jsp pages ?
>> should they change the file extensions to use jsf pages , or there is 
>> some other triks ?
>>
>>
>> Thank you
>
>
>