Jsf 如何更改h:form的动作?

Jsf 如何更改h:form的动作?,jsf,action,Jsf,Action,我需要更改a的操作,因为我正在使用JQuery load加载div中的JSF页面,但是当我按下save按钮时,我完全重新加载了页面 Home.jsf <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES" "http://www.w3.org/TR/xhtml1/DTD

我需要更改a的操作,因为我正在使用JQuery load加载div中的JSF页面,但是当我按下save按钮时,我完全重新加载了页面

Home.jsf

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"  lang="es"><!--<![endif]-->
        <f:view contentType="text/html">
            <h:head>
                <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
                <title>Sistema de Seguimientos de Ciclos de Calidad</title>
                <meta name="description" content=""/>
                <meta name="viewport" content="width=device-width, initial-scale=1"/>

                <!-- Libreria jQuery -->
                <script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

                <!-- Acción sobre el botón con id=boton y actualizamos el div con id=capa -->
                <script type="text/javascript">
                    function cargar(desde)
                    {
                        $("#frame").load(desde);
                    }
                </script>


            </h:head>
    <h:body link="#000033">
          <ul>
              <li><a href="#" onclick="cargar('/sistema.ciclos.calidad/modulos/input/dpu.jsf')">Desafios Propios de la Unidad</a></li>

          </ul>
          <div id="frame" >

          </div>
</h:body>
</f:view>
</html>
这个页面上的dpu.jsf当我按save时,我会重新加载整个页面

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">

<h:head>
    <title></title>
</h:head>

<h:body>
    <h:form id="formulario">
    <h2>Meta</h2>
    <h:panelGrid columns="2">
        <h:outputLabel for="meta">Meta</h:outputLabel>
        <h:inputTextarea id="meta" readonly="true" cols="30" rows="20" value="#{cmiDetalle.cmi.meta}"></h:inputTextarea>
        <h:outputLabel for="nivel_logro">Nivel de Logro</h:outputLabel>
        <h:selectOneMenu id="nivel_logro" value="#{cmiDetalle.cmi.nivelLogro}">
            <f:selectItems value="#{util.nivelLogro}" var="nivel" itemLabel="#{nivel}" itemValue="#{nivel}"></f:selectItems>
        </h:selectOneMenu>
        <h:commandButton actionListener="#{cmiDetalle.updateCMI()}" value="Guardar"/>
    </h:panelGrid>
    </h:form>
</h:body>

</html>
要查看页面的源代码,生成的表单有一个我没有放的操作

<form id="formulario" name="formulario" method="post" action="/sistema.ciclos.calidad/modulos/input/cnaDetalle.jsf" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="formulario" value="formulario">

        <h2>Criterio</h2><table>
<label for="formulario:criterio">
Citerio</label><textarea id="formulario:criterio" name="formulario:criterio" cols="20" rows="10" readonly="readonly">1-Revisión y validación del perfil a lo menos una vez al año</textarea><label for="formulario:nivel_logro">
Nivel de Logro</label>
<select id="formulario:nivel_logro" name="formulario:nivel_logro" size="1"> <option value="0">0</option>
    <option value="25" selected="selected">25</option>
    <option value="50">50</option>
    <option value="75">75</option>
    <option value="100">100</option>
</select>
<input type="submit" name="formulario:j_idt14" value="Actualizar"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="6763485926333611189:-3375404461728497190" autocomplete="off">
</form>

如果您要使用另一个操作,则根本不使用,请使用普通。我已经尝试了,但不起作用,请重新加载整个页面。对不起,我的意思是,您应该使用普通HTML组件,而不使用JSF来完成此任务。只需使用字符串url=/sistema.ciclos.calidad/home.JSF解决了问题;FacesContext fc=FacesContext.getCurrentInstance;请尝试{fc.getExternalContext.redirecturl;}捕获IOException e{e.printStackTrace;}