You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kokro <fr...@tiscali.it> on 2007/08/16 15:51:57 UTC

Retriving values from a properties file using Struts 1.3.8

Hi all,

I'm developing a test application using Struts 1.3.8 and Java 1.5.0_12 and I
have this problem: when I try to get the value linked to the key
"login.title" I get this error:

 
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
 
 
3: <html>
4: 	<head>
5: 		<title>
6: 			<bean:message key="label.title"/>
7: 		</title>
8: 	</head>
9: 	<body>
 
 
Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
 
root cause 
 
java.lang.NullPointerException: Module 'null' not found.
	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)

org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1098)
	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
	org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)

org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:104)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 


If I have understood well it should mean that the properties file is
unreachable.

Below I post code fragments:

index.jsp

<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
	<head>
		<title>
			<bean:message key="label.title"/>
		</title>
	</head>
	<body>
		<br/>
			<bean:message key="label.insertNewSong"/>
		<br/>
		<html:link forward="searchSong">
			<bean:message key="label.searchSong"/>
		</html:link>
		<br/>
	</body>
</html>


web.xml

........
<taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
	    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
	    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
	    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
............


struts-config.xml

............
<!-- Message Resources Configuration -->
<message-resources
parameter="it.francesco.tutorial.utils.ApplicationResources"/>
..................


where ApplicationResources is the .properties file name.
Considering that I've already checked that each .tld and .xml file are in
the right place, what could be the problem? (If I dont use bean:message and
html:link but write values and use a href the page is displayed)?


Thanks a lot
-- 
View this message in context: http://www.nabble.com/Retriving-values-from-a-properties-file-using-Struts-1.3.8-tf4279774.html#a12181793
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Retriving values from a properties file using Struts 1.3.8

Posted by kokro <fr...@tiscali.it>.
>
> Please check location of property file
> It should be in "it.francesco.tutorial.utils" inside your web root
> WEB-INF\classes (i.e classpath)
>

The ApplicationResources.properties file is on that location and it has the
login.title key; infact I dont get the Missing message for key "label.title" 
error.

> Cause of error may be different 

java.lang.NullPointerException: Module 'null' not found.
	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)

org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1098)
	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
	org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)

org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:107)

This is a part of the stacktrace error
-- 
View this message in context: http://www.nabble.com/Retriving-values-from-a-properties-file-using-Struts-1.3.8-tf4279774.html#a12183033
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Retriving values from a properties file using Struts 1.3.8

Posted by Baseer Patel MD <Ba...@mphasis.com>.
Yes,
If file is at wrong location or key is missing then error will be >>
Missing message for key "label.title"

Cause of error may be different
-B

-----Original Message-----
From: kokro [mailto:fra.verona@tiscali.it] 
Sent: Thursday, August 16, 2007 7:41 PM
To: user@struts.apache.org
Subject: RE: Retriving values from a properties file using Struts 1.3.8


The ApplicationResources.properties file is into (being just a simple
application I have just copied the project into the webapps subdir
without
creating a .war file):

Tomcat 5.5.23 installation
dir\webapps\GestioneMP3\WEB-INF\classes\it\francesco\tutorial\utils

Is this what you meant Baseer? Thanks


Baseer Patel MD wrote:
> 
> Please check location of property file
> It should be in "it.francesco.tutorial.utils" inside your web root
> WEB-INF\classes (i.e classpath)
> 
> -----Original Message-----
> From: kokro [mailto:fra.verona@tiscali.it] 
> Sent: Thursday, August 16, 2007 7:22 PM
> To: user@struts.apache.org
> Subject: Retriving values from a properties file using Struts 1.3.8
> 
> 
> Hi all,
> 
> I'm developing a test application using Struts 1.3.8 and Java 1.5.0_12
> and I
> have this problem: when I try to get the value linked to the key
> "login.title" I get this error:
> 
>  
> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
>  
>  
> 3: <html>
> 4: 	<head>
> 5: 		<title>
> 6: 			<bean:message key="label.title"/>
> 7: 		</title>
> 8: 	</head>
> 9: 	<body>
>  
>  
> Stacktrace:
> 
>
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServle
> tWrapper.java:467)
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va:389)
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>  
>  
> root cause 
>  
> java.lang.NullPointerException: Module 'null' not found.
> 	
> org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
> 	
> org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
> 
>
org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java
> :1098)
> 	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
> 	
>
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)
> 
>
org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.jav
> a:104)
> 	org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
> 	
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>  
> 
> 
> If I have understood well it should mean that the properties file is
> unreachable.
> 
> Below I post code fragments:
> 
> index.jsp
> 
> <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <html>
> 	<head>
> 		<title>
> 			<bean:message key="label.title"/>
> 		</title>
> 	</head>
> 	<body>
> 		<br/>
> 			<bean:message key="label.insertNewSong"/>
> 		<br/>
> 		<html:link forward="searchSong">
> 			<bean:message key="label.searchSong"/>
> 		</html:link>
> 		<br/>
> 	</body>
> </html>
> 
> 
> web.xml
> 
> ........
> <taglib>
>             <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
> </taglib>
> <taglib>
> 	    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
> </taglib>
> ............
> 
> 
> struts-config.xml
> 
> ............
> <!-- Message Resources Configuration -->
> <message-resources
> parameter="it.francesco.tutorial.utils.ApplicationResources"/>
> ..................
> 
> 
> where ApplicationResources is the .properties file name.
> Considering that I've already checked that each .tld and .xml file are
> in
> the right place, what could be the problem? (If I dont use
bean:message
> and
> html:link but write values and use a href the page is displayed)?
> 
> 
> Thanks a lot
> -- 
> View this message in context:
>
http://www.nabble.com/Retriving-values-from-a-properties-file-using-Stru
> ts-1.3.8-tf4279774.html#a12181793
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Retriving-values-from-a-properties-file-using-Stru
ts-1.3.8-tf4279774.html#a12182124
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Retriving values from a properties file using Struts 1.3.8

Posted by kokro <fr...@tiscali.it>.
The ApplicationResources.properties file is into (being just a simple
application I have just copied the project into the webapps subdir without
creating a .war file):

Tomcat 5.5.23 installation
dir\webapps\GestioneMP3\WEB-INF\classes\it\francesco\tutorial\utils

Is this what you meant Baseer? Thanks


Baseer Patel MD wrote:
> 
> Please check location of property file
> It should be in "it.francesco.tutorial.utils" inside your web root
> WEB-INF\classes (i.e classpath)
> 
> -----Original Message-----
> From: kokro [mailto:fra.verona@tiscali.it] 
> Sent: Thursday, August 16, 2007 7:22 PM
> To: user@struts.apache.org
> Subject: Retriving values from a properties file using Struts 1.3.8
> 
> 
> Hi all,
> 
> I'm developing a test application using Struts 1.3.8 and Java 1.5.0_12
> and I
> have this problem: when I try to get the value linked to the key
> "login.title" I get this error:
> 
>  
> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
>  
>  
> 3: <html>
> 4: 	<head>
> 5: 		<title>
> 6: 			<bean:message key="label.title"/>
> 7: 		</title>
> 8: 	</head>
> 9: 	<body>
>  
>  
> Stacktrace:
> 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServle
> tWrapper.java:467)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va:389)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>  
>  
> root cause 
>  
> java.lang.NullPointerException: Module 'null' not found.
> 	
> org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
> 	
> org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
> 
> org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java
> :1098)
> 	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
> 	
> org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)
> 
> org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.jav
> a:104)
> 	org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
> 	
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>  
> 
> 
> If I have understood well it should mean that the properties file is
> unreachable.
> 
> Below I post code fragments:
> 
> index.jsp
> 
> <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <html>
> 	<head>
> 		<title>
> 			<bean:message key="label.title"/>
> 		</title>
> 	</head>
> 	<body>
> 		<br/>
> 			<bean:message key="label.insertNewSong"/>
> 		<br/>
> 		<html:link forward="searchSong">
> 			<bean:message key="label.searchSong"/>
> 		</html:link>
> 		<br/>
> 	</body>
> </html>
> 
> 
> web.xml
> 
> ........
> <taglib>
>             <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
> </taglib>
> <taglib>
> 	    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
> </taglib>
> ............
> 
> 
> struts-config.xml
> 
> ............
> <!-- Message Resources Configuration -->
> <message-resources
> parameter="it.francesco.tutorial.utils.ApplicationResources"/>
> ..................
> 
> 
> where ApplicationResources is the .properties file name.
> Considering that I've already checked that each .tld and .xml file are
> in
> the right place, what could be the problem? (If I dont use bean:message
> and
> html:link but write values and use a href the page is displayed)?
> 
> 
> Thanks a lot
> -- 
> View this message in context:
> http://www.nabble.com/Retriving-values-from-a-properties-file-using-Stru
> ts-1.3.8-tf4279774.html#a12181793
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retriving-values-from-a-properties-file-using-Struts-1.3.8-tf4279774.html#a12182124
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Retriving values from a properties file using Struts 1.3.8

Posted by Baseer Patel MD <Ba...@mphasis.com>.
Please check location of property file
It should be in "it.francesco.tutorial.utils" inside your web root
WEB-INF\classes (i.e classpath)

-----Original Message-----
From: kokro [mailto:fra.verona@tiscali.it] 
Sent: Thursday, August 16, 2007 7:22 PM
To: user@struts.apache.org
Subject: Retriving values from a properties file using Struts 1.3.8


Hi all,

I'm developing a test application using Struts 1.3.8 and Java 1.5.0_12
and I
have this problem: when I try to get the value linked to the key
"login.title" I get this error:

 
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
 
 
3: <html>
4: 	<head>
5: 		<title>
6: 			<bean:message key="label.title"/>
7: 		</title>
8: 	</head>
9: 	<body>
 
 
Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServle
tWrapper.java:467)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:389)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
 
root cause 
 
java.lang.NullPointerException: Module 'null' not found.
	
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
	
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)

org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java
:1098)
	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
	
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)

org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.jav
a:104)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
	
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 


If I have understood well it should mean that the properties file is
unreachable.

Below I post code fragments:

index.jsp

<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
	<head>
		<title>
			<bean:message key="label.title"/>
		</title>
	</head>
	<body>
		<br/>
			<bean:message key="label.insertNewSong"/>
		<br/>
		<html:link forward="searchSong">
			<bean:message key="label.searchSong"/>
		</html:link>
		<br/>
	</body>
</html>


web.xml

........
<taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
	    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
	    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
	    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
............


struts-config.xml

............
<!-- Message Resources Configuration -->
<message-resources
parameter="it.francesco.tutorial.utils.ApplicationResources"/>
..................


where ApplicationResources is the .properties file name.
Considering that I've already checked that each .tld and .xml file are
in
the right place, what could be the problem? (If I dont use bean:message
and
html:link but write values and use a href the page is displayed)?


Thanks a lot
-- 
View this message in context:
http://www.nabble.com/Retriving-values-from-a-properties-file-using-Stru
ts-1.3.8-tf4279774.html#a12181793
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Retriving values from a properties file using Struts 1.3.8

Posted by Laurie Harper <la...@holoweb.net>.
I suspect this is caused by accessing the JSP directly, without going 
through Struts. If you haven't already, try setting up an action mapping 
that forwards to the JSP (i.e. add <action path='...' 
forward='/path/to/jsp'/> to your action-mappings in struts-config.xml) 
and requesting the page through that.

L.

kokro wrote:
> Hi all,
> 
> I'm developing a test application using Struts 1.3.8 and Java 1.5.0_12 and I
> have this problem: when I try to get the value linked to the key
> "login.title" I get this error:
> 
>  
> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
>  
>  
> 3: <html>
> 4: 	<head>
> 5: 		<title>
> 6: 			<bean:message key="label.title"/>
> 7: 		</title>
> 8: 	</head>
> 9: 	<body>
>  
>  
> Stacktrace:
> 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>  
>  
> root cause 
>  
> java.lang.NullPointerException: Module 'null' not found.
> 	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
> 	org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
> 
> org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1098)
> 	org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
> 	org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)
> 
> org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:104)
> 	org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>  
> 
> 
> If I have understood well it should mean that the properties file is
> unreachable.
> 
> Below I post code fragments:
> 
> index.jsp
> 
> <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <html>
> 	<head>
> 		<title>
> 			<bean:message key="label.title"/>
> 		</title>
> 	</head>
> 	<body>
> 		<br/>
> 			<bean:message key="label.insertNewSong"/>
> 		<br/>
> 		<html:link forward="searchSong">
> 			<bean:message key="label.searchSong"/>
> 		</html:link>
> 		<br/>
> 	</body>
> </html>
> 
> 
> web.xml
> 
> .........
> <taglib>
>             <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
> </taglib>
> <taglib>
> 	    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
> 	    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
> </taglib>
> .............
> 
> 
> struts-config.xml
> 
> .............
> <!-- Message Resources Configuration -->
> <message-resources
> parameter="it.francesco.tutorial.utils.ApplicationResources"/>
> ...................
> 
> 
> where ApplicationResources is the .properties file name.
> Considering that I've already checked that each .tld and .xml file are in
> the right place, what could be the problem? (If I dont use bean:message and
> html:link but write values and use a href the page is displayed)?
> 
> 
> Thanks a lot


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org