Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!