我有一個非常痛苦的問題。無法在網上找到解決方案。我使用Spring 3.0與JSF和PrimeFaces Spring Security配置,也有Spring Web Flow的配置(但我沒有在這個例子中使用它)。Spring PrimeFaces selectOneMenu submit發送給我405 - 不支持請求方法'POST'
這是我想要實現的行爲: 用戶從p:selectOneMenu中選擇一個值,並在變更時提交。然後,該值將發送給Bean,並在那裏進行更改。 效果:使用號碼:selectOneMenu用於我的的UserBean
內改變價值實現所有後,我得到了它說的錯誤:
HTTP Status 405 - Request method 'POST' not supported
選擇一個菜單是這樣寫的是:
<f:view>
<h:form id="formUserChange" >
<p:panelGrid columns="2">
<p:selectOneMenu id="chooseUserType" onchange="formUserChange.submit();"
value="#{userBean.userType}" valueChangeListener="#{userBean.processValueChange}"
style="padding: 0px 5px; font-size: 13px; width: 200px;" >
<f:selectItem itemLabel="Option 1" itemValue="KO" />
<f:selectItem itemLabel="Option 2" itemValue="KJ" />
</p:selectOneMenu>
</p:panelGrid>
</h:form>
</f:view>
豆放置像這樣:
@ManagedBean(name = "userBean")
@SessionScoped
public class UserBean implements Serializable, ValueChangeListener {
private static final long serialVersionUID = 1L;
private String userName = "Michal";
private String userType = "WO";
public UserBean() {
}
public String getUserName() {
System.out.println("I got now " + userType);
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
System.out.println("I set user as " + userType);
}
@Override
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException {
System.out.println("I have got " + userType);
}
}
在一個例子中,網絡上發現,傢伙說,valueChangeListener是不需要的,因爲值=「#{userBean.userType}」將做的伎倆,但它不是這個問題,我嘗試都沒有效果。
該值完全沒有改變。我知道在控制檯上豆作品,但得到了控制檯上的錯誤:
18:09:26,565 INFO [stdout] (http-localhost-127.0.0.1-8080-4) I got now WO
18:09:28,537 WARN [org.springframework.web.servlet.PageNotFound] (http-localhost-127.0.0.1-8080-4) Request method 'POST' not supported
而且也是我的頁面(如在開始提到的):
HTTP Status 405 - Request method 'POST' not supported
什麼我錯過了嗎?任何註釋或者某事物? 我沒有一點頭緒如果你使用Spring Webflow的則是不建議@ManagedBean標註出了什麼問題
您可以發佈您的web.xml和faces-config.xml?更像是一個配置問題。 – Kaalras