Re: Dispatching

"Shash Chatterjee" <[email protected]>
Newsgroups gmane.comp.java.keel.user
Message-ID <[email protected]>
Wlfredo,

> Is there any way where I can dispatch a certain
> action which has a corresponding method in a 
> single model?  This dispatching feature is 
> implemented in Struts.

Not sure what you are looking for.

You don't have to have just the Keel-provided ModelAction in Struts.  Any
Struts action, yours, could put the following code in the execute() method of
the Action class to access a Keel model (there has to be a "model=somemodel"
parameter in the request.

            WebappClientConnector kcc =
                new StrutsClientConnector(
                    request,
                    response,
                    form,
                    getServlet());
            kcc.setLogger(log);
            KeelResponse kres = kcc.execute();

Models themeselves have only one required method per the interface, exe
ute(...).  Are you saying you want a single model to handle all your Actions,
and that it would have multiple methods, one per Action? This is against the
grain of what the intent of a Model is.  But, you could do that with either a
if/then/else block or a case statement, depending on how many actions there
are and what type of parameter you passed to make the determination. Better
yet, you could use  parameter name to method name translation and use the Java
reflection API to make a dynamic call to the right method.

Shash
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.