Page 1 of 1

About Question enthuware.jwpv6.2.1086 :

Posted: Wed Jul 19, 2017 12:39 am
by RumiJal
if we use the attributes pageEncoding or contentType instead of errorPage with the same logic does the answer still the same?

Re: About Question enthuware.jwpv6.2.1086 :

Posted: Wed Jul 19, 2017 1:55 am
by admin
Yes, since in case of an "action", the two jsp files are compiled and executed separately. So each page can have its own content type setting. The javadoc API description for setContentType explains it clearly:
Sets the content type of the response being sent to the client, if the response has not been committed yet. The given content type may include a character encoding specification, for example, text/html;charset=UTF-8. The response's character encoding is only set from the given content type if this method is called before getWriter is called.
This method may be called repeatedly to change content type and character encoding. This method has no effect if called after the response has been committed. It does not set the response's character encoding if it is called after getWriter has been called or after the response has been committed.