velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: semi-on-topic question
Date Tue, 18 Sep 2001 09:04:37 GMT
On 9/18/01 2:46 AM, "Gabriel Sidler" <sidler@teamup.ch> wrote:

> piero de salvia wrote:
>> 
>> hi guys,
>> 
>> i have a question that only marginally relates to
>> Velocity, but it helps people that build sites with
>> Velocity I think.
>> 
>> what is the correct-truly-OO way of invoking methods
>> [besides Turbine] in response to form submittals ?
>> 
>> Is it reflection? That means form submits should be
>> named after Java methods. this seems to me poor
>> encapsulation, or brittle at least. Looking them up in
>> a hash ? And even so, after you look it up, say you
>> get a pointer to a class that has to do an if else
>> chain, right? Poor OO again.
> 
> Apache Struts maps URLs to instances of so called action
> classes. Action classes can be seen as request handlers or
> request targets. Its the hastable approach.
> Whether you have to use if-else-chains within the action
> classes depends on how fine grained your action classes are.
> I find its about finding a good compromise between the number
> of action classes and some if-else chains.
> For more complex applications, Struts offers an action class
> that uses reflection to dispatch requests to methods, thereby
> basically combining the hashtable approach with the reflection
> approach.
> 
> One very useful feature of Struts in this context is that
> one can define aliases for action classes. This introduces
> an optional layer of indirection in the mapping of URLs to
> action classes. I believe this would address some of your
> concerns about poor encapsulation.
> 
> I am currently working on a Struts-based project and find it
> a relatively simple and lightweight web app framework that
> provides strong MVC concepts.
> 
> Unfortunately the view component of Struts is currently very
> much JSP centric. However, I did spend some time a while ago
> to look into integration of Velocity/WebMacro with Struts. I know
> that Geir looked into this as well. I found that it would be
> quite easy to integrate Struts with Velocity and would not
> require any changes to Struts. This would be a very attractive
> combination of technologies for my work. It anyone else interested
> in this as well?

I think it would be great.  I did look into this a while ago and got things
working, and I know that there are others who have independently done the
same thing.

It seems perfectly possible to do this w/o any changes to the Struts core.
The challenges seem to be in accessing the basic tools/beans that struts
provides, such as the application error messages and such.

It sure would be fun to add this to our list of Velocity-supporting
frameworks :)

geir

-- 
Geir Magnusson Jr.     geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
If you look up, there are no limits - Japanese Proverb


Mime
View raw message