|
-
January 27th, 2003, 02:02 AM
#1
How to use JSP to modify HTTP response status code?
Hi, everyone!
Normal HTTP response status code is like this,
--------
HTTP/1.1 200 OK
--------
I want to use JSP to modify the status code like this,
--------
HTTP/1.1 666 OK
--------
How to do the job?
Thanks in advance,
George
-
January 27th, 2003, 05:36 AM
#2
Use HttpServletResponse.sendError(...).
Debugging is more difficult than coding. If you are as clever as you can be when coding, how can you ever hope to debug the code?
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
January 27th, 2003, 06:29 AM
#3
Thanks, dlorde pal!
I have tried your method, it really works, but
still do not serve my purpose entirely.
I want to modify the HTTP response code
--------
HTTP/1.1 200 OK
--------
to
--------
HTTP/1.1 666 hehe
--------
I use sendError(666, "hehe"),
but "hehe" displays in the body and not in the header.
What I want to do is to send error code (666) and error
message ("hehe") through the first line of HTTP response
header.
How to do that job?
Thanks in advance,
George
-
January 27th, 2003, 06:20 PM
#4
I don't know, George, it's not something I've had to do. Why not try all the likely looking HttpServletResponse 'header' methods? I don't know any other way to set response header data.
Sometimes trial and error is the best way...
The key to personal success is initiative...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
January 27th, 2003, 10:12 PM
#5
Thanks! Let me try!
BTW: If you have got the answer, please notify me!
:-)
Originally posted by dlorde
I don't know, George, it's not something I've had to do. Why not try all the likely looking HttpServletResponse 'header' methods? I don't know any other way to set response header data.
Sometimes trial and error is the best way...
The key to personal success is initiative...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|