Le 5 avr. 10 à 23:05, Steve Morris a écrit :
On 05/04/10 21:12, miga wrote:
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-spec.pdf?AuthParam=1270463383_a843e2e1ace141dde4075fafdf4dfdd8&TicketId=B%2Fw9lxyETFpNQRRGOVVakA%2Fn&GroupName=CDS&FilePath=/ESD5/JSCDL/servlet/3.0-final/servlet-3_0-final-spec.pdf&File=servlet-3_0-final-spec.pdf
Sections: 8.1.6, 8.2.1, 10.10
And of course, the whole reading is a must.
Michèle
Hi Michele,
Thankyou for the info. The original question still stands though,
this method is fine in JEE5, but the original statements were that
JEE6 doesn't use web.xml,
That is a false assumption. J2EE6 uses web.xml, it only provides
annotations as a replacement of some of the things you can put in
web.xml and the Servlet 3.0 reference I gave above is very clear on
it. You should read it. To get it, go here:
http://jcp.org/aboutJava/communityprocess/final/jsr315/index.html
Then chose the first one, specification for evaluation, in the second
page choose the last one (specification)
I quote here some of the parts:
In 8.1.6:
<quote>
By default all applications will have index.htm(l) and index.jsp in
the list of
welcome-file-list. The descriptor may to be used to override these
default
settings.
</quote>
In 8.2.1
<quote>
Using the annotations defined above makes the use of web.xml optional.
However
for overriding either the default values or the values set via
annotations, the
deployment descriptor is used.
</quote>
10.10 gives examples of welcome-files and their ordering.
Michèle
so how would the default welcome page be overridden in that case?
regards,
Steve
<samorris.vcf>
--
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.