aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Sample web.xml.. may be useful for SCWCD Ranchers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Sample web.xml.. may be useful for SCWCD Ranchers " Watch "Sample web.xml.. may be useful for SCWCD Ranchers " New topic
Author

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

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
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 ]

Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Kevin DesLauriers
Ranch Hand

Joined: Nov 28, 2005
Posts: 43
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

Joined: Jan 06, 2006
Posts: 17
hey Micheal John

thanks, its realy a nice list to prepare.....
Boobalan Jegathesan
Greenhorn

Joined: Jan 08, 2007
Posts: 17
Hi..

Good job..I Appreciate your work


Thanks<br />Boobalan.(SCJP1.4)
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

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.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
vikas bala
Greenhorn

Joined: Dec 26, 2006
Posts: 19
Awesome Work Michael
I appreciate that.
Marvelous !!

hugs
Vikas


hugs <br />Vikas
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

What combinations of questions can we expect in the real exam regarding the web.xml file?? Any idea guys??
Vinod Iyer
Ranch Hand

Joined: Apr 13, 2006
Posts: 53
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

I don't know why I've always found the nice diagrams in the spec easier to remember than a big web.xml sample


[My Blog]
All roads lead to JavaRanch
Krishna R Seelam
Greenhorn

Joined: Dec 12, 2006
Posts: 14
Very useful. Great work.
Victor Maehira
Ranch Hand

Joined: Mar 08, 2007
Posts: 33
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

Joined: Feb 15, 2007
Posts: 557
Thanks for this. I am about to prepare one.



Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
khushhal yadav
Ranch Hand

Joined: Jun 20, 2007
Posts: 242

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


rgrds,
Khushhal
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
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,


cmbhatt
Cristiano Sganzerla
Ranch Hand

Joined: Jan 14, 2006
Posts: 44
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 ]

SCJP 1.4 - SCWCD 1.4
khushhal yadav
Ranch Hand

Joined: Jun 20, 2007
Posts: 242

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

Joined: Jan 14, 2006
Posts: 44
Thanks !!!
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 435
Hi,
Thanks.
Padma priya N.G.


Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Frank Knoll
Greenhorn

Joined: Dec 12, 2007
Posts: 6
... and

should be
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Thank you very much everybody for your contribution and time. This will help everybody. It is a handy reference.

Thanks, Naveen.

Frank Knoll
Greenhorn

Joined: Dec 12, 2007
Posts: 6
and there could be context parameters in the web-app:
Tony Ding
Greenhorn

Joined: May 11, 2008
Posts: 7
nice job, thanks


Passing SCWCD 84%
Vimal Panchal
Greenhorn

Joined: Jun 22, 2007
Posts: 8
Thanks to All,

Nice one.


vimal panchal
John Pearson
Ranch Hand

Joined: Oct 19, 2007
Posts: 51
Very nice listing! I wish I had had that a couple of months ago when I was preparing for the exam.
Jay Palaniappan
Greenhorn

Joined: Jul 10, 2008
Posts: 3
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

Joined: May 22, 2008
Posts: 122
10000 thanks to you
Mitch Miller
Greenhorn

Joined: Mar 10, 2006
Posts: 13
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


SCJP 1.4 80%
Kathiresan Chinna
Ranch Hand

Joined: Aug 17, 2008
Posts: 115
Thank you All
Kathir
Ankit V Agrawal
Greenhorn

Joined: Nov 26, 2008
Posts: 15
Thanks..it would really help


SCJP 5.o, SCWCD 5.o
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285


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

Joined: Aug 03, 2008
Posts: 9304
    
  17

I think we should specify form-login-page and form-error-page only if the auth-method has value 'FORM'.

Yes that's right...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
Thanks Ankit !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sample web.xml.. may be useful for SCWCD Ranchers