Can I not submit a form to a servlet from JSF?
* Unable to find matching navigation case with from-view-id '/home.xhtml' for action 'MemoServlet' with outcome 'MemoServlet'
I try to accomplish it through:
<h:commandButton type="submit" value="add" action="MemoServlet"/>
but all the tutorials in the world only do it with a bean开发者_StackOverflow, which i don't want. I've come across any navigation rule that accomplishes my request.
Why a servlet? What exactly is the functional requirement? Doesn't the servlet contain "too much" code which you could just refactor into a separate class and import/call that in both the original servlet and the JSF bean action method?
Anyway, to fix the particular problem, you need either a plain vanilla HTML <form>
element whose action
points to the servlet URL or to call ExternalContext#dispatch()
on the servlet URL inside the bean's action method.
精彩评论