Error page redirection in tomcat 4.1

Hi,
I have error page directive in web.xml as follows
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/jsp/system_error.jsp</location>
</error-page>
But tomcat wouldnt show up this page. But this very same application would work fine when I invoke tomcat using my netbeans IDE. wouldnt work with a standalone tomcat. any clues?

Hi,
Yes that's a bug/feature of tomcat 4.1. You need to declare a Logger in your tomcat server configuration file :
<?xml version="1.0" encoding="UTF-8"?>
<Server debug="0" port="8084" shutdown="SHUTDOWN">
  <Service name="Tomcat-Standalone">
    <Connector acceptCount="10" className="org.apache.coyote.tomcat4.CoyoteConnector" connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" port="8083"/>
    <Engine debug="0" defaultHost="localhost" name="Standalone">
      <Logger className="org.apache.catalina.logger.SystemOutLogger"/>
      <Host appBase="C:\Tomcat\webapps" debug="0" name="localhost" unpackWARs="true"/>
    </Engine>
  </Service>
</Server>

Similar Messages

  • Error-page problem with Tomcat 5.0.24

    I want to display an error page in case any exception is thrown by my JSF application.
    I configure the error page in the web.xml and run the application on Tomcat 5.0.24.
    When an error really happens while loading a jsf-page A the error page is not displayed. In IE i see just a blank page. When I check the source code it shows me some parts of the page A (javascript functions). So it actually never navigates to the error page.
    I tried to use jsf, simple jsp or even html pages as an error page - the same effect.
    And one more thing. When plain jsp-page throws an exception I see my error page all right. Also I see an exception stack trace in Tomcat console. When jsf-page throws an exception I don't see any exception information in the Tomcat console.
    Does anybody has an explanation to this? Can anybody recommend me any other way to watch for exceptions in a JSF-application?
    Any help will be appreciated.
    Slawa

    I resolved the problem.
    I had to increase the jsp-buffer size for the erroneous page. It looks like it started to load and when the error happened the container couldn't redirect to the error page.
    Thanks to jBoss which gives more log messages though is also based on tomcat.
    Slawa

  • Special error page redirection

    Hi everybody,
    When there's an end session or when Tomcat has been restarted, i have a java exception error page, which is norml. But how can i redirect to a special error page i have made instead of this java exception error ?
    Thank you very much !

    I add this comment to my error page because of a "feature" in Internet Explorer
    <!--
         DO NOT REMOVE see below.
         Internet Explorer has a feature "Show friendly HTTP error message" that causes
         application specific error page not to be show if the content is less than 512 bytes.
         This comment is here to inform the developer of the problem and to increase the content
         above 512 bytes. Do not remove this comment.
    -->

  • Custom Error Pages based on URI not working in WS 7

    We have added a handful of Error Page Redirects to our SSL configuration based on URI that do not seem to be working
    The entry in the default object looks like
    Error fn="send-error" code="500" uri="http://oursite.com/error.html"
    The entry in the error logs look like:
    [Date] warning (1000): for host X.X.X.X trying to get /URL/CREATING/ERROR, send-file reports: HTTP4142: can't find http://oursite.com/error.html (File not found)
    [Date] config (1000): for host X.X.X.X trying to get /URL/CREATING/ERROR, send-error reports: HTTP4145: missing parameter (need path)
    I've tried using both the admin server and manual entry in the configs to add this, but no luck. Does the instruction need both a URI and PATH?

    I believe you need a redirect if you want to change between SSL and non-SSL.
    How about something in the line of (example with code 404):
    <If $code=404 && $security>
      Error fn="redirect" url="http://oursite/error.html"
    </If>.. where +$security+ means SSL.
    About the Error and URI, it seems uri="/error.html" would work, but it will not switch you from SSL to non-SSL.
    I'm curious why you would want to redirect a user to the non-SSL instance in this scenario..

  • The custm error page is not getting loaded in TomCat 5.0

    Hi all,
    I am working on a JSF web application deployed in Tomcat 5.0.I was trying to redirect 404 and 500 error pages to custom error pages.But the error pages are not getting loaded and i am getting normal Tocat 404 status page.
    I am giving the web.xml entry for the error page defenition.
    <error-page>
              <error-code>404</error-code>
              <location>/faces/displayErrorpage.jsp</location>
         </error-page>
         <error-page>
              <error-code>500</error-code>
              <location>/faces/SessionExpirepage.jsp</location>
         </error-page>
         <error-page>
              <exception-type>java.lang.Throwable</exception-type>
              <location>/faces/displayErrorpage.jsp</location>
         </error-page>
    Please help me out to solve this problem.Its urgent.I will be greatful for any kind of help.
    Note: The same application working fine,ie,the error page is getting loaded while deploying WAS 6.0.
    Jeevan Edakkunnath.

    That's a specification version. I was asking for the implementation and version. Is it the Sun reference implementation (Sun JSF RI)? If so, which build?
    It works flawlessly here on the latest build of Sun JSF RI 1.1, the 1.1_02. You can get the latest build at [http://javaserverfaces.dev.java.net]. I was using Tomcat 6.0.14 by the way, it might make difference.
    Does it work if you use plain vanilla JSP files and do not pass the request through the FacesServlet? I recall some bugs related to it, but I am not sure anymore if it is related to the JSF implementation or application server used.

  • Tomcat, custom error page, sendError and encoding problems

    Hi All!
    I have the following code in my index.jsp page:
    <%
        if(hasParent && !imageStore.contains(parent))
            response.sendError(404, "Requested image with id=" + parent + " was not found on this server");
            return;
    %>following in the web.xml:
    <error-page>
        <error-code>404</error-code>
        <location>/404.jsp</location>
    </error-page>Both pages (index.jsp and 404.jsp) are windows-1251 encoded:
    <%@page contentType="text/html; charset=windows-1251"%>But I have an issue: all non-latin characters are mangled when 404.jsp displayed as the result of calling response.sendError.
    I mean, if I open myserver.com/404.jsp or myserver.com/non-existing-document-la-la-la, everything is okay. But when I open myserver.com/index.jsp?parent=123 it calls response.sendError - text is mangled.
    What's even more bizarre, Tomcat sends the right encoding in the response headers, but with ? instead non-latin characters:
    HTTP request sent, awaiting response...
    1 HTTP/1.1 404 Requested image with id=1231231 was not found on this server
    2 Content-Type: text/html;charset=windows-1251
    3 Date: Sat, 16 Sep 2006 18:14:27 GMT
    4 Server: Apache-Coyote/1.1
    5 Connection: Keep-Alive
    22:14:27 ERROR 404: Requested image with id=1231231 was not found on this server
    .I am using Apache Tomcat/5.0.28.
    I understand that this issue is not trivial, but I would appreciate any ideas.

    Hi All!
    I have the following code in my index.jsp page:
    <%
        if(hasParent && !imageStore.contains(parent))
            response.sendError(404, "Requested image with id=" + parent + " was not found on this server");
            return;
    %>following in the web.xml:
    <error-page>
        <error-code>404</error-code>
        <location>/404.jsp</location>
    </error-page>Both pages (index.jsp and 404.jsp) are windows-1251 encoded:
    <%@page contentType="text/html; charset=windows-1251"%>But I have an issue: all non-latin characters are mangled when 404.jsp displayed as the result of calling response.sendError.
    I mean, if I open myserver.com/404.jsp or myserver.com/non-existing-document-la-la-la, everything is okay. But when I open myserver.com/index.jsp?parent=123 it calls response.sendError - text is mangled.
    What's even more bizarre, Tomcat sends the right encoding in the response headers, but with ? instead non-latin characters:
    HTTP request sent, awaiting response...
    1 HTTP/1.1 404 Requested image with id=1231231 was not found on this server
    2 Content-Type: text/html;charset=windows-1251
    3 Date: Sat, 16 Sep 2006 18:14:27 GMT
    4 Server: Apache-Coyote/1.1
    5 Connection: Keep-Alive
    22:14:27 ERROR 404: Requested image with id=1231231 was not found on this server
    .I am using Apache Tomcat/5.0.28.
    I understand that this issue is not trivial, but I would appreciate any ideas.

  • Problem accessing exception object in jsp error page - Apache Tomcat 5.0.25

    Hi all,
    I'm thoroughly confused and need some help. I've deployed a very simple web application in Apache Tomcat 5.0.25 to test exception handling - errortest.jsp and error.jsp. errortest.jsp throws a divide by zero exception if executed with default values in text fields.
    When I put the directive IsErrorPage="true" in error.jsp i get a HTTP 500 error when error.jsp is accessed. If I remove it error.jsp is displayed but I cant access the exception object - if I try to I get an exception below:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 5 in the jsp file: /error.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    E:\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mywebapp\org\apache\jsp\error_jsp.java:46: cannot resolve symbol
    symbol : variable exception
    location: class org.apache.jsp.error_jsp
    out.print(exception.getMessage());
    ^
    1 error
    Below is the code for the two jsp pages:
    errortest.jsp:
    <%@ page errorPage="error.jsp" %>
    <html>
    <head><title>Error test</title></head>
    <body>     
         <form action="errortest.jsp" method="post">
         Enter first number:<input type="text" name="first" value="5"/><br>
         Enter second number:<input type="text" name="second" value="0"/><br>
         <input type="submit"/>
         </form>
         <%
         if (request.getMethod().equals("POST")) {
              int first = Integer.parseInt( request.getParameter( "first" ) );
              int second = Integer.parseInt( request.getParameter( "second" ) );
              int answer = first/second;
         %>
    </body>
    </html>
    NB: I am able to catch and display the exception if I use a try/catch block around the division as shown below.
    try {
    int answer = first/second;
    } catch( Exception e) {
    e.printStackTrace( new PrintWriter(out) );
    error.jsp (first draft)
    NB: HTTP 500 error occurs when directive "isErrorPage" is added:
    <%@ page isErrorPage="true" %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    </body>
    </html>
    error.jsp (second draft)
    NB: directive is removed but exception thrown when implicit exception object is accessed. error.jsp displays if exception object is not accessed:
    <%@ page %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    <%=exception.getMessage()%>
    </body>
    </html>
    Web server specs:
    Apache Tomcat 5.0.25
    Machine specs:
    Windows XP Pro
    Java environments:
    j2sdk1.4.2_03
    J2EE 1.4

    This works for me:
    throwError.jsp
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page language="java" errorPage="/error.jsp"
    contentType="text/html; charset=utf-8" %>
    <html>
    <head>
         <title>Throw Exception</title>
    </head>
    <body>
    Throwing exception....
    <%
    // throw ArithmeticException
    int badInt = 12/0;
    %>
    </body>
    </html>
    error.jsp
    <%@ page language="java" isErrorPage="true" %>
    <head><title>Doh!</title></head>
    An Error has occurred in this application.
    <% if (exception != null) { %>
    <pre><% exception.printStackTrace(new java.io.PrintWriter(out)); %></pre>
    <% } else { %>
    Please check your log files for further information.
    <% } %>

  • How to redirect to an error page when database is down

    We have build an struts/jsp-application with JDeveloper 10g and ADF. If the connection to the database fails, we get a plain page with header "500 Internal Server Error" and the exception and a stack trace. Of course we want to catch this exception and redirect the user to an error page with all of the standard design elements of our site and with a textual description of the error of our one choice.
    Our attempts to solve this includes adding error-page tags with error-code and exception-type:
    <error-page>
    <exception-type>javax.servlet.jsp.JspTagException</exception-type>
    <location>error.jsp</location>
    </error-page>
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>error.jsp</location>
    </error-page>
    <error-page>
    <exception-type>oracle.jbo.JboException</exception-type>
    <location>error.jsp</location>
    </error-page>
    <error-page>
    <exception-type>oracle.jbo.DMLException</exception-type>
    <location>error.jsp</location>
    </error-page>
    <error-page>
    <exception-type>java.sql.SQLException</exception-type>
    <location>error.jsp</location>
    </error-page>
    <error-page>
    <error-code>500</error-code>
    <location>error.jsp</location>
    </error-page>
    Are there other ways to do this, or are there things we have forgotten to do, that has to be done for this solution to work.
    We have also tried try and catch in a variety of the lifecycle methods in the DataAction subclass for the page, but none of these are ever called. It seems the error happens before the first lifecyle method starts. We can't figure out where to catch this exception.
    In other cases the web.xml mechanism seems to work.

    Try the Global Exception Mechanism within Struts...

  • Error when redirecting the portal logoff page

    Hello,
    we have a problem in redirecting the portal logoff page.
    Our production system is a cluster environment -windows 2003.
    we have developed customizing page for portal logoff.
    when the cluster is in Node A the functionality of the logoff page is working fine and it is redirecting to the customized page.
    But when we shift it to Node B and logoff the portal it is not showing the customized page.
    We have referred the following note also:696294.
    We have added the portal logoff page is IIS services also.
    But when we shift the server from NodeA-NodeB the functionality of the redirecting is not happening and it gives a message
    you are not authorized.
    I appreciate any one response.
    Regards,
    Krishna.

    Hi sridhar,
    Thanks for your reply.
    What my error is "iam getting the logoff page redirected when the cluster resources are in Node1 but iam not getting the same logoff page when the cluster is nodeB"
    Ie we have developed a customising logoff page and set the page.When the services are in Node A the fucntionality is working fine.But when the resources move to NodeB iam not getting the customized logoff page".It says no authentication.
    Aprreciate your further help.
    Regards,

  • Redirect to a custom error page when Forms Server shuts down

    Hi,
    I want the forms application to redirect to a custom error page whenever Forms Server goes down. (like network issues, unscheduled shutdown...) Whenever this happens, the user gets a pop up with FRM messages and user has to acknowledge the pop up. Since the application is used in the shop floor, there will not be any user always in front of the screen and will be a very big issue as there are at least 70-80 PC's on the floor which will be attended fewer times(only when there is issue with the machine) other wise the application displays important events of the machine,etc.,
    I am trying to develop a simple HTML error page(may be with applet) which will keep querying the forms server and once the forms server is up and running, the error page will revert back to the application which the user was working earlier to shutdown. Other option is the redirect to main menu of the application (this may be a PSP or a JSP or a Oracle Forms Menu ).
    Is there any event in forms to capture the loss of connection to forms server ??
    BTW, I am using Oracle Application Server 10g Forms and Reports on Windows 2000 Server...
    Any ideas...
    Thanks in advance
    Purush

    I don't think it will be easily possible in Forms for a couple of reasons.
    1. In Forms you do not have query rights, and as soon as you want to edit data, you have to log in. In Forms you log in once, and this sets your rights for the whole session. You will have to do some programming in Forms to achieve what you want. E.g. as soon as you hit the Save button you are asked for a username and password.
    2. A refresh cannot be done in Forms. Remember that Forms is a Java applet. The URL in the browser is just pointing to the startup page only. If you refresh your screen, you are taken back to the login screen of Forms again.
    Well, there will probably be ways around these problems. I'm thinking in the line of calling every form in a separate URL instead of starting a Forms application where one form is called from another form. The default 'query only' form can be called from a startup html page. This page can be refreshed. As soon as the user wants to update data, he clicks on a link or button and is taken to a login form.
    If the refresh is unsuccessful you are taken to a custom error page, like in your ASP application.
    A problem with an automatich refresh may be hanging sessions. Forms server does not always kill sessions.
    And also, how would you avoid a refresh if a user is currently using the form?

  • Displaying JSP error page in tomcat 5.5.7

    I'm using tomcat 5.5.7 with JDK1.4.1. I've created these 2 JSPs:
    index.jsp:
    <html>
    <title>Jsp</title>
    <body>
    <%@page errorPage="/error.jsp"%>
    Trying to write some error
    <% String butt = request.getParameter("butt");
    if (butt!=null )
       int p = 4/0;
    }%>
    <form method="post">
    <input type="submit" name="butt" value="head">
    </form></body></html> error.jsp:
    <html>
    <title>Jsp</title>
    <body>
    <%@ page isErrorPage="true" %>
    Error Body
    </body></html> When I run this JSP, and try to get the error page, I get internal
    server error page, insteaof of error.jsp.
    The error_jsp.java file has the following lines:
    Throwable exception =
    org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable
    (request);
    if (exception != null) {
    response.setStatus
    (HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    } I tried to run these same files in Tomcat 4.1, and they work fine.
    What my be the problem? How can I have my error page be displayed?

    Hi,
    I do use Tomcat with the compatibility package (jmx.jar under $CATALINA_HOME/bin and xercesImpl.jar under $CATALINA_HOME/common/endorsed).
    I've put a System.out.println in the error.jsp, and it was printed to the stdout.log.
    Nothing else was printed to the log.
    I also tried removing the isErrorPage="true" from the error page, and I got it displayed (when the error occured). But of course that way I would not have any exception object....

  • Redirect to Error Page Example ?

    Hi,
    Anybody, have an error page working example of how to redirect to error page in 10.1.3, i tried it many ways , followed the ADF Dev Guide PDF page 395 and 396 and no luck.
    where i should write the <error-page> and <dispatcher>REQUEST</dispatcher>
    and <dispatcher>ERROR</dispatcher>
    tags in web.xml
    any tricks in that ???
    thanks in advance

    Hi Frank,
    thanks for replying , unfortunately it did not work , it give me
    "The page cannot be displayed" , it seems that the Exception have been caught but it can't display the error page
    here is my web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app 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" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <context-param>
    <description>Makes Security View Handler printing debug messages at runtime</description>
    <param-name>com.groundside.jsf.security.print_debug_messages</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <description>Customize error message shown upon unauthorized access attempt</description>
    <param-name>com.groundside.jsf.security.unauthorized_access_error_messages</param-name>
    <param-value>User is not authorized to perform requested action</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <context-param>
    <param-name>CpxFileName</param-name>
    <param-value>view.DataBindings</param-value>
    </context-param>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>JsfAuthenticationServlet</servlet-name>
    <servlet-class>com.groundside.jsf.pagesecurity.authentication.J2eeAuthenticationServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>JsfAuthenticationServlet</servlet-name>
    <url-pattern>/jsfauthentication</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>errorpage.jsp</location>
    </error-page>
    </web-app>
    here is how i make the exception
    public void commandButton1_action() throws Exception {
    throw new java.lang.Exception();
    here is the code of the page that have the button that throws the exception
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"
    import="java.lang.Exception"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
    <afh:html binding="#{backing_untitled3.html1}" id="html1">
    <afh:head title="untitled3" binding="#{backing_untitled3.head1}" id="head1">
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    </afh:head>
    <afh:body binding="#{backing_untitled3.body1}" id="body1">
    <h:form binding="#{backing_untitled3.form1}" id="form1">
    <af:commandButton text="commandButton 1"
    binding="#{backing_untitled3.commandButton1}"
    id="commandButton1"
    action="#{backing_untitled3.commandButton1_action}"/>
    </h:form>
    </afh:body>
    </afh:html>
    </f:view>
    <%-- oracle-jdev-comment:auto-binding-backing-bean-name:backing_untitled3--%>
    here is the errorpage.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view >
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <title>untitled4</title>
    </head>
    <body>eeeeeror</body>
    </html>
    </f:view>
    <%-- oracle-jdev-comment:auto-binding-backing-bean-name:backing_untitled4--%>
    by the way , in the error page if i change the f:view to f:subview , the page itself will not run
    thanks very much for your time.
    Message was edited by:
    bassem.farouk

  • IPad browser automatically redirecting to adobe flash error page

    This is very annoying. I have had iPad for a few days but first noticed this just now.
    While perusing used cars on cars.com I found that clicking on a link to a detail listing would first take me to that page, but then almost immediately redirect to an adobe flash error page. Feels like a sleazy trick by adobe to annoy iPad users.
    Example link below, this is just a listing for a used Porsche in northern Va:
    1975 Porsche 911 S - $10,350 (obo)
    <link edited by host>

    It's not something Adobe is doing. The cars.com site is redirecting you to adobe.com because you're missing a plugin that cars.com is using to display that page.

  • How to cancel the event in Item Adding and display javascript message and prevent the page from redirecting to the SharePoint Error Page?

    How to cancel the event in Item Adding without going to the SharePoint Error Page?
    Prevent duplicate item in a SharePoint List
    The following Event Handler code will prevent users from creating duplicate value in "Title" field.
    ItemAdding Event Handler
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    if (properties.ListTitle.Equals("My List"))
    try
    using(SPSite thisSite = new SPSite(properties.WebUrl))
    SPWeb thisWeb = thisSite.OpenWeb();
    SPList list = thisWeb.Lists[properties.ListId];
    SPQuery query = new SPQuery();
    query.Query = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + properties.AfterProperties["Title"] + "</Value></Eq></Where>";
    SPListItemCollection listItem = list.GetItems(query);
    if (listItem.Count > 0)
    properties.Cancel = true;
    properties.ErrorMessage = "Item with this Name already exists. Please create a unique Name.";
    catch (Exception ex)
    PortalLog.LogString("Error occured in event ItemAdding(SPItemEventProperties properties)() @ AAA.BBB.PreventDuplicateItem class. Exception Message:" + ex.Message.ToString());
    throw new SPException("An error occured while processing the My List Feature. Please contact your Portal Administrator");
    Feature.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="1c2100ca-bad5-41f5-9707-7bf4edc08383"
    Title="Prevents Duplicate Item"
    Description="Prevents duplicate Name in the "My List" List"
    Version="12.0.0.0"
    Hidden="FALSE"
    Scope="Web"
    DefaultResourceFile="core"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
    <ElementManifest Location="elements.xml"/>
    </ElementManifests>
    </Feature>
    Element.xml
    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="100">
    <Receiver>
    <Name>AddingEventHandler</Name>
    <Type>ItemAdding</Type>
    <SequenceNumber>10000</SequenceNumber>
    <Assembly>AAA.BBB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8003cf0cbff32406</Assembly>
    <Class>AAA.BBB.PreventDuplicateItem</Class>
    <Data></Data>
    <Filter></Filter>
    </Receiver>
    </Receivers>
    </Elements>
    Below link explains adding the list events.
    http://www.dotnetspark.com/kb/1369-step-by-step-guide-to-list-events-handling.aspx
    Reference link:
    http://msdn.microsoft.com/en-us/library/ms437502(v=office.12).aspx
    http://msdn.microsoft.com/en-us/library/ff713710(v=office.12).aspx
    Amalaraja Fernando,
    SharePoint Architect
    Please Mark As Answer if my post solves your problem or Vote As Helpful if a post has been helpful for you. This post is provided "AS IS" with no warrenties and confers no rights.

    Recommended way for binding the list event handler to the list instance is through feature receivers.
    You need to create a feature file like the below sample
    <?xmlversion="1.0"encoding="utf-8"?>
    <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
    Id="{20FF80BB-83D9-41bc-8FFA-E589067AF783}"
    Title="Installs MyFeatureReceiver"
    Description="Installs MyFeatureReceiver" Hidden="False" Version="1.0.0.0" Scope="Site"
    ReceiverClass="ClassLibrary1.MyFeatureReceiver"
    ReceiverAssembly="ClassLibrary1, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=6c5894e55cb0f391">
    </Feature>For registering/binding the list event handler to the list instance, use the below sample codeusing System;
    using Microsoft.SharePoint;
    namespace ClassLibrary1
        public class MyFeatureReceiver: SPFeatureReceiver
            public override void FeatureActivated(SPFeatureReceiverProperties properties)
                SPSite siteCollection = properties.Feature.Parent as SPSite;
                SPWeb site = siteCollection.AllWebs["Docs"];
                SPList list = site.Lists["MyList"];
                SPEventReceiverDefinition rd = list.EventReceivers.Add();
                rd.Name = "My Event Receiver";
                rd.Class = "ClassLibrary1.MyListEventReceiver1";
                rd.Assembly = "ClassLibrary1, Version=1.0.0.0, Culture=neutral,
                    PublicKeyToken=6c5894e55cb0f391";
                rd.Data = "My Event Receiver data";
                rd.Type = SPEventReceiverType.FieldAdding;
                rd.Update();
            public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
                SPSite sitecollection = properties.Feature.Parent as SPSite;
                SPWeb site = sitecollection.AllWebs["Docs"];
                SPList list = site.Lists["MyList"];
                foreach (SPEventReceiverDefinition rd in list.EventReceivers)
                    if (rd.Name == "My Event Receiver")
                        rd.Delete();
            public override void FeatureInstalled(SPFeatureReceiverProperties properties)
            public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
    }Reference link: http://msdn.microsoft.com/en-us/library/ff713710(v=office.12).aspxOther ways of registering the list event handlers to the List instance are through code, stsadm commands and content types.
    Amalaraja Fernando,
    SharePoint Architect
    Please Mark As Answer if my post solves your problem or Vote As Helpful if a post has been helpful for you. This post is provided "AS IS" with no warrenties and confers no rights.

  • Tomcat error pages

    How can i define my own jsp error pages, and how do i suse them after defining them?
    thanks

    errorPage attribute specifies a JSP page that should process exceptions that are thrown but not caught by the current page.
    <% page errorPage="Relative URL" %>
    There is also the isErrorPage attribute.
    This indicates whether or not the current page can act as an error page for another JSP page.
    <% page isErrorPage="true" %>
    <% page isErrorPage="false" %><%-- this is the default --%>
    Sooooo as an example...
    You are in a JSP page and an error is generated. You have indicated already that if an error is generated oin this page you should go to the Error JSP page.
    --- Inside of "someCalculation.jsp" ---
    <% page errorPage="iamTheJSPErrorPage.jsp" %>
    --- Inside of "iamTheJSPErrorPage.jsp" ---
    <% page isErrorPage="true" %>
    Remember that these are relative URLs that are requried. So if you have your Error page in another directory, you must reflect that in your URL.
    Hope that helps

Maybe you are looking for

  • Update to 10.7 did not work, cannot access iTunes. Need AVFoundationCF.dll, Ituneshelper not installed correctly, Error 7 (Windows Error 126), Error 7 (Windows Error 5)

    I am running Windows 7 64 bit. This HORROR  began because I realized that my phone had suddenly lost all of the music except music that had been purchased. It also lost all purchased iBooks as well as audible books downloaded from audible and rington

  • Benefit plan enrollment

    Hi All, Please help me in the following : As per my Business requirement i need to delimit a Benefit plan becuase that plan is no longer existed in their business effective form 01.01.2009. So as per their requirement i have deleted the master data r

  • Unicode conversion and patching simultaneously

    Hi All - We are planning to convert our core ECC 6.0 system to Unicode this year as well as patch it to the latest support pack stack.  In order to minimize regression testing time, we are going to do them both at the same time so the functional team

  • Inserting ISO8601 dates

    I am trying to insert iso8601 dates into the date field in a table. eg INSERT INTO PROCESS_FILE COLUMNS DATE_PROCESS VALUES TO_DATE('2005-03-22T15:44:36','YYYY-MM-DD HH:MI:SS') but with the t in the date string, it doesn't recognise it as valid. I ha

  • Google maps for flash been Deprecated !

    Hello. i just wana notify the comunity about a serious step tooken from google to kill the maps for flash, because seems like they can not handle them. I would like to hear Adobe opinion - can Adobe do their developers a favor and asign a programmers