I've got very painful problem. Could not find solution on web.
I'm using Spring 3.0 with JSF and PrimeFaces Spring Security is configured, also have configuration for Spring Web Flow (but I'm not using it in this example).
Here is behavior I want to achieve: User choosing a value from p:selectOneMenu and it submits on change. Then the value is send for the Bean and it's being changed there as well. Effect: using p:selectOneMenu i changed value inside the userBean
After implementing all, I got an error which says:
HTTP Status 405 - Request method 'POST' not supported
Select One Menu is written like that :
<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>
Bean is placed like that:
@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);
}
}
On one example I've found on web, guy said that valueChangeListener is not needed because value="#{userBean.userType}" will do the trick, but its not the issue here, I tried both with no effect.
The value is not changing at all. I know that bean works on the console but got errors on the console:
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
And also I got the page (as mentioned at start):
HTTP Status 405 - Request method 'POST' not supported
What do I missed ? Any annotation or sth ? I don't got a clue what's wrong