Problems with pages.xml...
bkyrlach Jul 10, 2006 1:09 PMI'm replacing part of a struts web application with Seam and I'm having some strange problems with pages.xml
Problem one: I have a pages.xml that runs an action on pageload that grabs some request values and stores them in a session scoped Seam component so that I can use them later. However, when I preform any action on said page that would navigate me to a new page, the action defined for this page runs again. Since the request parameters are now lost, this results in all the values in my bean being nulled out, and my application throws null pointer exceptions.
pages.xml
<page view-id="/ben/infozap.xhtml" action="#{infozapAction.createInfoZapDTO}"/>
InfoZap action:
@Stateless
@Name("infozapAction")
@Interceptors(SeamInterceptor.class)
public class InfozapActionImpl implements InfozapAction
{
@RequestParameter
String[] schoolList;
@RequestParameter
String productAreaID;
@RequestParameter
String infozapType;
@RequestParameter
String productTypeID;
@Out
private InfoZapDTO izdto;
//@In(create=true)
//private Redirect redirect;
public void createInfoZapDTO()
{
izdto = new InfoZapDTO();
if(schoolList != null)
{
izdto.setSchoolList(schoolList);
}
if(productAreaID != null)
{
izdto.setProductAreaID(productAreaID);
}
if(infozapType != null)
{
izdto.setInfozapType(infozapType);
}
if(productTypeID != null)
{
izdto.setProductTypeID(productTypeID);
}
//redirect.setViewId("/ben/infozap.jsf");
//redirect.execute();
}
}
infozap.xhtml
...
<h:commandButton action="#{someActionClass.someAction}"/>
...
Problem two: In light of the above, I made a dummy page and edited the URL pattern in pages.xml to fire my action when the dummy page is navigated to. I edited the action to redirect to the correct page after it grabs the request values. I can see in my code that the method is fired, but even though I outject the member variable, after the redirect, it's no longer available
pages.xml
<page view-id="/ben/test.xhtml" action="#{infozapAction.createInfoZapDTO}"/>
InfoZap action:
same as above with redirect lines uncommented
Any help would be greatly appreciated.