Search 5,000,000+ questions and answers.

Frequently Asked Questions

What URL do I use to run my servlet? Q: Can I return custom error pages in Tomcat?

Code Style: Apache Tomcat frequently asked questions (FAQ)
You can configure custom error pages in Tomcat using the error-page element in the application's web.xml file, as below. The error-code element contains the HTTP status code number, the location element contains the path to the error document relative to the Web application root. The error document may be a static HTML document or a JSP. The error-page element may be repeated to specify custom pages for any number of error codes.
Related Questions

Can I return custom error pages in Tomcat?

Code Style: Apache Tomcat frequently asked questions (FAQ)
Tomcat 5 and above uses the Java Runtime Environment by default, not the Java Software Development Kit (JSDK). The Tomcat installer attempts to use the Windows system registry to find a valid JRE installation or a JAVA_HOME environment variable, not the system path. If your JRE is not found or its registry entry is not valid it may cause problems during installation.
Related Questions

How do I run a servlet in Tomcat? Q: Should the Tomcat bootstrap classes be in my classpath?

Code Style: Apache Tomcat frequently asked questions (FAQ)
Your compilation classpath only needs to include the classes and libraries necessary for your servlet. It's unlikely you are using Tomcat bootstrap classes in your servlet but, if so, make sure this package is on your classpath. The URL you use partly depends on the port you have configured Tomcat to operate on. This is configured in the HTTP Connector element in server.xml.
Related Questions

Custom error pages Q: Why should I be cautious about dynamic error pages?

Code Style: Site manager frequently asked questions (FAQ)
The point of custom error pages is to help the user first and the developer or publisher second. One hazard with sending an automatic email error report is that it may make the problem worse. If you catch an HTTP 404, document not found error and the email script produces a 500, internal server error, the user may not appreciate the difference, and you will get confusing error reports.
Related Questions

Servlet start up Q: What are the basic steps to run a servlet?

Code Style: Java servlets frequently asked questions (FAQ)
The key steps in creating and running a servlet are outlined below in the simplest form. There are different techniques that can be used to complete these stages, described in other FAQ answers. Create a Web application directory structure under the webapp directory of your servlet container (or use an existing one), e.g.
Related Questions

How do you do servlet aliasing with Apache and Tomcat?

www.adobians.com
Servlet aliasing is a two part process with Apache and Tomcat. First, you must map the request in Apache to Tomcat with the ApJServMount directive, e.g., ApJServMount /myservlet /ROOT Second, you must map that url pattern to a servlet name and then to a servlet class in your web.xml configuration file. Here is a sample exerpt: <servlet> <servlet-name>myservlet</servlet-name> <servlet-class>com.mypackage.
Related Questions

Why won't my servlet compile? Q: Can I use a constructor in my servlet?

Code Style: Java servlets frequently asked questions (FAQ)
A servlet is a normal Java class, so when there are no custom constructors, there is an implicit default constructor with no arguments. Servlet containers typically use the Class.newInstance() method to load servlets, so you must be careful to add an explicit default constructor if you add non-default constructors.
Related Questions

Can I run Restlets inside Tomcat or any Servlet container?

Restlet - Developer FAQ
Yes you can, even if this is not required. If you can't use the standalone HTTP connectors provided in the Noelios Restlet Engine, you can still use the ServerServlet connector which is an adapter between the Servlet API and the Restlet API. See the ServerServlet Javadocs for details on how to configure your Servlet container. Class "com.testServlet.
Related Questions

Can I use a constructor in my servlet? Q: Can I use a normal class to handle my requests?

Code Style: Java servlets frequently asked questions (FAQ)
Servlets are normal Java classes, they compile and run just like any other class. All that is required is that servlets implement the javax.servlet.Servlet interface. Usually, they extend a protocol-specific class such as javax.servlet.http.HttpServlet.
Related Questions

Start the servlet container. Q: How do I compile a servlet?

Code Style: Java servlets frequently asked questions (FAQ)
To compile a servlet, you will need to have the Java Servlet API classes in your classpath. Most Java servlet containers come with a copy, it may be called servlet.jar or something similar. The basic classes are in the packages javax.servlet and javax.servlet.http.
Related Questions

How do I compile a servlet? Q: Why won't my servlet compile?

Code Style: Java servlets frequently asked questions (FAQ)
All those "cannot find symbol" error messages mean that you do not have the Java servlet JAR file on your compiler's classpath, so it cannot find the servlet class files. The servlet JAR file is normally distributed with your servlet container. For Apache Tomcat it is a file named {CATALINA_HOME}/common/lib/servlet-api.jar. Add this to your compiler classpath as follows.
Related Questions

Servlet implementation Q: What types of Servlet are there?

Code Style: Java servlet API frequently asked questions (FAQ...
In the Java servlet API there are several sub-interfaces and implementations of the Servlet interface. The GenericServlet class has general purpose implementations of servlet methods that are common to all, including getInitParameter(String), init(ServletConfig) and log(String). GenericServlet is abstract and leaves the key method service(ServletRequest, ServletResponse) abstract for sub-class implementation.
Related Questions

How can I get the absolute URL of a servlet/JSP page at runtime ?

www.adobians.com
You can get all the necessary information to determine the URL from the request object. To reconstruct the absolute URL from the scheme, server name, port, URI and query string you can use the URL class from java.net. The following code fragment will determine your page's absolute URL: String file = request.getRequestURI(); if (request.getQueryString() != null) { file += '?' + request.getQueryString(); } URL reconstructedURL = new URL(request.getScheme(), request.getServerName(), request.
Related Questions

How do I use the DLLs from Tomcat to Servlet-enable Microsoft IIS?

jGuru: Tomcat FAQ
Author: Sylvain GIBIER (http://www.jguru.com/guru/viewbio.jsp?EID=11408) Question originally posed by Arnar Freyr Guðmundsson (http://www.jguru.com/guru/viewbio.jsp?EID=26079 Look at the Tomcat IIS How to file located at the address : http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/tomcat-iis-howto.html (or http://jakarta.apache.org/cvsweb/index.cgi/jakarta-tomcat/etc/tomcat-iis-howto.html if the website version is out of date).
Related Questions

How do I use the DLLs from Tomcat to Servlet-enable IIS?

jGuru: Tomcat FAQ
Also refer to the recently published article at Use Microsoft's Internet Information Server as a Java servlet engine
Related Questions

Is there any way to tell Tomcat (or any servlet engine) never to use cookies for session management?

jGuru: Tomcat FAQ
Author: David Garcia (http://www.jguru.com/guru/viewbio.jsp?EID=17915) Question originally posed by Graham Lea (http://www.jguru.com/guru/viewbio.jsp?EID=101834 I'm not sure about Tomcat but in WebLogic (from 4.0.2 to 5.1 versions) there is parameter in the weblogic.properties file which can enable (or disable) cookies. in server.xml, you need to create a Context entry for your web app and add: cookies="false" in order for it to not use cookies by default.
Related Questions

How do I create custom error pages?

Professional Web Design and Hosting
Error pages are served to Internet users when any one of a variety of errors occur, such as when a user enters an incorrect URL or is not authorized to access a specific directory in your web site. Companies often customize error pages to brand them with a specific corporate image and a link to their home page. You do not have to customize these pages - the error page is always available, whether customized or not. Enter the HTML code for the error page.
Related Questions

What are custom error pages?

Hosting.ph - Web Hosting Features Frequently Asked Questions...
When someone visits a website or area there is always a possibility that the link they followed may be out-of-date or broken or they may have typed the address in wrongly. When this happens an error page is displayed. By default a standard error page is received. This does not give the user much information about the area they were in or any details of who they should contact. A custom error page allows you to specify a set of links the visitor could try, as well as a contact for help.
Related Questions

Elephants Web Design :::::::: Frequently Asked Questions - F...
These make your site much more professional because you can specify pages on your website that a user will see if they are presented with errors, such as "The page cannot be found" or "You are not authorised to view this page". For example, to keep visitors on a website: you could present them with a site map when they mistype a URL or encounter a broken link.
Related Questions

Do you support Custom Error pages?

Mp3 Portal
Yes, we can support Custom Error pages. These pages enable you to specify a page on your web site that a user will see if they are presented with errors, such as 'The page cannot be found' or 'You are not authorised to view this page'. For example, to keep visitors on your web site you could present them with a 'Site Map' page when they mistype a URL or encounter a broken link.
Related Questions

Can I set up my own custom error pages?

Hilltop Hosting - frequently asked questions
Yes. Just click the Error Pages icon on your Control Panel to quickly create a custom page for any of the following situations:
Related Questions

Can I create my own custom error pages?

Swift Hosting - Support FAQ's
Yes, you can use the .htaccess file to define your error pages. If you need further assistance get in touch and we will be more than happy to help you set this feature up.
Related Questions

What is an invoker servlet in a Tomcat servlet container?

jGuru: Tomcat FAQ
Author: Avi Kak (http://www.jguru.com/guru/viewbio.jsp?EID=26410) The "invoker servlet" is a system-supplied servlet that extracts the name of the requested servlet class from the portion of the URL that comes after "/servlet". The invoker servlet then loads the requested servlet into the container and executes it. If you look at the contents of the webapp deployment descriptor file, web.
Related Questions

Can I do servlet chaining in Tomcat? If so, how?

jGuru: Tomcat FAQ
Author: Alex Chaffee (http://www.jguru.com/guru/viewbio.jsp?EID=3) Question originally posed by Prashant Kumashi (http://www.jguru.com/guru/viewbio.jsp?EID=293844 Not yet. The next version (2.3) of the Servlet Spec will allow something like servlet chaining. It's called "filters." Can I use a Generic SAX/DOM XML parser for Tomcat instead of parser.jar? I tried using Xerces and get class not found errors for sun.xxxx parser during Tomcat initialization.
Related Questions

Got A Question? Ask Our Community!


More Questions >>

© Copyright 2007-2008 QueryCAT
About • Webmasters • Contact