Ajuda com Seam - direcionar pagina [Resolvido]

1 resposta
alexfe

Não consigo direcionar para outra pagina após um envio de mensagem.

está é a pagina de envio de mensagem enviarmsg.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">
<h:form id="enviarmensagem" styleClass="edit">
<a:loadScript src="jquery/jquery.maskedinput-1.1.4.pack.js"/><!-- Declaração do caminho do arquivo Jquery para formatar InputText-->
	<rich:panel>
		<f:facet name="header">Contato</f:facet>		
			<s:decorate id="idnome" template="/layout/edit.xhtml">
				<ui:define name="label">Nome:</ui:define>		
				<h:inputText id="nomeid" 
				required="true"
				maxlength="100"
				size="50"
				value="#{emailusuarioHome.instance.nomeUser}">
				<a:support event="onblur" reRender="idnome" bypassUpdates="true" ajaxSingle="true"/>
			</h:inputText>									
			</s:decorate>
			
			<s:decorate id="idfone" template="/layout/edit.xhtml">
				<ui:define name="label">Telefone:</ui:define>		
				<h:inputText id="foneid" 				
				required="true"
				maxlength="15"
				size="15"
				value="#{emailusuarioHome.instance.telefone}">
				<a:support event="onblur" reRender="idfone" bypassUpdates="true" ajaxSingle="true"/>
				<rich:jQuery selector="#foneid" query="mask('([telefone removido]')" timing="onload"/>
			</h:inputText>									
			</s:decorate>
			
			<s:decorate id="idemaill" template="/layout/edit.xhtml">
				<ui:define name="label">email:</ui:define>		
				<h:inputText id="emaillid" 
				required="true"
				maxlength="50"
				size="50"
				value="#{emailusuarioHome.instance.email}">
				<rich:beanValidator/>
				<a:support event="onblur" reRender="idemaill" bypassUpdates="true" ajaxSingle="true"/>
			</h:inputText>									
			</s:decorate>
			<s:decorate id="idmsg" template="/layout/edit.xhtml">
				<ui:define name="label">Mensagem:</ui:define>		
				<h:inputTextarea id="msgid" 
				required="true"
				maxlength="500"
				size="60"
				value="#{emailusuarioHome.instance.msg}" style=" height : 96px; width : 459px;">
				<f:validateLength maximum="450"/>
				<rich:ajaxValidator event="onkeyup"/>
				<a:support event="onblur" reRender="idmsg" bypassUpdates="true" ajaxSingle="true"/>
			</h:inputTextarea>									
			</s:decorate>
       <div style="clear: both;">
        <span class="required">*</span>
        Campos Obrigatórios
       </div>
	</rich:panel>
	
	<div class="actionButtons">
		
	<h:commandButton
	id="idsalvar" 
	value="Salvar"
	action="#{emailusuarioHome.persist()}"
	disabled="#{!emailusuarioHome.wired}"/>
	
	
	<input type="button" value="Limpar" />
	
	<s:button value="Cancelar"
	 view="/home.xhtml" 
	 propagation="end"/>
		
	</div>
</h:form>
</ui:define>
</ui:composition>
este é o metodo
@Override
    public String persist() {
        String fone = getInstance().getTelefone();
        String fonesm = tm.TiraMascaraTelefone(fone);
        getInstance().setTelefone(fonesm);
     
    return super.persist();
    }
está é a pagina enviarmsg.page.xml
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd"
      view-id="/enviarmsg.xhtml">
 
 <navigation from-action="#{emailusuarioHome.persist}">
      <rule if-outcome="persisted">
         <redirect view-id="/confirmaMsgUserEnviada.xhtml"/>
      </rule>
   </navigation>
</page>
está é a pagina para qual deve ir após gravar a mensagem confirmarMsgUserEnviada.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">


<ui:define name="body">
    <rich:panel>
        <f:facet name="header">
        
        </f:facet>
        <h:graphicImage value="/img/button_ok.png"/>
		<h:outputText value="Mensagem enviada. Obrigado!" /> 
	</rich:panel>
</ui:define>
</ui:composition>

não consigo direcionar. Grava a mensagem e fica na mesma pagina.

1 Resposta

alexfe

Resolvido

faces-config.xml

<navigation-rule> <from-view-id>/enviarmsg.xhtml</from-view-id> <navigation-case> <from-outcome>persisted</from-outcome> <to-view-id>/confirmaMsgUserEnviada.xhtml</to-view-id> </navigation-case> </navigation-rule>

Criado 27 de janeiro de 2011
Ultima resposta 1 de fev. de 2011
Respostas 1
Participantes 1