File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes fmt tag not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "fmt tag not working" Watch "fmt tag not working" New topic
Author

fmt tag not working

krish chaitu
Ranch Hand

Joined: Oct 09, 2007
Posts: 32
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

Joined: Jan 10, 2002
Posts: 61315
    
  66

<%@ 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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
krish chaitu
Ranch Hand

Joined: Oct 09, 2007
Posts: 32
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

Joined: Jan 10, 2002
Posts: 61315
    
  66

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

Joined: Oct 09, 2007
Posts: 32
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
 
GeeCON Prague 2014
 
subject: fmt tag not working