well first ill explain what im tryng to do, i have a index.xhtml page where i include menu.xhtml with a menubar of primefaces, in menu.xhtml in have a panel id=contenido where i want to update depending of the menuitem clicked, i already get update that panel but the problem is when i update to another page for example in default is home.xhtml and i update to enviarsol.xhtml then the command button from enviarsol.xhtml is not working, im new at this and i already tried some different ways of updating the panel, im thinking that the problem is that the bean of enviarsol.xhtml is not managed or something like that,also im doing this way because i want to refresh only that panel and not all the page, someone help me please.
首先生病解释我尝试做什么,我有一个index.xhtml页面,其中我包含menu.xhtml与菜单的菜单,在menu.xhtml中有一个面板id = contenido,我想根据menuitem点击更新,我已经获得更新该面板,但问题是,当我更新到另一个页面,例如在默认情况下是home.xhtml和我更新到enviarsol.xhtml然后enviarsol.xhtml的命令按钮不起作用,我新的在这和我已经尝试了一些不同的更新面板的方法,我认为问题是enviarsol.xhtml的bean没有被管理或类似的东西,我也这样做,因为我想只刷新那个面板,而不是所有的页面,有人帮我请。
index.xhtml:
<h:form>
<img src="resources/homeheader.jpg" width="300" height="113" alt="homeheader"/>
<div style="background-color: white">
<img src="resources/Logos.jpg" width="1024" height="166" alt="homeheader"/>
</div>
<p:panel id="centerpage" >
<ui:include src="WEB-INF/menu.xhtml"/>
</p:panel>
</h:form>`
menu.xhtml:
<p:menuitem value="Contactos" icon="ui-icon-arrowreturnthick-1-w" actionListener="#{bnmenu.btnEditarContacto(e)}" update="contenido"/>
<p:panel id="contenido" >
<ui:include src="#{bnmenu.url}"/>
</p:panel>
bnmenu.java:
private String url;
public bnmenu() {
url="home.xhtml";
}
public void btnEditarContacto(ActionEvent e)
{
url="enviarsol.xhtml";
}
home.xhtml:
<p:panelGrid columns="2" style="border-width: 0px">
<p:commandButton value="Consultar" actionListener="#{bnhome.btnlogin(e)}" update="txt1"/>
<p:inputText id="txt1" value="#{bnhome.txtUsuario}"/>
</p:panelGrid>
enviarsol.xhtml:
<p:panelGrid columns="2" style="border-width: 0px">
<p:outputLabel for="txtcorreo" value="Correo: "/>
<p:inputText id="txtcorreo" value="#{bnSolicitud.correo}"/>
<p:outputLabel for="txtmensaje" value="Mensaje: "/>
<p:inputText id="txtmensaje" value="#{bnSolicitud.mensaje}"/>
<p:commandButton value="Enviar" actionListener="#{bnSolicitud.btnSolicitar(e)}" update="messages"/>
</p:panelGrid>`
i included this:
我包括这个:
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
and now it is working but i dont know what more effects will this cause well now it works but only once when i click in commandbutton from enviarsol.xhtml Finally it appears working fine, i changed @RequestScoped by @SessionScoped in bnmenu
现在它正在工作,但我不知道更多的效果将导致现在它的工作,但只有一次,当我从enviarsol.xhtml点击命令按钮最后它似乎工作正常,我改变@RequestScoped由@SessionScoped在bnmenu
1 个解决方案
#1
0
Are you sure that you really want ajax navigation? It is very frustrating for a user not being able to use the browsers urlfield or navigation buttons, and it will be harder for you to code aswell. Consider transforming index.xhtml into a template file as described at http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example and using normal navigation.
你确定你真的想要ajax导航吗?对于不能使用浏览器urlfield或导航按钮的用户来说非常令人沮丧,并且你也很难编码。考虑将index.xhtml转换为模板文件,如http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example和使用常规导航所述。
#1
0
Are you sure that you really want ajax navigation? It is very frustrating for a user not being able to use the browsers urlfield or navigation buttons, and it will be harder for you to code aswell. Consider transforming index.xhtml into a template file as described at http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example and using normal navigation.
你确定你真的想要ajax导航吗?对于不能使用浏览器urlfield或导航按钮的用户来说非常令人沮丧,并且你也很难编码。考虑将index.xhtml转换为模板文件,如http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example和使用常规导航所述。