This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Is there a way to use in JSTL format tags?" title="" /> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Is there a way to use "prefix" with <fmt:setBundle> in JSTL format tags?" Watch "Is there a way to use "prefix" with <fmt:setBundle> in JSTL format tags?" New topic
Author

Is there a way to use "prefix" with <fmt:setBundle> in JSTL format tags?

Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
I'm reading up on the format tags of JSTL (1.2). I see that I can include a prefix tag with a <fmt:bundle> tag, such as:However, to use this, I would need to wrap all the JSP code inside the <fmt:bundle> tag.
On the other hand, I can use a <fmt:setBundle> tag at the top of the JSP page (and set the scope to, say session) and my JSP page will use this as the resource bundle. Using this, it seems I can't set a prefix, so I will have to specify my message tag as:Is there a way I can specify a message bundle to be used by the page and still be able to take advantage of the prefix tag without having to wrap my entire JSP page in the bundle tag?

By the way, do I understand correctly that without the prefix tag, my message key must include the fully-qualified package name of the resource file, as in com.package.Messages.messagekey, even when the bundle/setbundle tags include the fully-qualified resource name already? This seems redundant.

Thanks,
 
jQuery in Action, 2nd edition
 
subject: Is there a way to use "prefix" with <fmt:setBundle> in JSTL format tags?
 
Similar Threads
Using resource bundle as input for a custom tag
fmt: tag
fmt tag not working in error page
Display ActionMessage in JSP using fmt:message
fmt:message tag does not work with "bundle" param