<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Given that you’re using Spring MVC, this might be a reasonable example:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/gratiartis/sctrcd-payment-validation-web">https://github.com/gratiartis/sctrcd-payment-validation-web</a></div><div><br></div><div>It has examples of doing this for a simple validation, with a stateless session.</div><div><br></div><div>i.e.</div><div><ol class="MailOutline"><li>Request goes to Spring MVC controller.</li><li>Controller invokes a service bean, which wraps a knowledge base.</li><li>Rule based validator inserts a fact and executes rules.</li><li>Rules may or may not set an ‘isValid’ flag on the request. They may (or may not) also annotate that request fact to indicate which rules are rejecting it and why.</li><li>The rule based validator returns a result object to the service.</li><li>The service returns a result object to the controller.</li><li>The controller returns a JSON object to the client.</li></ol><div><br></div></div><div>Hopefully it’s not too difficult to find your way around the project.</div><div><br></div><div>To try it out:</div><div><ol class="MailOutline"><li>git clone&nbsp;<a href="https://github.com/gratiartis/sctrcd-payment-validation-web">https://github.com/gratiartis/sctrcd-payment-validation-web</a></li><li>cd sctrcd-payment-validation-web</li><li>mvn clean install tomcat7:run</li><li>curl&nbsp;<span style="font-family: Consolas, 'Liberation Mono', Courier, monospace; color: rgb(51, 51, 51); line-height: 19px;"><a href="http://localhost:9090/iban/validate/GB29NWBK60161331926819">http://localhost:9090/iban/validate/GB29NWBK60161331926819</a></span></li><li><span style="line-height: 19px;">Change a couple of characters in the IBAN on another curl to see&nbsp;</span><span style="line-height: 19px;">a rejection.</span></li></ol></div><div><br></div><div>btw - If anybody else fancies taking a look at it, please feel free to send criticism back to me. Either directly or to discuss on the mailing list. There’s so little out there in the way of documented good practice for using Drools, that I get the impression that everyone just finds their own way. So I would be happy to hear what others feel could be done to improve my little Spring MVC/Drools demo project.</div><div><br></div><div>Steve</div><div><br></div><br><div><div>On 9 Nov 2013, at 09:24, forsakendoll &lt;<a href="mailto:forsakendoll@hotmail.com">forsakendoll@hotmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I'm very new to drools. I know this question is really a noob question but<br>please bear with me. I'm using Spring MVC and I want to integrate drools<br>expert to my project. What I've done so far is to integrate the hello world<br>sample of drools expert. But now what I want to do is:<br><br>1. Send a bean to the rules for it to evaluate.<br>2. Modify the bean depending on the rules<br>3. Send it back to the controller to make a response to the user.<br><br>I was able to do the number 1. But for number 2 and 3. I don't know how to<br>do it. I want to have a nested rule. But now I'm only capable of doing this<br>rule:<br><br>global String $test;<br><br>rule "Excellent"<br><br> &nbsp;&nbsp;&nbsp;when<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$m: FLTBean ( listeningScore &gt; 85 )<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$p: FLTBean ( listeningScore &lt; 101 )<br> &nbsp;&nbsp;&nbsp;then<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$test = "Excellent";<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println( $test );<br><br>end<br><br>I don't know yet how can I make a nested rule. Please give me a simple<br>example that a newbie like me can understand.<br><br><br><br><br>--<br>View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-in-a-web-application-tp4026704.html">http://drools.46999.n3.nabble.com/Drools-in-a-web-application-tp4026704.html</a><br>Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></body></html>