h:commandButton调用操作但不重定向

时间:2015-11-20 14:43:31

标签: ajax http jsf jsf-2

我有一个与方法关联的h:commandButton,在单击按钮时执行了action方法,但是没有重定向。

' xhtml片段'

<h:commandButton id="update" value="save"
    onclick="if( validate('submitForm')==true){ updateProperty();} else{ return false;}"
    action="#{propertyBean.update}"
    class="btn btn-green btn-lg arabic"
    rendered="#{propertyBean.isNew == false}">
    <f:param name="propertyId" value="#{propertyBean.property.id}">
    </f:param>
</h:commandButton>

&#39; bean片段&#39;

  public String update() {
        System.out.println("in update method");
        return "/success.xhtml";
    }

更新

这是网络监视器的一个片段,即使显示的页面和浏览器中的URL错误,响应也是正确的

POST /Newgar_revamp/pages/add.xhtml HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 2207
Pragma: no-cache
Cache-Control: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost:8080
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryFE3725BjJXsA1xKf
Referer: http://localhost:8080/Newgar_revamp/pages/add.xhtml?propertyId=3
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6,ar;q=0.4
Cookie: JSESSIONID=B81FF21F23988CC8C98D84DA14B36F54


HTTP/1.1 302 Found
Server: Apache-Coyote/1.1
Location: http://localhost:8080/Newgar_revamp/pages/status/success.xhtml
Content-Length: 0
Date: Fri, 20 Nov 2015 21:24:32 GMT

0 个答案:

没有答案