Hi, I know a question has been asked before about drools and servlets, so I apologise in advance. May someone please advice me on the best way of making Drools and servlets friends in my application ;-) I want to use drools to re-implement the servlet shown below. I have also attached the flow.
In brief my scenario works as follows: User submits a form to request info; result map is returned; if size >3 refine else return results. Refine will require a page to be generated asking user how to refine. The user answer will then be used to generate result. I have a feeling I might just need to add another node (e.g. event wait or human task) between the refine action and the rule flow group node. Would want to avoid that but not sure how will resume flow after refine. I would be grateful for any pointers. http://n3.nabble.com/forum/FileDownload.jtp?type=n&id=742273&name=flow.png public class GeneratorServlet extends HttpServlet { //declarations protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //declarations if(request.getAttribute("resultsMap") != null){ map = (Map) request.getAttribute("resultsMap"); //Render results i.e. present results to user if list is short if(map.size() <= maxOutput){ htmlPage.render(map, out, templatePath); } //list is long, ask how to shorten the list else if (map.size() > maxOutput){ dialogSession.setAttribute("storedResultsMap", map); htmlPage.refine(map, out, templatePath); } } else{ // resultsMap is null if(dialogSession.getAttribute("storedResultsMap")!= null){ map = (Map) dialogSession.getAttribute("storedResultsMap"); String criteriaSelection = request.getParameter("refineChoice"); if(criteriaSelection.equalsIgnoreCase("choice1")){ htmlPage.render(choice1Map, out, templatePath); } else if(criteriaSelection.equalsIgnoreCase("choice2")){ htmlPage.render(choice2Map, out, templatePath); } else { htmlPage.render(map, out, templatePath); } } } } -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Newbie-on-drools-and-servlets-tp742273p742273.html Sent from the Drools - User mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
