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();
|
System.out.println(externalContext.getRequestParameterMap().getAttribute("helloForm:firstName"));
|
System.out.println(externalContext.getRequestParameterMap().getAttribute("helloForm:lastName"));
|
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
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user