incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harry Metske" <harry.met...@gmail.com>
Subject Re: LocalizationBundleFactory.ErrorMessageBundle
Date Tue, 13 Jan 2009 17:27:44 GMT
Andrew,

thanks for the explanation, good to have it here, I must have missed that
detail.
So, if I understand it correctly, it can be summarized as :

- All Stripes related messages to CoreResources (new, or copied from
templates.default)
- If not used anymore by JSPs, delete from templates.default.

And in this particular case, the profile.nameCollision should move from
templates.default to CoreResources.

regards,
Harry

2009/1/13 Andrew Jaquith <andrew.r.jaquith@gmail.com>

> Harry --
>
> Because of an earlier decision we made to move Stripes-related
> messages from the template bundles into CoreResources, I've been
> carefully doing some re-factoring of the resource bundles. The rules
> I've been using are these:
>
> (1) ActionBeans that need to emit messages should be put into
> CoreResources.
> (2) Field names used in stripes:* tags (e.g., stripes:label,
> stripes:input, stripes:submit etc.) should also be put into
> CoreResources
>
> Messages for these items are therefore copied from templates.default
> to CoreResources.
>
> (3) If the message isn't used anywhere else in the JSPs, I have also
> been deleting them from templates.default. I use grep to figure this
> out. Example:
>
> grep -r "login.password" src/templates
>
> If the grep turns up nothing, I figure it's safe to remove.
>
> (4) Stripes field names can be short ("loginname") or long
> ("com.ecyrd.jspwiki.action.UserProfileActionBean.loginname). Because
> most fields are likely to be re-used, I am renaming the message keys
> in CoreResources to use the short name in all cases except for submit
> buttons.
>
> (5) Above every renamed message key, I've placed a short comment
> indicating the previous (2.x) key name.
>
> If you are seeing messages on JSPs indicating that a resource can't be
> found, that generally means that I haven't moved the message key from
> templates.default to CoreResources, usually because I haven't gotten
> to it yet. For example, I haven't yet moved the message keys for group
> pages (Group.jsp), even though the JSPs themselves use Stripes tags.
>
> By the way, Harry, if you are feeling especially adventurous, I'd love
> to get some help on migrating the rest of the JSPs. It is basically a
> two-step process: move the scriptlet code into ActionBean handler
> methods & cleanup the top-level JSP, then modify JSP content pages to
> use the stripes tags.
>
> Andrew
>
> Andrew
>
> On Sun, Jan 11, 2009 at 2:05 PM, Harry Metske <harry.metske@gmail.com>
> wrote:
> > The current web.xml has the following defined for searching localizable
> > messages (Stripes) :
> >
> >      <init-param>
> >
> > <param-name>LocalizationBundleFactory.ErrorMessageBundle</param-name>
> >         <param-value>CoreResources</param-value>
> >      </init-param>
> >
> > Now, I found the following error during some initial testing :
> >
> > Jan 11, 2009 3:18:01 PM org.apache.catalina.core.ApplicationDispatcher
> > invoke
> > SEVERE: Servlet.service() for servlet
> > org.apache.jspwiki.jsp.templates.default_.ProfileTab_jsp threw exception
> > java.util.MissingResourceException: Could not find an error message with
> > key: profile.nameCollision
> >        at
> >
> net.sourceforge.stripes.validation.LocalizableError.getMessageTemplate(LocalizableError.java:109)
> >        at
> >
> net.sourceforge.stripes.action.SimpleMessage.getMessage(SimpleMessage.java:91)
> >        at
> >
> net.sourceforge.stripes.validation.SimpleError.getMessage(SimpleError.java:102)
> >        at
> > net.sourceforge.stripes.tag.ErrorsTag.doEndTag(ErrorsTag.java:349)
> >        at
> >
> org.apache.jspwiki.jsp.templates.default_.ProfileTab_jsp._jspService(Unknown
> > Source)
> >        at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> >        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > Adding to CoreResource.properties the following key:
> > profile.nameCollision=The {0} is already taken.
> >
> > solves the problem, but this key is already present in
> > templates/default.properties.
> >
> > Is this the intended solution, or should the default.properties be added
> to
> > LocalizationBundleFactory.ErrorMessageBundle, or something else ?
> >
> > regards,
> > Harry
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message