Hi all,

This message is about the JSTL plugin from the Stripes-Stuff project,
and so is addressed to Oscar, but I am posting it on the ML because
others may want to follow the discussion and provide suggestions.

I'm in a situation where I need to use FreeMarker in a Stripes
project. For localization, I want to expose a resource bundle so that
I can pull out localized messages in my ftl templates, the equivalent
of the <fmt:message> tag. This is simple enough to do because FM has a
wrapper for ResourceBundle to expose its properties to a FM template.

Now, I was hoping to reuse Oscar's plugin which provides a nice way of
configuring a resource bundle for messages. Right now, the plugin is
somewhat tied to JSTL, however I'd like to avoid depending on the JSTL
since this project is on FM and I don't want a mixture of both.

There isn't too much that is JSTL-dependant in the plugin, and with a
little reorganization, it would be easy to factor out the common parts
into a more general localization package, while of course keeping the
jstl package so that it keeps working as before.

Here's what I'm thinking:

- Move the ResourceBundleFactory interface to the localization package
- Move the DefaultResourceBundleFactory class to the localization
package
- Create a BundleInterceptor class in the localization package. This
would essentially be the same as the current JstlBundleInterceptor,
except that there would be three methods for subclasses to optionally
override to do "whatever they want" with the resolved resource
bundle:

protected void setResourceBundle(HttpServletRequest, ResourceBundle,
    Locale)

protected void setErrorResourceBundle(HttpServletRequest,
    ResourceBundle, Locale, String errorBundleName)

protected void setFieldResourceBundle(HttpServletRequest,
    ResourceBundle, Locale, String fieldBundleName)

- Finally, JstlBundleInterceptor would subclass BundleInterceptor and
override those methods to provide the same behavior as before.

With this, I would be able to use DefaultResourceBundleFactory to
configure the resource bundle in a JSTL-independent way, and subclass
BundleInterceptor to set the ResourceBundle in the request, also
without depending on the JSTL.

Existing applications that use ResourceBundleFactory or
DefaultResourceBundleFactory would have to change their imports to the
new localization package.

What do you think?

Thanks,
Freddy
http://www.stripesbook.com


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to