How to detect servlet forwarding problem?

Hi all experts,
I have a servlet that forward (using forward method in request dispatcher) the requests to a certain destination URL.
But if that URL is down or not found (like 500 or 404), forward method will not throw exception.
But how do I get the response code in this forwarding? Interpret the response header from output stream of response object? I did not found any related methods in java that can simply allow us to get the response code (only allow us to set but not get).
Thanks a lot!

If you are using JBOSS or other application servers in that web.xml of your application just write
<error-page>
<error-code>404</error-code>
<location>Error.jsp</location>
</error-page>then it will be taken care of by container

Similar Messages

  • How to detect Memory Leaking Problem in Java

    I have a Java multithreading program & I suspect that there is a memory leaking issue in the program. Can someone tell me how can I know how to detect where is the memory leakage in the program?
    I have download a few tools like hat, jprobe, optimizeit but not sure how to use it. I am using jdk1.3.0 in HP-UX
    Thks

    Not so true, you could have a memory leak if you accidental hold on to a resource, or maybe you have threads running that you have no reference to, and those threads hold some resources.
    Optimizeit is pretty easy to use. You start you application with Optimize it, so Optimizeit is you JVM so to speak. In optimizeit you can get a list of active objects. If this list grows and grows, you probably have a problem. Let it run for a while, and see which objects are the most present, dubble-click it, and it lets you step down into you methods. This way you can maybe find you leak.
    Good luck :)

  • Servlet forward problem

    Hi
    I have a servlet which is forwarded to JSP file.The JSP got content type as XML.But it gives error like "System cannot understand the specified encoding".but when i takeout the content type its works fine.
    can anyone give some ideas pls?

    Hi
    I am getting the following error
    System does not support the specified encoding. Error processing resource
    from servlet i am doing following
    res.setContentType("text/xml");
              RequestDispatcher dispatch = getServletContext().getRequestDispatcher("/test/STWDesign/View.jsp");
    where in the view.jsp i am displaying xml data.
    thanks for you help
    waiting for reply.

  • Each time I try to watch my itunes U podcast and try to skip forward my itunes freezes and gives me an error report and shuts off, this happens also when I try to convert it to my iPod. How can I fix this problem to be able to use the iTunes U?

    Each time I try to watch my iTunes U podcast and try to skip forward my iTunes freezes and gives me an error report and shuts off, this happens also when I try to convert the podcast to my iPod. How can I fix this problem to be able to use iTunes U?

    Hello, bisco,
    This forum is for questions from people who administer iTunes U sites. You'll be most likely to get help with this issue if you ask in the iTunes or iPod forums.
    Regards.

  • TELUS called us and said they have detected Flashback virus from our MacBook Pro with retina display i just want to ask if this is possible and how can I fix the problem thanks

    TELUS is our Internet provider at home and they called to inform us that they have detected a Flasback virus from our apple MacBook Pro with Retina display is this possible and can you please help us on how we can fix this problem..I just bought my MacBook last August of this year thanks.

    Dabi Ngetet wrote:
    TELUS is our Internet provider at home and they called to inform us that they have detected a Flasback virus from our apple MacBook Pro with Retina display is this possible and can you please help us on how we can fix this problem..
    If your OS is fully up-to-date, that is close to impossible. The Flashback site has not been known to be active since long before August.
    Did you migrate any users from an older system, perhaps? It might have been transferred if that is the case.
    ISP's are famous for mis-diagnosing these things with regard to Macs, so you might want to challenge them to provide you with their logs and specifics about what they are seeing.
    Is it possible that another device is on your network that could be causing this, either something you own or a neighbor using your network?

  • How to detect the path of Temp directory

    I am writing a class library which allows users to manipulate a database in the web server java applications/applets. In my logic the Application/Applet communicate with a CGI script/Servlet in the server and that do all the database handling. My objective is to make the Client independant from the Database Drivers, and to some restrictions and possible security threats that can arrice when accessing the database directly.
    99% of the work is done and now I am doing the fine tuning.
    My Problem:
    When the user downloading a blob object from the server database. each time the program read the blob it will get a new copy from the server. This is not good if the blob is large (few 100 megs) . So I am going to implement a cache system. but the problem is If I am caching in the memory it will not support large objects (Memory is a limited factor). So the preferance is use the Temperary files but I do not know how to detect the path to temperary folder.
    And my 2nd questions is are the applets allowed to write and read in temperary folder.

    The Java default temporary file path can be determined with
    System.getProperty("java.io.tmpdir")This is typically the same value as the os environment variable

  • How to detect a selected row in ALV GRID

    Hi,
    Can anyone tell me how to detect and catch an event when a row is selected in an ALV GRID?
    I would like to catch such event when the end user presses Ctrl + Shif + Space bar.
    Thank you and best regards.
    Hassane.

    Hi,
    Use this wiki link, to have a checkbox with all the records in ALV Grid and to process those selected records at a user command, as per the requirement.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • How to detect the OS version and the hardware info??

    Hi all, according to the project needs, I to know how to detect OS version and the hardware info.
    The point is to detect client's OS version, weather Win98, 2000, XP, Vista.
    I have been search the information for several days already.
    But can not really found a example which returns the OS version like"Windows XP Version 2002 *****".
    And also could not find the CPU type such as"Core 2 due, or  pentium D".
    Is there anyone have done this before?
    Thanks.
    The Info I need looks like the photo below.
    Message Edited by EricLu on 07-21-2009 08:09 PM

    Well, in fact I have the VI and also read the topics as well...... The searching tag is OS info , system info......... After reading your post, now I understand the relation between the version number and the real OS version now, tks.  And another problem is, the processor type returned within the VI have only 4 type:"INTEL 386, INTEL 486, PENTIUM, Unknown". 
    It can not really return my CPU TYPE. For example the desktop I’m using now is a Pentium, D , 2.80G, 2.80G.. and it only returns type "Pentium". That's why I'm asking is there any other way to do this...... (( Please forgive me if you can not really know what I'm talking about in my first post, now I know how bad my english is.......   ))  I guess I can only try to find out the solution from the registry then... Thanks for your information and reply. 
    Message Edited by EricLu on 07-21-2009 09:25 PM
    Message Edited by EricLu on 07-21-2009 09:26 PM

  • How to Run servlet in Tomcat 5.5.9

    hi
    How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
    Jiten

    Hi ! I have a similar problem, well, it's along the same line ...
    I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
    Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
    Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
    (These work on the NetBeans Tomcat bundle 5.5.7)
    My form action :
    <form name="index" method="get" action="PageServlet">
    My web.xml :
    <servlet>
    <servlet-name>PageServlet</servlet-name>
    <servlet-class>application.PageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>PageServlet</servlet-name>
    <url-pattern>/PageServlet</url-pattern>
    </servlet-mapping>
    I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^

  • How to detect if an item of JComboBox is highlighted?

    Good day.
    How to detect if the selected item of a JComboBox is highlighted or not?
    Thanks for your response.

    the above code can only detect a highlight if an item is selected from the combo box.
    But when the focus is transfered to other Combo box it can no longer keep track if the item was highlighted or not.
    for example:
    combo box 1 combo box 2
    item item2
    Highlight should be detected wheneverr the focus is transfered from combo box 1 to combo box 2 or vice versa.
    case:
    Combo box 1 item is highlighted before transfering the focus to combo box 2 item. by the time the focus is transfered , highlight in combox 1 item should be detected.
    The main problem here is how to detect if the previously focused item is highlighted or not.
    thank you for your time.

  • How to detect the sign of a number?

    I have output which gives either negative number or positive number. My problems is how to detect the sign of the number and output boolean value? For example if input number is negative like -23.11 I want to output false and if the number is positive like 17.99 I want to output true.
    T H A N K S!
    Solved!
    Go to Solution.

    Message Edited by Phillip Brooks on 07-16-2009 11:08 AM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How to use servlets in portal web application in Weblogic Portal 4.0

    We are developing a Portal Web application using Weblogic Portal 4.0 where in we
    have the following scenario. one JSP in webflow of a portlet calls the PipeLine
    which does some processing and calls the servlet which is having the typical download
    functionality. The servlet is supposed to read the data from the pipeline session
    and create a CSV String that is dumped to the client browser. The problem is even
    we are doing response.setContentType("application/save") in the servlet it is
    still displaying the content as html in the portlet. I guess since all our request
    are send to the webflow contolling servlet and it is setting the content type
    and hence our servlet is not working. How do I solve this problem? Thanks Yogesh

    Hi Renu
    Please go through the SAP Content Management here you find the documents related to Wab page Compoer and knowledge mangement. Also search for article / blog for more details.
    [http://www.sdn.sap.com/irj/sdn/nw-ecm|http://www.sdn.sap.com/irj/sdn/nw-ecm]
    Hope it will helps
    Best Regards
    Arun Jaiswal

  • How to run servlet with tomcat

    I have a probrom that how can I run servlet with tomcat?
    I have new a folder classes in webapps\root\WEB-INF\,and put the .class
    programme in it ,but http://localhost:8080/servlet/HelloWorldExample
    can't run ,it give me a error than http:404 not found.
    could you tell me how i can solve the problem.
    Thank u very much.

    Hi,
    Make sure the class is in classpath or in WEB-INF/classes folder and make an entry for servlet tag in web.xml in WEB-INF folder.
    Regards

  • How to run servlet,jsp in eclipse software

    can any one tell me how to run servlet ,jsp in eclipse
    and how to start tomcat server in eclipse
    reply me
    regards
    saravana

    Can anybody help me as I wanted to know how to run servlet,jsp in eclipse software...
    If somebody can forward me the screenshots than it would be of great help....
    Thanks

  • My enternet exploerer facebook page start's up by it's self how can i fix the problem?

    help. my enternet exploerer facebook page start's up by it's self how can i fix the problem?

    Hi readytogo. welcome to the HP Forums. I am not sure exactly what you mean. You say Facebook loads automatically in Internet Explorer (IE). Does this mean, when you first open IE, that Facebook opens? Or do you mean when you turn your computer on, it loads Facebook without being told to? Or are you saying that it is remembering your Facebook login information?
    What is the model number of your product? What version of Windows is installed?
    Guide to finding your product number
    Which Windows operating system am I running?
    Let me know, I look forward to your response.
    TwoPointOh
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

Maybe you are looking for

  • IPad Calendar doesn't sync back to iCloud nor Mac

    Hello all, I have a strange issue that, since a few days, the iPad-based, iCloud-linked calendar doesn't sync back to iCloud. Hence, for that reason, the calendar on the Mac isn't in sync, and this is, as you can guess, pretty annoying. iPad runs iPh

  • Buy Aperture 3 or wait for Aperture 4?

    I'm looking to buy Aperture, but rumor has it version 4 is on the way. Should I buy version 3 now and hope 4 is a ways away or wait it out? How likely is it if I buy version 3 now, apple will let me upgrade to 4 for free? I know there's no upcoming a

  • After updates my iMac OS X 10.6.8 won't read certain .mov files

    After updates on my iMac OS X 10.6.8 .mov files shot with the JVC HD200 will no longer play!  Everything was fine before the updates.  I keep getting the error message:  invalid public movie atom.  I was told it may have been from the iTunes update s

  • HELP !! My ipad mini and iphone 5 just stopped syncing calendar with outlook 2007 calendar.

    All apple devices are at current OS levels and no changes have been made except to calendar entries.  I recently added a bunch of new appointments to outlook and then used my ipad to insert an appointment that was sent to me by email from american ai

  • NB550D why battery discharges so quickly

    Well, after first full charging (during Windows 7 instalation power suply is mandatory!) everything was quite OK, but after few hours system's gone to hibernation - it's normal procedure in case of less then 10% of battery. But the problem is that a