About Question enthuware.jwpv6.2.1086 :

Moderator: admin

Post Reply
Posts: 9
Joined: Wed Jul 12, 2017 10:51 am

About Question enthuware.jwpv6.2.1086 :

Post by RumiJal »

if we use the attributes pageEncoding or contentType instead of errorPage with the same logic does the answer still the same?

Site Admin
Posts: 10024
Joined: Fri Sep 10, 2010 9:26 pm

Re: About Question enthuware.jwpv6.2.1086 :

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests