page1.xhtml
<h:body>
<h:link outcome="page2.xhtml>
<f:param name="id" value="1"/>
</hlink>
</h:body>
page2.xhtml
<h:body>
<f:metadata>
<f:event type="preRenderView" listener="#{myBean.init}"/>
</f:metadata>
<ui:include src="#{myBean.myString}"/>
</h:body>
MyBean.java
public void init(ComponentsystemEvent e){
Map<String,String> params =
FacesContext.getExternalContext().getRequestParameterMap();
String myId = params.get("id");
int id = Integer.parseInteger(myId);
if(id==1)
setMyString = "myPage.xhtml";
}
While i am navigating from page1.xhtml to page2.xhtml i am sending an id as a parameter where according to this id i will display a page
the problem is that the page cannot be find
i am printing in console what's happening what i found is that it is evaluating getMyString() before going to preRenderView init so why is this happening like this
i also tried post construct it returned error in resource injection of managedBean