On Apr 5, 10:29 pm, Mihai DINCA <mihai.di...@free.fr> wrote:
> Hi Mich�le
>
> Thanks for the tip.
>
> I tested and it works perfectly.
>
> So, the only thing I did was manually
This is not exactly the same thing, because here you have a version
2.5 for the web.xml file, not a version 3.0. But you may also add it
manually of course.
If you want only to have the welcome file in it, proceed as follows:
1. Create the servlet without checking the Add information to
deployment descriptor (web.xml)
2. Create a web.xml document with New->Other->Standard Web Deployment
Descriptor by right-clicking on WEB-INF directory
3. Give it the name web.xml
4. Click on Pages in the newly created web.xml
5. Click on Browse at the right end of the Welcome Files field, expand
the Web Pages folder, click on the jsp you want as welcome file and
click OK.
You will then have a 3.0 version of the web.xml file.
It will have also a default session time-out of 30 seconds:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>MyOwnJSP.jsp</welcome-file>
    </welcome-file-list>
</web-app>


Michèle

> and choose the jsp you want
> adding a "web.xml" file to the
> WEB-INF directory (the same that contains sun-web.xml) with only this
> content:
> *
> **<?xml version="1.0" encoding "UTF-8"?>
> <web-app
>             version="2.5"
>             xmlns="http://java.sun.com/xml/ns/javaee";
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>             
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
>     <welcome-file-list>
>         <welcome-file>MyOwnServlet6UseDifferentURL</welcome-file>
>     </welcome-file>
> </web-app>*
>
> The rest is managed by annotations (automatically added by NetBeans 6.8
> for JEE6), such as:
>
> *...
> @WebServlet(name="MyOwnServlet6",
> urlPatterns={"/MyOwnServlet6UseDifferentURL"})
> public class MyOwnServlet6 extends HttpServlet {
> ...
>
> }*
>
> Hope it helps
> mihai
>
> miga a �crit :
>
>
>
> > I wonder if I have been explicit enough. So to allow another page than
> > the index.jsp, or index.html files (default) to be the welcome file,
> > you may proceed as follows:
>
> > 1 - When creating the servlet, check the Add information to deployment
> > descriptor (web.xml) in the second panel of the servlet creation named
> > Configure Servlet Deployment
> > This will creates a web.xml, which will takes the information from
> > what you have entered.
> > Note that this does not impede to have annotations. It will eventually
> > override annotations if you specify values different from the ones in
> > annotations.
> > Also it will override the default values - that is what we do here:
> > overriding the default index.jsp/index.html.
>
> > See section
>
> > 2 - Create another jsp file, say myOwnJSP.jsp
>
> > 3 - Add to the web.xml the corresponding fragment to override the
> > default value for welcome list:
>
> >     <welcome-file-list>
> >       <welcome-file>MyOwnJSP.jsp</welcome-file>
> >     </welcome-file-list>
>
> > 4 - Run and Enjoy!
>
> > References: the Servlet 3.0 final release:
> >http://cds-esd.sun.com/ESD5/JSCDL/servlet/3.0-final/servlet-3_0-final...
>
> > Sections: 8.1.6, 8.2.1, 10.10
>
> > And of course, the whole reading is a must.
>
> > Mich�le

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to