Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem in reading the resource bundle in jsp in struts

843840Jun 29 2010 — edited Jun 30 2010
i got the following error when i try to read from resource
 org.apache.jasper.JasperException: java.lang.NullPointerException
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 

java.lang.NullPointerException
	org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1175)
	org.apache.struts.taglib.TagUtils.message(TagUtils.java:1038)
	org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)
	org.apache.jsp.HomePage_jsp._jspx_meth_bean_005fmessage_005f0(HomePage_jsp.java:120)
	org.apache.jsp.HomePage_jsp._jspService(HomePage_jsp.java:79)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

   
My Jsp File is
  
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
     <%@taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean" %>
     <%@taglib uri="/WEB-INF/struts-logic.tld"  prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	
	<form   action="DisplayInfo.do">
		
		<bean:message bundle="rsc" key="label.fName"/>
		<input type="Text" name="fName" /><br/>
		
		Last Name<input type="Text" name="lName"/><br/>	
		
		Email <input type="Text" name="email"/><br/>
		
		User Name<input type="Text" name="uName"/><br/>
		
		Password<input type="Password" name="pass"/><br/>
		
		<input type="Submit"/>
	</form>
</body>
</html>
  
and my struts-config.xml file is
 <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://struts.apache.org/dtds/struts-config_1_2.dtd">

 
 <struts-config>
 	<form-beans>
 		<form-bean name="actionForm-LogicalName" type="MyActionFormClass.UserInfoFormClass">
 		</form-bean>
 		
 	</form-beans>
 	
 	
 	<action-mappings>
 		
 		<action path="/DisplayInfo" type="MyActionClass.UserInfoActionClass"  name="actionForm-LogicalName" input="/HomePage.jsp"  >
 				<forward name="success" path="/success.jsp" />
 				<forward name="failure" path="/failure.jsp"  />
 		 </action>
 	
 	</action-mappings>
 	<message-resources key="rsc" parameter="resource.ApplicationResource"/>
 	
 </struts-config>
 
  
and my property file is
  label.fName=First Name  
i have given the property file path in classpath
and also in source folder
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2010
Added on Jun 29 2010
5 comments
1,621 views