[jboss-user] [JBoss Portal] - Re: How do I change from session to request?
do-not-reply at jboss.com
Fri Jul 21 08:42:31 EDT 2006
Since you address this to newbie, i want to mention that you should try to avoid casting that at all costs while writing components, this is mostly a hack.
We found enough components that do a cast from ExternalContext to HttpServletContext and then make the component unusable inside a portlet environment (for no technical reason). This is often not required, just a wish of the programmer to fall back to an API that he feels more comfortable with.
In your example, you could simply use:
| FacesContext context = FacesContext.getCurrentInstance();
| ExternalContext externalContext = context.getExternalContext();
And it will do the same thing but work in both environment.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959881#3959881
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959881
More information about the jboss-user