473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

response.setStatus & response.sendRedirect

I have a situation when I need to set the response status code to a
non 200 and then serve up a generic error page (html page not a jsp).

I can successfully call response.setStatus(
response.SC_INTERNAL_ERROR) and then forward to the page using
dispatcher.forward.

This displays the page I want and returns a 500 status code.
response.setStatus( response.SC_INTERNAL_SERVER_ERROR )
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher( aPage );
dispatcher.forward( request, response );
This displays the page I want, but returns a 200 status code
(presumably because the page that was redirected to was served
successfully).
response.setStatus( response.SC_INTERNAL_SERVER_ERROR );
response.sendRedirect( aPage );
I cannot use the forward logic in my scenario because I want to stop
any further processing of internally included JSP's or servlets.
Anyone know how to set the status code of the HTML page that I
redirected to?
Thanks in advance,
Jim
Jul 17 '05 #1
0 7635

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: PorkyJr | last post by:
Running an asp page that has the following code: <% response.Write MonthName(Month(date)) %> &nbsp; <% response.Write Day(date) %> ,
4
by: TomT | last post by:
Hi.. I'm redirecting users to another page using: response.redirect("newpage.asp") this works... But I need to add a variable to the page specified.. IE: newpage.asp?id=JobID
3
by: Raterus | last post by:
Anyone know how I can figure out the figure out the response.redirect trail a browser goes through when I'm using response.redirect on the server. Right now Internet Explorer just automatically...
9
by: postings | last post by:
Just a quick question... When I do a "response.redirect" from a source webpage to a destination webpage, does the code on the source webpage carry on executing unless I put a "response.end"...
2
by: Esa | last post by:
Hi, I'm having problems with one strange web system where submitting an application and making queries about its handling status require a series of form submits and response parsing - all in...
1
by: ss | last post by:
Hi, I would like to know like in ASP.NET 2.0 or .net version 2.0, how do I parse the XML and consume it?. right now I am using the old methods like XML DOM. second thing is I need to send...
0
by: ponvijaya | last post by:
Hi all, I have one requirement in my project. I need to download a file from the server tot the client machine. And after downloading it , it should be redirected to another jsp file. The...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
0
by: p vs np | last post by:
I face a very queer problem. I have written a simple servlet to gather information from a static HTML form and I wish to write to a Database (DB) if the record doesn't exist already. In order to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.