2010/4/11 Christian Stone <[email protected]>: > I was very happy to upgrade my decorators and some of my action results to > Freemarker while using the new sitemesh plugin (being able to mix multiple > result handlers such as velocity and freemarker without having to switch them > all over at once). A huge gotcha I kept running in to was <result > type="velocity">myresultfile.ftl</result>. Note the Freemarker file and > velocity specification for the result. I kept running into this while doing > search/replace for certain files and forgetting the type specification while > migrating velocity files to Freemarker. What do you think about allowing a > specification of the result type, but if one isn't specified it will inspect > by extension and map it to a result type for you, defaulting to a base type > if it is unclear. If you take a page from Ibatis SqlMaps, you could > specify... > <typeAlias extension="vm" type="velocity" /> > <typeAlias extension="ftl" type="freemarker" /> > <typeAlias extension="xhtml" type="freemarker" /> <-- I use this > in Idea to keep from going insane when using Idea+Freemarker. > or > <typeAlias mapping="*.ftl" type="freemarker" /> > > Then you would not need quite so much configuration in your configuration :) > > <action name="index" class="myclass" method="list"> > <result>index.ftl</result> > <result name="error">myError.vm</result> > <result name="input">myError.jsp</result> > </action>
It's a brilliant solution in my opinion, please register an issue to not forget about that! > or how about defining default elements for all the Action.RESULT_TYPES > (success, input, error...) Note that you would still use the result element > for custom names... > > <action name="index" class="myclass" method="list"> > <success>index.ftl</success > > <error>myError.vm</error> > <input>myError.jsp</input> > <result name="myResult">myCustom.ftl</input> > </action> > > instead of... > > <action name="index" class="myclass" method="list"> > <result type="freemarker">index.ftl</result> > <result type="velocity" name="error">myError.vm</result> > <result type="velocity" name="input">myError.vm</result> > <result type="freemarker" name="myResult">myCustom.ftl</input> > </action> > > Opinions? I really believe the configuration is a bit heavy now, and > anything that leads to a reduction of the configuration text is a real boon. Hmm... I'm not sure but it also can be a nice future ;-) Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
