Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Zhang, Larry (L.)
Folks, this may be an off topic question, but I am curious to understand why.

We know that Http protocol has features such as Headers. Both response and request 
have HTTP headers. It is easy to get the headers in J2EE from a HttpServletRequest 
objects using getHeader() and/or getHeaders() methods, however, there is no 
corresponding methods in HttpServletResponse. What is the reasoning behind this design?

Thanks.

Larry Zhang

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Zhang, Larry (L.)
Richard,

Thanks for your answers. I think that makes great sense; though I still think to have 
getHeader() or getHeaders() may be helpful when doing debug for response object.

Larry

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 12:06 PM
To: Struts Users Mailing List
Subject: Re: Why there is no getHeader(String headerName) and
getHeaders() met hod in HttpServletResponse?


Larry,
I'll go out on a limb here and say that since the
response is being generated on the server by a servlet
or JSP, there is no need for getHeader() or
getHeaders() methods because the developer is setting
them. The HttpServletResponse interface has
addHeader() and addXXXHeader() methods to add headers
to the response. There is also the containsHeader()
method which returns a boolean.

-Richard

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 Folks, this may be an off topic question, but I am
 curious to understand why.
 
 We know that Http protocol has features such as
 Headers. Both response and request have HTTP
 headers. It is easy to get the headers in J2EE from
 a HttpServletRequest objects using getHeader()
 and/or getHeaders() methods, however, there is no
 corresponding methods in HttpServletResponse. What
 is the reasoning behind this design?
 
 Thanks.
 
 Larry Zhang
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: declaring action mappings at runtime

2003-10-29 Thread Zhang, Larry (L.)
If you want to find out which will be next page to go, you can create an ActionForward 
object and customize the parameter. 

-Original Message-
From: Martin Cooper [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 29, 2003 3:35 PM
To: [EMAIL PROTECTED]
Subject: Re: declaring action mappings at runtime



Ahmet ISIK [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 Is it possible to declare struts action mappings at runtime, and how?

No, it's not possible. The config is read in at application startup and is
then frozen. (The reason it's done this way is so that access to the config
does not need to be synchronised once the app is up and running, thus
leading to much improved overall performance.)

--
Martin Cooper


 Thanks in advance

 -- 
 Ahmet ISIK
 Ideal Teknoloji Bilisim Çözümleri A.S.- Iliskisel Is Kanali
 Yazilim Muhendisi
 http://www.idealteknoloji.com




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



configure default error page in web.xml

2003-09-30 Thread Zhang, Larry (L.)
HI,

I have a request to catch a Java Exception in the servlet and display an error page. 
The functionality requires that we display different error message for different 
exception.

A way to do this is to put try and catch logic in servlet, and if an Exception is 
caught, I do request.setAttribute(javax.servlet.jsp.jspExcetion,e), and then forward 
to jsp error page, where we check the type of exception implicit object. Based on this 
type, we display different error message. This is fine, but we are not going to use 
this approach.

The other way is to configure web.xml. We can configure an error page for specific 
Java exception. If the specific exception is raised to the web container, the 
configured error page will get called. My question is that is there any body  doing 
this way successfully?

Thanks.

Larry Zhang


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: configure default error page in web.xml

2003-09-30 Thread Zhang, Larry (L.)
I am thinking not to use struts.

I have this in my web.xml, but when there is an Exception in servlet, I couldn't see 
the error page as expected. Did you guys have any luck to have this work?

Thanks.


error-page
exception-typejava.lang.Exception/exception-type
locationerror.jsp/location
  /error-page



-Original Message-
From: Kris Schneider [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 4:02 PM
To: Struts Users Mailing List
Subject: RE: configure default error page in web.xml


You can certainly combine approaches to let a Struts action handle pretty much
any exception in the app. In web.xml:

error-page
  exception-typejava.lang.Exception/exception-type
  location/do/error/location
/error-page

Where /do/error is obviously a Struts action mapping path.

Quoting Mike Jasnowski [EMAIL PROTECTED]:

 It's too bad you couldn't forward that to an Action, which could then
 forward it to a custom page, or rethrow so a Struts exception handler could
 grab it.
 
 -Original Message-
 From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 30, 2003 3:13 PM
 To: Struts Users Mailing List
 Subject: configure default error page in web.xml
 
 
 HI,
 
 I have a request to catch a Java Exception in the servlet and display an
 error page. The functionality requires that we display different error
 message for different exception.
 
 A way to do this is to put try and catch logic in servlet, and if an
 Exception is caught, I do
 request.setAttribute(javax.servlet.jsp.jspExcetion,e), and then forward
 to
 jsp error page, where we check the type of exception implicit object. Based
 on this type, we display different error message. This is fine, but we are
 not going to use this approach.
 
 The other way is to configure web.xml. We can configure an error page for
 specific Java exception. If the specific exception is raised to the web
 container, the configured error page will get called. My question is that
 is
 there any body  doing this way successfully?
 
 Thanks.
 
 Larry Zhang

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



error page

2003-01-13 Thread Zhang, Larry (L.)

I am using struts 1.1b3. When the validation fails, the error can be shown on the page 
using html:errors. Now I have an action form page(say book.jsp, on this page there 
is a  required field-- book title), I want an error.jsp, when the validation (example, 
title field is null) fails, the error page is invoked. 

I tried to define a forward attribute in struts-config.xml and put the target of it 
as the error.jsp, but struts still shows the action form page (book.jsp) when 
validation fails. However, when validation passes, the error.jsp is invoked correctly.

Any ideas on How to invoke an error.jsp when the validation fails?

Thanks.

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: error page

2003-01-13 Thread Zhang, Larry (L.)
I used the struts validator CheckFields. 

Here is the entries in validation.xml

formset
form name=bookForm
field property=title depends=required
arg0 key=bookForm.title/
 /field
  /form
/formset 


Here is the entries in validation-rules.xml

validator name=required
classname=org.apache.struts.validator.FieldChecks
   method=validateRequired
   methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   javax.servlet.http.HttpServletRequest
  msg=errors.required
/validator

The FieldChecks is the struts default validator for required field.

Thanks.


-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 13, 2003 1:05 PM
To: 'Struts Users Mailing List'
Subject: RE: error page


My first thought is that if you are testing for null, you will never trap an
error.  Form objects are passed as Strings - empty or not.  Test for
titleField.length()  0 rather than != null.

Mark

-Original Message-
From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 13, 2003 12:37 PM

I am using struts 1.1b3. When the validation fails, the error can be shown
on the page using html:errors. Now I have an action form page(say
book.jsp, on this page there is a  required field-- book title), I want an
error.jsp, when the validation (example, title field is null) fails, the
error page is invoked. 

I tried to define a forward attribute in struts-config.xml and put the
target of it as the error.jsp, but struts still shows the action form page
(book.jsp) when validation fails. However, when validation passes, the
error.jsp is invoked correctly.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]