views:

169

answers:

1
*  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, which i don't want. I've come across any navigation rule that accomplishes my request.

A: 

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.

BalusC
why a bean?! I thought mvc wanted pages to interface to servlets which in turn call the factored code you want.
simpatico
JSF is a MVC framework with the FacesServlet as the sole controller so that you basically end up with a bean as model and a JSP/Facelets page as view. Why adding another servlets? Sounds like as a servlet with tight coupled code. You should have a business/domain object which does the business task which in turn can be called from JSF bean or a "plain vanilla" servlet.
BalusC
but calling 'userManager.validate' is not it already business logic?
simpatico
What is it then doing in a servlet? A servlet is there to control, preprocess and postprocess HTTP requests, not to do business logic. Just call `userManager.validate` in your bean action.
BalusC