Sep 13, 2012

Error: javax.servlet.jsp.JspException: Missing message for key "label.common.button.submit" in bundle "(default bundle)" for locale en_US

Description:

We get this error while using ApplicationResources.properties file and using the entry as below
<message-resources parameter="resources.ApplicationResources"/> (where the property file name is ApplicationResources.properties). The folder "resources" is in classpath, at the same level as the "src" folder in Eclipse IDE.

Solution:

The path mentioned in the struts-config file for the ResourceBundle should be in sync with where it is found within the /WEB-INF file in the classpath, in the ".war" file that was deployed (or) in the Eclipse IDE.

<message-resources parameter="ApplicationResources"/> 

Error: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE

Description:

Struts is unable to find message resources. This issue occurs while using the Message Resources/Property files/Application Resources file

Solution:

Add the message-resources tag to the struts-config.xml file:
<message-resources parameter="resources.common.Common" />

Error: java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null

Description:

While using a Form with input fields, we get this error
<action path="/Login"
          name="userForm"
          type="com.dct.struts.learning.actions.UserAction">
          <forward name="success" path="/pages/login.jsp"></forward>
</action>

Solution:

This means after doing a validation, we need to specify where to be forwarded, incase of a failure. Hence the parameters "validate" and "input"(place from where it comes & to where it needs be forwarded) should be specified.
<action path="/Login"
           name="userForm"
           type="com.dct.struts.learning.actions.UserAction"
           validate="true"
           input="/login.jsp">
           <forward name="success" path="/pages/login.jsp"></forward>
</action>

Sep 11, 2012

Error : Struts1.x - Unable to add taglib tag in web.xml

Description:
When we add the <taglib> to the web.xml file, it keeps showing error.

<taglib>
       <taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
       <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
 </taglib>

Solution:
Enclose it within the <jsp-config> tag:

<isp-config>
       <taglib>
             <taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
             <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
       </taglib>
</jsp-config>