File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sample web.xml.. may be useful for SCWCD Ranchers

 
Micheal John
Ranch Hand
Posts: 344
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Below is the list of elements in the web.xml.. may be useful for SCWCD ranchers.. pls include if anything is missed on exam perspective..



and tld also...



May be some spelling mistake will be there.. pls check it, since this is I typed without seeing the book to see how my memory power is ..so careful regd mistakes.. it's just a sample

[ February 10, 2007: Message edited by: Micheal John ]

[ February 10, 2007: Message edited by: Micheal John ]

[ February 10, 2007: Message edited by: Micheal John ]
[ February 26, 2007: Message edited by: Micheal John ]
 
Kevin DesLauriers
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. That is much nicer than my penciled notes on my white board. It will make it easier to memorize.

Again, Thank you.
 
amar kasar
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Micheal John

thanks, its realy a nice list to prepare.....
 
Boobalan Jegathesan
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Good job..I Appreciate your work
 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you get this idea of putting this down here?? Awesome man! keep it up. It should be really useful for all those studying for SCWCD.
 
vikas bala
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome Work Michael
I appreciate that.
Marvelous !!

hugs
Vikas
 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What combinations of questions can we expect in the real exam regarding the web.xml file?? Any idea guys??
 
Vinod Iyer
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few more small correction .. Great work !!!

<web-app>
<display>Sample web.xml </display>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- FILTER CONFIGURATION -->
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>com.example.HelloFilter</filter-class>
<init-param>
<param-name>FilterName</param-name>
<param-value>Hello Filter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>/*.do</url-pattern>
<!-- or <servlet-name>MyServlet</servlet-name> -->
<dispatcher>REQUEST</dispatcher>
<!-- or
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
-->
</filter-mapping>

<!-- LISTENER CONFIGURATION -->

<listener>
<listener-class>com.example.MyContextListener</listener-class>
</listener>

<!-- SERVLET CONFIGURATION -->
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.example.HelloServlet</servlet-class>
<!-- or<jsp-file>/hello.jsp</jsp-file>-->
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>emailid</param-name>
<param-value>hello@hcl.com</param-value>
</init-param>
<security-role-ref>
<role-name>Manager-TOM HENRY</role-name>
<role-link>admin</role-link>
</security-role-ref>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- JSP CONFIGURATION -->
<jsp-config>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
<el-ignored>false</el-ignored>
</jsp-property-group>
<taglib>
<taglib-uri>helloWorld</taglib-uri>
<taglib-location>/WEB-INF/hello.tld</taglib-location>
</taglib>

</jsp-config>

<!-- SESSION CONFIGURATION -->
<session-config>
<session-timeout>15</session-timeout>
</session-config>

<!-- ERROR PAGE CONFIGURATION -->

<error-page>
<exception-type>java.lang.ArithimeticException</exception-type>
<!-- or<error-code>500</error-code>-->
<location>/WEB-INF/error.jsp</location>
</error-page>

<!-- CONTENT TYPE CONFIGURATION -->
<mime-mapping>
<extension>text</extension>
<mime-type>text/html</mime-type>
</mime-mapping>

<!-- ALL SECURITY RELATED CONFIGURATIONS -->

<security-role>
<role-name>admin</role-name>
<role-name>manager</role-name>
</security-role>

<security-constraint>
<welcome-resource-collection>
<welcome-resource-name>My Security</welcome-resource-name><url-pattern>/hello/*.do</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</welcome-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>manager</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
<!-- or
<transport-guarantee>CONFIDENTIAL</transport-guarantee><transport-guarantee>INTEGRAL</transport-guarantee>
-->
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<!-- or
<auth-method>DIGEST</auth-method>
<auth-method>CLIENT-CERT</auth-method>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
-->
</login-config>

<!-- ALL EJD/JNDI RELATED CONFIGURATIONS -->

<env-entry>
<env-entry-name></env-entry-name>
<env-entry-type></env-entry-type>
<env-entry-value></env-entry-value>
</env-entry>

<ejb-local-ref>
<ejb-ref-name>ejb/Customer</ejb-ref-name>
<ejb-ref-type>ENTITY</ejb-ref-type>
<local-home>com.example.CustHome</local-home>
<local>come.exampleCust</local>
</ejb-local-ref>

<ejb-ref>
<ejb-ref-name>ejb/Customer</ejb-ref-name>
<ejb-ref-type>ENTITY</ejb-ref-type>
<home>com.example.CustHome</home>
<remote>com.example.Cust</remote>
</ejb-ref>

<resource-env-ref>
<resource-env-ref-name>jms/stockQueue</resource-env-ref-name><resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>

<resource-ref>
<res-ref-name>jdbc/EmpDB</res-ref-name>
<res-type>javax.sql.Datasource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why I've always found the nice diagrams in the spec easier to remember than a big web.xml sample
 
Krishna R Seelam
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very useful. Great work.
 
Victor Maehira
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, congratulations for you, ranchers! This web.xml sample has been very useful! I wonder if the child tag within <security-constraint> should be <web-resource-collection> instead of <welcome-resource-collection>. Or both exists?!
And also, shouldn�t the resource name be <web-resource-name> instead of <welcome-resource-name>?!
Thanks!
 
Srinivasan thoyyeti
Ranch Hand
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this. I am about to prepare one.

 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Victor

I am agree with you as XML Schema says:

- <!-- ****************************************************
-->
- <xsd:complexType name="security-constraintType">
- <xsd:annotation>
<xsd ocumentation>The security-constraintType is used to associate security constraints with one or more web resource collections Used in: web-app</xsd ocumentation>
</xsd:annotation>
- <xsd:sequence>
<xsd:element name="display-name" type="j2ee isplay-nameType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="web-resource-collection" type="j2ee:web-resource-collectionType" maxOccurs="unbounded" />
<xsd:element name="auth-constraint" type="j2ee:auth-constraintType" minOccurs="0" />
<xsd:element name="user-data-constraint" type="j2ee:user-data-constraintType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" />
</xsd:complexType>
- <!-- ****************************************************
-->

And DTD also verifies that

<!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>

Regards,
Khushhal
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Telling you seriously, I never imagined that much web.xml I would have
to learn/ (BTW I have learned now). Seeing them at a place collectively
is really awesome experience.





Nice effort!

Thanks,
 
Cristiano Sganzerla
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im drunked and remember all of the web.xml file.

Im really prepared for the exam !!!

I think the unique error in the web.xml schema posted by Micheal John is the
'web-resource-collection' that was corrected by Victor Maehira and khushhal yadav.

I was wondering if this child tag could appear in the exam since i didnt see in the HFSJ, just in Exam Study Kit book.

<variable>
<name-from-attribute>var</name-from-attribute>
<scope>AT_BEGIN</scope>
<variable>
<dynamic-attributes>true<dynamic-attributes>

Talking about the topic.

PERFECT POST !!!
[ August 16, 2007: Message edited by: Cristiano Sganzerla ]
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cristiano

<variable>
<name-from-attribute>var</name-from-attribute>
<scope>AT_BEGIN</scope>
<variable>
<dynamic-attributes>true<dynamic-attributes>


I am not sure whether it can appear in exam or not.
But it's really something good to know. And also not difficult to grasp.

Moreover, it's not a part of web.xml. It's a part of tlds.
It's concerend with scripting varibles. And define their lexical scope.
There can be three values of it: AT_BEGIN, NESTED, AT_END.

Regards,
Khushhal
 
Cristiano Sganzerla
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !!!
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks.
Padma priya N.G.
 
Frank Knoll
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and

should be
 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much everybody for your contribution and time. This will help everybody. It is a handy reference.

Thanks, Naveen.

 
Frank Knoll
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and there could be context parameters in the web-app:
 
Tony Ding
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nice job, thanks
 
Vimal Panchal
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to All,

Nice one.
 
John Pearson
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very nice listing! I wish I had had that a couple of months ago when I was preparing for the exam.
 
Jay Palaniappan
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the sample web.xml. I took the liberty of correcting some typos and added few more items in the web.xml. I also validated in RAD (Rational Application Developer) to make sure it doesn't have any more errors. Hope its useful to others...

 
Abhra Kar
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
10000 thanks to you
 
Mitch Miller
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Jay and all,
Thank you Jay for posting and validating.
You mentioned using "(Rational Application Developer)" for xml validation.

Sadly, I do not have RAD available.

How can I validate web.xml using Java?
e.g. once I put 2 error pages together, like this:




Java ignored 404/missing but used 500/error and I wasted lots of time trying to figure out why it caught 500 errors, and ignored 404 errors.

How could I find an error like this?

Thanks, Mitch
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you All
Kathir
 
Ankit V Agrawal
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..it would really help
 
raj malhotra
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I think we should specify form-login-page and form-error-page only if the auth-method has value 'FORM'.Please correct me if i have misunderstood.

Thanks,
Raj
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we should specify form-login-page and form-error-page only if the auth-method has value 'FORM'.

Yes that's right...
 
raj malhotra
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit !
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic