Hey all
This post has to do with SPRING MVC +
JSF
I have a problem. I can not make the action method of <h:commandButton> to be invoked!
I tried every step from this link:
link but nothing worked.
They told me that it is not working BECAUSE THE URL TO THE PAGE IS MAPPED BY THE DispatcherServlet. I DON'T USE FOR MAPPING THE FacesServlet. So JSF does't do the job!
I post the files:
- The "web.xml"
- "my_template.xhtml", which calls the component "center_section.xhtml"
- In the "center_section.xhtml" I "ui:insert"
- In "my_page.xml" I "ui:define"
- Spring bean "MySpringBackingBean.java"
Firstly the "MySpringBackingBean.java"
The method is at the end.
I added setters (in a site someone said that with setters method was invoked). To me it did not work.
In "my_page.xml", I have 4 efforts that I tried:
Effort 1
- In this effort I have it without <f:ajax>. I just want simply to call the method.
After that I will make it update the "h:inputText" (that is why the next efforts have the <f:ajax>)
- ONLY IN THIS CASE, because there is no <f:ajax> tag, as it is WITH the <h:form> it gives me a page with this error:
"The origin server did not find a current representation for the target resource or is not willing to disclose that one exists"
- WITHOUT the <h:form> it does not give me the error page, but (of cource) it is does not call the bean method.
Effort 2,3,4
In these cases I have <f:ajax>. Or with <h:form> or without <h:form>, because of <f:ajax> it does NOT give me the error page as in the effort 1.
What ever I did, it was not making the method to be invoked.
- I put everything in <f:ajax> in the "render" attribute the id of the form "fff"
- I put the immediate="true", as in a site they said that it is the solution
In all of the cases it did not do the job. I tried all the possible combinations.
Something strange
Accidentally, I commented h:commandButton, and the other NOT commented, like in the "Effort 4".
In every page reload (not pressing the commandButton) the method was caught in breakpoint! I thought I solved it, but
googling I learned that using the "javax.faces.FACELETS_SKIP_COMMENTS==true" in the "web.xml", the issue was not solved.
Why the commented button's action EL is evaluated and the uncommented not evaluated with page reload?
Googling I found the case in "Effort 3". With this hidden input, it causes the same as the commented commandButton, but my issue remains!
Question
ANYONE Spring expert please who uses Spring+JSF, can help me to make this action method invoked in the Spring bean (or from ManagedBean) from my <h:commandButton>?
I follow all conditions in the previous link, are not followed?
They told me that it is not working BECAUSE THE URL TO THE PAGE IS MAPPED BY THE DispatcherServlet. I DON'T USE FOR MAPPING THE FacesServlet. So JSF does't do the job!
Thanks for your patience!
Following are the relative code snippets
I use in all cases the:
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:mc="http://xmlns.jcp.org/jsf/composite/my_components"
xmlns:p="http://primefaces.org/ui"