[rules-users] Drools in a web application

forsakendoll forsakendoll at hotmail.com
Sat Nov 9 06:28:02 EST 2013


I'm already reading your code while waiting for response here. Actually Its a
bit big project for me to start and I'm also new to Spring MVC so its really
hard for me to read this code too. I'm using annotation for controllers and
I don't see one in yours. Correct me if I'm wrong what I'm expecting is:

1. From the user interaction through the page it will send a request to the
controller.
2. From the controller a bean will be send to the .drl file which have
rules.
3. Update or send back some data to the controller ( this one is I don't
really have the idea of how can I do this )
4. Add to the model attribute the data that has been send by .drl file.

Please correct me if I'm wrong. And please guide me a bit more to this.


Stephen Masters wrote
> Given that you’re using Spring MVC, this might be a reasonable example:
> 
> 	https://github.com/gratiartis/sctrcd-payment-validation-web
> 
> It has examples of doing this for a simple validation, with a stateless
> session.
> 
> i.e.
> Request goes to Spring MVC controller.
> Controller invokes a service bean, which wraps a knowledge base.
> Rule based validator inserts a fact and executes rules.
> 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.
> The rule based validator returns a result object to the service.
> The service returns a result object to the controller.
> The controller returns a JSON object to the client.
> 
> Hopefully it’s not too difficult to find your way around the project.
> 
> To try it out:
> git clone https://github.com/gratiartis/sctrcd-payment-validation-web
> cd sctrcd-payment-validation-web
> mvn clean install tomcat7:run
> curl http://localhost:9090/iban/validate/GB29NWBK60161331926819
> Change a couple of characters in the IBAN on another curl to see a
> rejection.
> 
> 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.
> 
> Steve
> 
> 
> On 9 Nov 2013, at 09:24, forsakendoll <

> forsakendoll@

> > wrote:
> 
>> I'm very new to drools. I know this question is really a noob question
>> but
>> please bear with me. I'm using Spring MVC and I want to integrate drools
>> expert to my project. What I've done so far is to integrate the hello
>> world
>> sample of drools expert. But now what I want to do is:
>> 
>> 1. Send a bean to the rules for it to evaluate.
>> 2. Modify the bean depending on the rules
>> 3. Send it back to the controller to make a response to the user.
>> 
>> I was able to do the number 1. But for number 2 and 3. I don't know how
>> to
>> do it. I want to have a nested rule. But now I'm only capable of doing
>> this
>> rule:
>> 
>> global String $test;
>> 
>> rule "Excellent"
>> 
>>    when
>>        $m: FLTBean ( listeningScore > 85 )
>>        $p: FLTBean ( listeningScore < 101 )
>>    then
>>        $test = "Excellent";
>>        System.out.println( $test );
>> 
>> end
>> 
>> I don't know yet how can I make a nested rule. Please give me a simple
>> example that a newbie like me can understand.
>> 
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Drools-in-a-web-application-tp4026704.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> 

> rules-users at .jboss

>> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> _______________________________________________
> rules-users mailing list

> rules-users at .jboss

> https://lists.jboss.org/mailman/listinfo/rules-users





--
View this message in context: http://drools.46999.n3.nabble.com/Drools-in-a-web-application-tp4026704p4026707.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list