开发者

Can I not submit a form to a servlet from JSF?

开发者 https://www.devze.com 2022-12-31 23:34 出处:网络
*Unable to find matching navigation case with from-view-id \'/home.xhtml\' for action \'MemoServlet\' with outcome \'MemoServlet\'
*  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.

0

精彩评论

暂无评论...
验证码 换一张
取 消