wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes web.xml hard work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "web.xml hard work" Watch "web.xml hard work" New topic
Author

web.xml hard work

Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Hi Ranchers I wrote web.xml without seeing any where just look at it , tell me if any mistakes are there.

Thanks Micheal John, form you only I learned how to write web.xml.


<web-app ....>

<context-param>
<param-name>
<param-value>
</context-param>

<description>web application description</description>

<display-name> Web apllication </display-name>

<distributable/>

<ejb-local-ref>
<ejb-ref-name>ejb local</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>come.example.LocalHomeInterface</local-home>
<local>come.example.LocalRemoteInterface</local>
</ejb-local-ref>

<ejb-ref>
<ejb-ref-name>ejb reference</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>come.example.HomeInterface</home>
<remote>com.example.RemoteInterface</remote>
</ejb-ref>

<env-entry>
<env-entry-name>EJB Data source Name</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>

<error-page>
<exception-type>java.io.IOException<exception-type>

<-- or
<error-code>404</error-code>
-->
<location>/error.jsp</location>
</error-page>


<filter>
<filter-name>Comprestion Filter</filter-name>
<filter-class>com.example.MyFilter</filter-class>
<init-param>
<param-name>nameformFilter</param-name>
<param-vlaue>chintu</param-vlaue>
</init-param>
</filter>

<filter-mapping>
<filter-name>Comprestion Filter</filter-name>
<url-pattern>/*</url-pattern>
<-- or
<servlet-name>MyServlet</servlet-name>
-->
<dispatcher>REQUEST</dispatcher>
<-- or
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
-->
</filter-mapping>

<jsp-config>
<taglib>
<taglib-uri>mytaguri</taglib-uri>
<taglib-location>/WEB-INF/mytag.tld</taglib-location>
</taglib>
<jsp-property-group>
<url-pettern>*.jsp</url-pettern>
<el-ignored>false</el-ignored>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
</jsp-config>

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

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>LADAP REALM<realm-name>
<--or
<auth-method>DIGEST</auth-method>
<auth-method>CLIENT-CERT</auth-method>
<auth-method>FORM</auth-method>
-->
<-- OR
<auth-method>BASIC</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/formerror.jsp</form-error-page>
</form-login-config>
-->

</login-config>

<mime-mapping>
<extention>pdf</extention>
<mime-type>apllication/pdf</mime-type>
</mime-mapping>

<resource-env-ref>
<resource-env-ref-name>some jms resource</resource-env-ref-name>
<resource-env-ref-type>come.example.JMSExample</resource-env-ref-type>
</resource-env-ref>

<resource-ref>
<resource-ref-name>EJB Reource name</resource-ref-name>
<res-auth>container</res-auth>
<res-type>com.exampele.SomeClass</res-type>
<res-sharing-scope>Sharable</res-sharing-scope>
</resource-ref>

<secirity-constraint>

<web-resource-collection>
<web-resource-name>my web resource</web-resource-name>
<url-pettern>/*</url-pettern>
<http-method>GET</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>member</role-name>
</auth-constraint>

<user-data-contraint>
<transport-gaurantee>NONE</transport-gaurantee>
<-- or
<transport-gaurantee>INTEGRAL</transport-gaurantee>
<transport-gaurantee>CONFIDENTIAL</transport-gaurantee>
-->
</user-data-contraint>
</secirity-constraint>


<security-role>
<role-name>member</role-name>
</security-role>

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

<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>com.example.myServlet</servlet-class>
<-- or
<jsp-file>/myjsp.jsp</jsp-file>
-->

<load-on-startup>1</load-on-startup>

<run-as>don't know what to write</run-as>

<security-role-ref>
<role-name>admin</role-name>
<role-link>administrator</role-name>
<security-role-ref>

</servlet>

<session-config>
<session-timeout>30</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>

</web-app>


tell me if any mistakes are there or need to add any tags in this...
please tommorow is my exam ...
[ August 20, 2008: Message edited by: Chintu sirivennela ]

SCJP 5 |SCWCD 5| Started thinking about Web Services ?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

tremendous
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

The best way to check out whether your xml file is correct (well formed and valid) is to have any IDE like, Netbeans or eclipse, copy paste t your code with DTD definition and he ll tell you whether you wrote correct xml or not !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

I think there are two mistakes:
1)

2) <taglib> should be outside <jsp-config>. I am not very much sure about this point, as i never heard of taglib inside jsp-config. so it should be outside.

[ August 21, 2008: Message edited by: Sunny Jain ]
[ August 21, 2008: Message edited by: Sunny Jain ]

Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web.xml hard work