File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web.xml hard work

 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tremendous
 
Sagar Rohankar
Ranch Hand
Posts: 2904
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic