Wanna know the uses of web.xml in Tomcat webserver
Hai All,
I'm using the Tomcat "C:\Program Files\Apache Group\Tomcat 4.1\webapps\examples\WEB-INF".
I want to know whats the use of web..xml & how can Icustomise it so that I can call my oen servlet/jsp class .
If there is any previous post please notify me.
ThanX in Advance,
Raj.
web.xml is deployment discriptor.....
That means you can map your servlets in this xml.....
You can set different parameters like <load-on-startup> and like you can direct your application for the standard tag libs.....
You can configure you application using your deployment discriptor.....
That is the use of web.xml....
Regards,
Similar Messages
-
Hi. I wanna know the reason whyI can't sync my ipad to my computer. It says that sync will resume when (computer's name) is available? My device runs with ios6.1.3 and itunes 11. Even I would like to transfer and view photos using the USB cable, it doesn't appear in the computer. Please answer. Thanks.
Hi Lauren ...
Try the troubleshooting steps here > iOS: Device not recognized in iTunes for Windows -
How dos the application will know the path of persistence.xml file
Hi ,
I am seeing examples for ConatierManaged EntityManager
@PersistenceContext
public class Test extends HttpServlet
public void doGet()
EntityManager em
// JnDI Lookup code
em = (EntityManager) ctx.lookup("java:comp/env/persistence/em");
em.persist(Employee)
}Inside web.xml file
<web-app>
<persistence-context-ref>
<persistence-context-ref-name>persistence/em</persistence-context-ref-name>
<persistence-unit-name>my-pu</persistence-unit-name>
</persistence-context-ref>
</web-app>Please tell me how the Application will know the path of persistence.xml file .
Thank you for readingit is predefined; JPA always looks for the persistence.xml file in the META-INF folder.
-
Security constraint in Web.xml of tomcat
Hi
I have a web-application running on tomcat . Inside the context folder i have several directories having some pre-defined configuration files . But the user is able to directly access them by typing the path including the fileName in the URL ( I have disabled the listings property however)
How can i prevent accessing the specific files .... I tried using
<security-constraint>
<display-name>Security constarint</display-name>
<web-resource-collection>
<web-resource-name>Java Application</web-resource-name>
<url-pattern>/folder/*</url-pattern>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>OnJava Application</realm-name>
</login-config>
This seems to be working fine , but when the user enters the wrong security info thrice , 401 error page is coming instead i want my custom page . Hence i configured an error page for 401 code which overwrited the earlier behavaiour ie.. that BASIC authentication popup is not coming
Can any one let me know how to go about thisHi ,
I have tried adding the following into web.xml but the security feature just doesnt work and the user can go to any page without any restriction.
<security-constraint>
<web-resource-collection>
<web-resource-name>Declarative Security Test</web-resource-name>
<url-pattern>/SuperServlet</url-pattern>
<url-pattern>/*</url-pattern>
<http-method>post</http-method>
<http-method>get</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
<auth-constraint>
<role-name>guest</role-name>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>guest</role-name>
<role-name>member</role-name>
</security-role>
The roles mentioned above have been added correctly into tomcat-users.xml..The version of tomcat I am using is tomcat5.0.28.Please help. -
How to initialized a variable in java file by taking the value from web.xml
suppose i declare parameter in web.xml file
i want to access if from a java file .
how can i do this . plz help me its urgent...............In your Servlet class you can use the getInitParameter("configfile") method.
-
hi all,
i'm using Tomcat as a server.i don't know how to use web.xml.i don't want to change values in my servlets.i want to change values thru web.xml.i don't know the procedure to read values from web.xml toservlets.if any body knows let me know.
Thanks in advanceAll you have to do is add parameters to the <init-param> section for you servlet. Then you can read it in using the getInitParameter( name ) method in the servlet. For example I'm reading in a configuration file for my servlet so I added it to the web.xml. Then in my servlet I just do the following to get my configuration file location:
String config = getInitParameter( "configFile" );
This is my entry in web.xml file:
<servlet>
<servlet-name>
MyServlet
</servlet-name>
<servlet-class>
com.xxxx.controller.MyServlet
</servlet-class>
<init-param>
<param-name>configFile</param-name>
<param-value>
/jakarta-tomcat-3.2.2/htdocs/WEB-INF/init.conf
</param-value>
</init-param>
<load-on-startup>
5
</load-on-startup>
</servlet>
MyServlet
Hope this helps -
Security in my web.xml in Tomcat 4
Hello,
I was using this application on Tomcat 3 and my web.xml worked perfectly well.
However when I tried to start it on Tomcat 4 there is something wrong with the
security part of my web.xml . If I leave out the security constraint for this application, it
works. However if I make my application secure I am unable to view it in the browser.
It does not try to connect to the login.jsp page for log in , but simply displays the message that the page is unavailable and that I have to refresh my browser. Please help me with that because I am stuck.
Here is my web.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>UploadServlet</servlet-name>
<servlet-class>UploadServlet</servlet-class>
<init-param>
<param-name>SaveDirectory</param-name>
<param-value>C:\Homeworks\</param-value>
</init-param>
<init-param>
<param-name>Proffesors</param-name>
<param-value>Clayton,Douglass,Guruvado</param-value>
</init-param>
</servlet>
<security-constraint>
<display-name>Protected Homework Upload</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<!--<url-pattern>/servlet/Upload</url-pattern>-->
<url-pattern>/servlet/UploadServlet</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>student</role-name>
<role-name>proffesor</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
</web-app>
Thank you very much for your time and advise. I appreciate it very much
Martinhi,slice
I donot really find exactly what is wrong in your config file. But I have some suggestions:
1.Please use servlet URL mapping in "servlet" tag (for example: "/security/upload") instead of using default servlet URL(just like "/servlet/UploadServlet").
2. In the "url-pattern" tag inside "web-resource-name" ,please using "/security/*", if you are using my suggestion above.
3.Make sure that your "login.jsp" page is in the right place of the application's doc-root.
Make a try and good luck!
Wang Yu
Developer Technical Support
Sun Microsystems
http://sun.com/developers/support -
Configure web.xml in tomcat for sub class folders
Hi Guys,
I am using a tomcat server. I have a package file and have created a dir in webapps called "testApp". In the classes folder, I have another folder called "CheckServlets" and within this I have 2 servlets. How can I configure my web.xml properties to get the servlets to load in a browser. I have tried the following but it doesnt work:
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>/CheckServlets/HelloServlet/</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/hello/test/</url-pattern>
</servlet-mapping>
So I try http://localhost:8080/testApp/hello/test but that doesnt work.I presume your servlet is in a package called CheckServlets?
ie it starts something like
package CheckServlets
public class HelloServlet extends HttpServlet {
}Remove the / signs from the servlet-class. This attribute should be a fully qualified class name. Like java.lang.String, or com.mypackage.servlet.MyServlet
Given the above servlet in a package, it should be
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>CheckServlets.HelloServlet</servlet-class>
</servlet>Cheers,
evnafets -
About setting the web.xml for Tomcat
for a project, I use more than one servlet. So i set the
<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>servlet1</servlet-class>
<servlet-name>servlet2</servlet-name>
<servlet-class>servlet2</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servlet1</servlet-name>
<url-pattern>/servlet1</url-pattern>
<servlet-name>servlet2</servlet-name>
<url-pattern>/servlet2</url-pattern>
<servlet-mapping>
but only the last servlet is there for the web server to find and call. I don't know what's the problem. Maybe I don't set other parameters in some files of Tomcat?
Thanks for your reply.<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This is the web-app configurations that allow w3prj to work under
Apache Tomcat.
-->
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>JDBC</servlet-name>
<servlet-class>TestServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>workerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>JDBC</servlet-name>
<url-pattern>/TestServlet</url-pattern>
<servlet-name>login</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
<servlet-name>worker</servlet-name>
<url-pattern>/worker</url-pattern>
</servlet-mapping>
</web-app> -
Who knows the use of VBRP-MWSKZ field?
If could be possible we'd like to have the tax code in the SD invoce, without use KOMV.
We have found VBRP-MWSKZ, but we don't undertand its use, because this field is always empty and it seems not use.
Thanks.Hi Ariana,
I think that you are using SMARTFORMS. So, you must print it after the invoice is saved, and the FI document too. If you want to print the amounts of VAT, you can use in the SMARTFORMS the proper coding to obtain it. With the function module AC_DOCUMENT_RECORD you can get the document FI. After, you can read the tables (BSEG or perhaps BSET) to try the amounts and indicators (check them with SE16N). Set a break point in AC_DOCUMENT_RECORD and read FI documents from invoice to check the parameters that you must set. In X_DIALOG set empty and then you get an internal table for T_DOCUMENTS. Remeber to get only FI documents, because this function returns CO, COPA and other controlling documents.
I hope this helps you
Hasta luego,
Eduardo -
How to setup web.xml files in Tomcat 4.0.6
Hi, I'm to new to Java Servlets. i am trying to run my first servlet but it's not showing up..can anyone help me out please!!!
I created a folders like this:
webapps/sumitapps/WEB-INF\classes\Forms\login.class
under sumitapps: i'm puttin all of my .html files(Logins.html)
under WEB-INF: i put web.xml file and classes folder
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>Forms.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/Forms.login</url-pattern>
</servlet-mapping>
</web-app>
<Context path="/sumitapps" docBase="webapps/sumitapps" crossContext="true" debug="0" reloadable="true" trusted="false" >
</Context>
under my classes folder i put folder Forms where i'm keeping all of my .class files. my class file name is login.class
can anyone tell me why i cant run my servlets
<FORM method="POST" action="Forms.login"
name=userinfo onsubmit="return checkData()">
please help me out here
i can access my html page like this:
http://lcoalhost:8080/sumitapps/Logins.html
but when i enter userid and password it doesnt show anything..it takes me to http://localhost:8080/sumitapps/Forms.login
and shows cannot be displayedhave a look at www.moreservlets.com. There you can find a free pdf (part of the book, a whole chapter) that explains in deep the use of web.xml.
-
Hi
hello guys i would like to know the importance of WEB.XML in the context of Webserver.
Thank youweb.xml contains the deployment descriptor for a web application. It includes info such as servlet names, mappings, listener classes, security, init parameters etc. It's very important!
See "Deployment Descriptor" in the servlet spec ( http://www.jcp.org/aboutJava/communityprocess/final/jsr053/ ) -
How to config the web.xml file, when I use Richfaces + RI 1.2?
Hi there:
I want to use Richfaces + RI 1.2 to build a project. I don`t know how to config the web.xml file.
By the way, my web server is Tomcat 6.0, my JDK's version is 6u6. I don`t want to use the facelets.
thanks.
lxmjust add this before *</web-app>*
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping> -
Iplanet 4.1 SP9 suports web.xml for using taglib ?
I try to make taglib work.
I use Iplanet 4.1 SP9.
I know I can do it with the jar file that include the TLD inside it.
But can I use a web.xml in it ?
My question : are we force to use the taglib.jar method ?
thanks
tonyHi,
I hope below link will helps:
http://knowledgebase.iplanet.com/ikb/kb/articles/4585.html
Regards,
Dakshin.
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support. -
How to run java servlet without using Web.xml?
How to run servlet without using Web.xml? From a book, I know that web.xml descriptor is optional, but the book doesn't tell us how to run java servelet without web.xm descriptor. So how to do that? Thanks a lot.
How to run servlet without using Web.xml?But Tomcat now uses a web.xml for its global server-wide configuration.
If you'd like to invoke a servlet with:
http://host/servlet/ServletName
you have to enable the invoker servlet.
[from an HTML]
<FORM METHOD="POST" ACTION="/servlet/HGrepSearchSJ">
[from resin.conf of Resin Web Server 2.1.12]
<!--
- The "invoker" servlet invokes servlet classes from the URL.
- /examples/basic/servlet/HelloServlet will start the HelloServlet
- class. In general, the invoker should only be used
- for development, not on a deployment server, because it might
- leave open security holes.
-->
<servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
[from TOMCAT5.0.19/conf/web.xml, a global server-wide web.xml file]
<!-- The "invoker" servlet, which executes anonymous servlet classes -->
<!-- that have not been defined in a web.xml file. Traditionally, this -->
<!-- servlet is mapped to URL pattern "/servlet/*", but you can map it -->
<!-- to other patterns as well. The extra path info portion of such a -->
<!-- request must be the fully qualified class name of a Java class that -->
<!-- implements Servlet (or extends HttpServlet), or the servlet name -->
<!-- of an existing servlet definition. This servlet supports the -->
<!-- following initialization parameters (default values are in square -->
<!-- brackets): -->
<!-- -->
<!-- debug Debugging detail level for messages logged -->
<!-- by this servlet. [0] -->
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
---comment out below----------------------------------------------------------
<!-- The mapping for the invoker servlet -->
<!--
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
-->
Maybe you are looking for
-
How do I make Apple TV stay connected to my tv
How do I make Apple TV stay connected in full screen format
-
A question about overheating?
Hey. Im running Win 7 64 bit on my late 2010 MBP. Im using the Win 7 partition for musicproduction with a TC Konnekt 8 soundcard, and have noticed that the machine sometimes gets rather hot. I´ve heard ppl talking about overheating in bootcamp and wa
-
Can we assingn a transaction code to the table maintenance genarator
Hi Gurrus , Can we assign a transaction code to the table maintenance genarator code .
-
How do you download WMA Audiobook files to ipod mini?
I ahve downloaded some audiobooks from library online and the site says they can be transferred to a portable device, but when I go to make the transfer it says WMA files not compatible with ipod. How do I convert or get around this so I can transfer
-
Removing Cisco Clean Access Agent 4.5 (CCA)
I'm more or less having trouble with uninstalling Cisco Clean Access Agent 4.5.0.0, so I can install CCA 4.1... I removed CCAAgent 4.5 + the files within "Library/ApplicationSupport/" and in "Library/Receipts"...yet when I try to install 4.1, it tell