Tuesday, July 15, 2008

A sample web.xml file

This is a sample XML File, which can be useful to all who are preparing for SCWCD.
Please do the following after copy and paste on your text pad:
Replace : '<' --> <
Replace : '>' --> >
Enjoy..!

'<'web-app id="WebApp_ID2" 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"'>'


'<'context-param'>'
'<'param-name'>'web-master-email'<'/param-name'>'
'<'param-value'>'webmaster@scwcdtest.com'<'/param-value'>'
'<'/context-param'>'

'<'description'>'Testing for SCWCD Exam'<'/description'>'

'<'display-name'>'SCWCD TEST'<'/display-name'>'

'<'distributable/'>'

'<'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'>'

'<'!-- ALL EJD/JNDI RELATED CONFIGURATIONS --'>'
'<'env-entry'>'
'<'env-entry-name'>'jndi/TestEnv'<'/env-entry-name'>'
'<'env-entry-type'>'java.lang.String'<'/env-entry-type'>'
'<'env-entry-value'>'TEST_ENV'<'/env-entry-value'>'
'<'/env-entry'>'

'<'!-- 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'>'

'<'!-- 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'>'

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

'<'!-- LISTENER CONFIGURATION --'>'
'<'listener'>'
'<'listener-class'>'com.example.MyContextListener'<'/listener-class'>'
'<'/listener'>'

'<'login-config'>'
'<'auth-method'>'BASIC'<'/auth-method'>'
'<'realm-name'>'LDAP REALM'<'/realm-name'>'
'<'!-- 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'>'

'<'resource-env-ref'>'
'<'resource-env-ref-name'>'jndi/someQueue'<'/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'>'

'<'security-constraint'>'
'<'web-resource-collection'>'
'<'web-resource-name'>'My Security'<'/web-resource-name'>'
'<'url-pattern'>'/hello/*.do'<'/url-pattern'>'
'<'http-method'>'GET'<'/http-method'>'
'<'http-method'>'POST'<'/http-method'>'
'<'/web-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'>'

'<'!-- ALL SECURITY RELATED CONFIGURATIONS --'>'
'<'security-role'>'
'<'role-name'>'admin'<'/role-name'>'
'<'/security-role'>'

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


'<'!-- SERVLET CONFIGURATION --'>'
'<'servlet'>'
'<'servlet-name'>'MyServlet'<'/servlet-name'>'
'<'servlet-class'>'com.example.HelloServlet'<'/servlet-class'>'
'<'!-- or
'<'jsp-file'>'/hello.jsp'<'/jsp-file'>'
--'>'

'<'init-param'>'
'<'param-name'>'emailid'<'/param-name'>'
'<'param-value'>'hello@hcl.com'<'/param-value'>'
'<'/init-param'>'
'<'load-on-startup'>'1'<'/load-on-startup'>'
'<'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'>'

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

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

'<'welcome-file-list'>'
'<'welcome-file'>'index.jsp'<'/welcome-file'>'
'<'welcome-file'>'default.jsp'<'/welcome-file'>'
'<'/welcome-file-list'>'

'<'/web-app'>'