Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fmt tag not working

 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii,

Iam using jstl fmt tag to display message based on a key & value from applicationresources file .but it is not displaying the value(???mainMenu.Display??? ).
Here is the code that iam using to display it

<%@ page contentType="text/html" language="java"
import="java.util.*"%>
<%-- JSTL tag libs --%>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld"%>

<%-- Struts provided Taglibs --%>
<%@ taglib prefix="html" uri="/WEB-INF/struts-html-el.tld"%>
<%@ taglib prefix="bean" uri="/WEB-INF/struts-bean-el.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld"%>

<html>
<head>
<fmt:setBundle basename="ApplicationResources"/>
<title><fmt:message key="mainMenu.title"/></title>
</head>

help me in resolving this error, i have tried all the possibilities that are posted on different sites,but did not find any solution.

Thanks
krish
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld"%>

This is not the standard URI for the fmt tag set. You didn't extract the tld file from the jar and put it into WEB-INF did you?

What is the setup for your properties files?
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii,

I Have all the tld files in WEB-INF folder & all the jar files in lib directory.

but still geting the problem, not able to figure out the problem...

Please help me..

Thanks

krish
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by krish chaitu:
I Have all the tld files in WEB-INF folder & all the jar files in lib directory.

My point is that you should not have extracted the JSTL tld files from the jar files and placed them in WEB-INF. While that's not the cuase of your current issue, it will cause you other issues in the future. The container will find the tld files inside the jar files when you use the proper URI to reference them. Extracting them to WEB-INF is unecessary and will just help to gum up the works.

You still haven't answered my question about your properties files.
[ October 22, 2007: Message edited by: Bear Bibeault ]
 
krish chaitu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your help & iam able to resolve the error, as i have my properties file called ApplicationResources.properties inside classes & inside a package so iam not giving the absolute path to refer inside the
<fmt:setBundle basename="ApplicationResources"/>,so here i was having the problem,
now when i replaced it with my package declaration its now able to pick the properties file & display it when i changed it to <fmt:setBundle basename="com.src.java.ApplicationResources.

the properties file is defined in my struts config file as

<message-resourcesnull="false"
parameter="com.src.java.ApplicationResources"/>


Thanks
krish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic