Struts - Application.properties and ApplicationResources.properties

Java Guru's,
Could some one tell me the difference between Application.properties and ApplicationResources.properties and which one shd i use in my application.
Thank you in Advance ..

Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
<!-- Main resource bundle, contains errors and some generic stuff. -->
<message-resources parameter="com.company.app.MainResources"
     null="true"/>
<!-- Alternate resource bundle, contains some special things maybe. -->
<message-resources parameter="com.company.app.AltResources"
     key="altResourceKey" null="true" />
// and have the files...
appdir/WEB-INF/classes/com/company/app/MainResources.properties
appdir/WEB-INF/classes/com/company/app/AltResources.properties
// and use them with the bean:message tag...
<bean:message key="some.main.key" />
<bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app.

Similar Messages

  • Struts Application Properties

    I think this has been broached before, but if someone could restate the answer, I
              would be most obliged:
              It appears that WLS 6.1 SP2 does not load properties files (like the typical Struts
              Application.properties) when it loads a webapp. This leads to an exception in my
              Struts apps (that work fine on Tomcat 4.0.3) when it can't find any of the application
              tags.
              Anybody run into this?
              

    Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
    <!-- Main resource bundle, contains errors and some generic stuff. -->
    <message-resources parameter="com.company.app.MainResources"
         null="true"/>
    <!-- Alternate resource bundle, contains some special things maybe. -->
    <message-resources parameter="com.company.app.AltResources"
         key="altResourceKey" null="true" />
    // and have the files...
    appdir/WEB-INF/classes/com/company/app/MainResources.properties
    appdir/WEB-INF/classes/com/company/app/AltResources.properties
    // and use them with the bean:message tag...
    <bean:message key="some.main.key" />
    <bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app.

  • Struts and Application.properties

              I think this has been broached before, but if someone could restate the answer, I
              would be most obliged:
              It appears that WLS 6.1 SP2 does not load properties files (like the typical Struts
              Application.properties) when it loads a webapp. This leads to an exception in my
              Struts apps (that work fine on Tomcat 4.0.3) when it can't find any of the application
              tags.
              Anybody run into this?
              

    Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
    <!-- Main resource bundle, contains errors and some generic stuff. -->
    <message-resources parameter="com.company.app.MainResources"
         null="true"/>
    <!-- Alternate resource bundle, contains some special things maybe. -->
    <message-resources parameter="com.company.app.AltResources"
         key="altResourceKey" null="true" />
    // and have the files...
    appdir/WEB-INF/classes/com/company/app/MainResources.properties
    appdir/WEB-INF/classes/com/company/app/AltResources.properties
    // and use them with the bean:message tag...
    <bean:message key="some.main.key" />
    <bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app.

  • Application.Properties Loosing Content

    I am using Action.Properties to set error codes and display them as part of my validation.
    I am setting the Error in a Validate class using the following Syntax
    errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.FirstField.invalid"));
    I am routing control back to homepage incase of an error and printing the same using
    <html:errors/>
    This Works Just FIne, Until i re-build the application.
    Once i re-Build, the content in application.Properties disappears. Just Gone!
    Have you guys had the same problem or do i have the patent this rare finding, LOL

    If you are loosing the complete application.Properties file, the reason may be that you are putting this file at wrong place. I think you are putting it in classes folder and when you re build the complete application, all the existing files are flushed by the newly genrated class files. If you are using any advanced editor like WSAD, you should put this file in a package in Java Source. So that when you rebuild the project, it will be copied as it is in the classes folder. And accordingly you need to change the path of this file into struts-config.xml.

  • Application Properties file

    Hi,
    I have a java DC which should be able to read some application properties like
    mdm.servername
    mdm.repositoryname
    mdm.username
    I have tried using the ApplicationConfigHandler class in which I created a EAR and Web Module DC and when I run this web module dc as standalone, the properties file "sap.application.global.properties" gets loaded successfully.
    But when I call this webmodule Dc's method to load properties from a Java DC , all the properties are null.
    Is there any other way that I can load properties in java DC which can be modified without having to redeploy the java dc.
    Thanks
    MLS

    Hi
    Use [configuration services |https://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/frameset.htm] in order to created application-specific properties that can be modified at run-time.
    Good luck,
    Ola

  • Application.properties

    Hi,
    My application is based on struts frame work.
    I am writing application.properties file to Internationalize the messages.
    Now i am strucked in between. i want to add html tags between the messages in application.properties file
    for example...
    new.message=<table>
    <tr>
    <td>
    <li>Add name</li>
    <li>Add age</li>
    </td>
    </tr>
    </table>
    But when i used this in my actual JSP page like
    <bean:message key="new.message "/>. but its showing blank page. I want to know...can i use html tags in properties file. If so how can i achive it. please help me
    Thanks in advance

    all these should be in one line...there shouldnt be any breaks...
    new.message=<table><tr><td><li>Add name</li><li>Add age</li></td></tr></table>
    regards
    shanu

  • Application Properties in Webdynpro

    Hi,
    I need to use Application properties in my webdynpro application so that i can change some settings by using the Application XML.
    I add a Name and Value in the Application Properties and try to retieve the same using the following code.
    IWDApplicationPropertyInfo myCol = wdComponentAPI.getApplication().getApplicationInfo().findInApplicationProperties("TIMEIDHELP");
    wdContext.currentContextElement().setTimeID(myCol.getValue());
    I am always getting the answer as null.
    Can someone help me on this?
    Regards,
    Balaji

    Hi Stefan,
    It does work . But theproperty that i set here needs to be configured from outside the application.
    So i tried to change the value of the property in the xml file of Application properties and restart the dispatcher and my application from the admin tool and try to run the applciation but still the old value is picked up.
    Can you please help.
    The location of the xml file is
    ....\j2ee\cluster\server0\temp\webdynpro\public\local\DYNPro\webdynpro\Applications\com.test.DynApplication
    Regards,
    Balaji

  • Persistent global application properties

    Hi all,
    i would like to provide some global persistent properties for arbitrary applications (Web Dynpro, J2EE applications, whatever), which should be changeable at runtime by the applications themselves and should be consistent for the whole cluster. I could use the database and an own service for this but since i'm lazy, i searched the NW 04 documentation and found the chapter about <a href="http://help.sap.com/saphelp_nw04/helpdata/en/0d/7fcb4974874767be388007bf9e5c2a/frameset.htm">Application Configuration Management</a>. Each application gets it's own "appcfg" part, which seems to be freely changeable by the "owner application" of the configuration.
    So my questions are:
    1. Is this service dedicated to be used for general purposes or should i keep my hands off?
    2. Are changes propagated to all server nodes of a cluster (with some delay, as stated in the docs) to get consistent configuration data or is it restricted to the server node, where the changes have been committed?
    Thanks in advance.
    Regards
    Stefan

    Hi Stefan,
    >
    > So my questions are:
    >
    > 1. Is this service dedicated to be used for general
    > purposes or should i keep my hands off?
    Not at all. If j2ee-engine-application.xml is involved, this was intended to be used...
    > 2. Are changes propagated to all server nodes of a
    > cluster (with some delay, as stated in the docs) to
    > get consistent configuration data or is it restricted
    > to the server node, where the changes have been
    > committed?
    Definitely. If you find this working differently then this would be definitely a bug.
    Regards,
    Benny

  • Web DynPro Application properties Help.

    Hai All,
    I need help in how to use the Help menu text in the application properties, and parameters tab in the application.
    Thanks and Regards,
    G.Sreevathsava.

    Help Menu Text -  Text that is to be displayed as a browser window heading for the help link
    Parameters tab - refer this - http://help.sap.com/saphelp_nw70/helpdata/en/7b/fb57412df8091de10000000a155106/content.htm

  • Classic planning application properties

    Hello,
    How to view created classic planning application properties as what options had selected when creating application from Classic Application Wizard, Select, Calendar, Currencies, Plan Types, etc.
    Regards.

    One of the ways:
    Take a LCM export of planning application and have a look at ApplicationDefinition.xpad file.
    Once backup is done, you can find it at: in 11.1.2.1:
    Oracle\Middleware\user_projects\epmsystem1\import_export\<user>\<Dir>\resource\Configuration\Properties
    Cheers...
    Rahul S.

  • Can LabVIEW application properties (e.g. Callees) be accessed from visual studio (C++)?

    Hello folks,
    Can LabVIEW application properties such as "Callees" be accessed from C++?
    Best Regards,
    Chris

    chassan wrote:
    Hello folks,
    Can LabVIEW application properties such as "Callees" be accessed from C++?
    Best Regards,
    Chris
    You can enable the ActiveX interface in LabVIEW and use its Automation server interface. This interface exports a subset of the VI Server interface to ActiveX. A subset becauseof security concerns. You do not want an arbitrary ActiveX client (possibly remotely) to look at your entire project and change about anything they like.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • EPMA Deployment Issue - Parsing Application Properties...

    When I attempt to deploy application in EPMA get the following error. The applications will validate, but will not deploy. This error can be seen when attempting to deploy any of the applications in the environment. Please let me know if anyone has seen this issue. This is EPMA 11.1.2.2.
    [Apr 30, 2013 3:26:32 PM]: Parsing Application Properties...[Apr 30, 2013 3:26:32 PM]: null
    [Apr 30, 2013 3:26:32 PM]: An Exception occurred during Application deployment.

    Dear All,
    -Oracle has recommend us to apply patch 11.1.2.2.300 for our environment and from then we are facing series of issues
    and this is one among them.
    -We find that application cant deployed while doing that its giving an error.
    **_'Exception occurred during Application deployment'_.**
    -In log files that you mentioned i have checked there were no errors related to deployment.
    -We have raised an SR regarding the same issue, From last 4 days they are taking several details but could not able to provide solution.
    Thanks
    Bejagam Naveen

  • Planning application properties

    Hi,
    Can you please help on how to delete the planning-application properties under the administration tab--> Manage Properties --> Application Properties , i have added two properties, but i just wanted to delete those now. how can i delete.
    Thanks
    Suresh

    i tried it, but i can able to delete text from the cell, but can't able save. while i am trying to save at the time it saying "one or more duplication properties found.properties can't be saved to the system database".
    i can't able to delete entire column/row from the planning.
    Any other option other than this.
    Thanks
    Suresh
    Edited by: Suresh Reddy on Oct 28, 2010 8:48 AM

  • Struts application using wsad 5.0 - unable to Run on server

    Hi,
    I m developing a small struts application using WSAD 5.0.
    Here is the code
    index.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>ABC, Inc. Human Resources Portal</TITLE>
    </HEAD>
    <BODY background="F1_100.gif">
    <font size="+1">ABC, Inc. Human Resources Portal </font>
    </br>
    <hr width="100%" noshade="true">
    &#149;Add an Employee
    <br>
    &#149;
    <html:link forward="search">Search for Employees</html:link>
    <br>
    </BODY>
    </HTML>
    search.jsp
    <%@ 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" %>
    <html>
    <head>
    <title> ABC, Inc. Human Resources Portal - Employee Search</title>
    </head>
    <body>
    <font size="+1">
    ABC, Inc. Human Resources Portal - Employee Search
    </font><br>
    <hr width="100%" noshade="true">
    <html:errors/>
    <html:form action="/search">
    <table>
    <tr>
    <td align="right"><bean:message key="label.search.name"/></td>
    <td><html:text property="name"/></td>
    </tr>
    <tr>
    <td></td>
    <td>-- or --</td>
    </tr>
    <tr>
    <td align="right"><bean:message key="label.search.ssnum"/></td>
    <td><html:text property="ssnum"/>(xxx-xx-xxxx)</td>
    </tr>
    <tr>
    <td></td>
    <td><html:submit/></td>
    </tr>
    </table>
    </html:form>
    <logic:present name="searchForm" property="results">
    <hr width="100%" size="1" noshade="true">
    <bean:size id="size" name="searchForm" property="results"/>
    <logic:equal name="size" value="0">
    <center><font color="red"><b>No Employees Found</b></font></center>
    </logic:equal>
    <logic:greaterThan name="size" value="0">
    <table border="1">
    <tr>
    <th>Name</th>
    <th>Social Security Number</th>
    </tr>
    <logic:iterate id="result" name="searchForm" property="results">
    <tr>
    <td><bean:write name="result" property="name"/></td>
    <td><bean:write name="result" property="ssNum"/></td>
    </tr>
    </logic:iterate>
    </table>
    </logic:greaterThan>
    </logic:present>
    </body>
    </html>
    searchForm.java
    package minihr.forms;
    import java.util.List;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    * Form bean for a Struts application.
    * Users may access 3 fields on this form:
    * <ul>
    * <li>name - [your comment here]
    * <li>ssNum - [your comment here]
    * </ul>
    * @version      1.0
    * @author
    public class SearchForm extends ActionForm {
         private String name = null;
         private String ssNum = null;
        private List results = null;
          * Get Name
          * @return String
         public String getName() {
              return name;
          * Set Name
          * @param <code>String</code>
         public void setName(String name) {
              this.name = name;
          * Get SsNum
          * @return String
         public String getSsNum() {
              return ssNum;
          * Set SsNum
          * @param <code>String</code>
         public void setSsNum(String ssNum) {
              this.ssNum = ssNum;
          * Set Results
         public void setResults(List results){
              this.results=results;
          * get Results
         public List getResults(){
              return results;
         * Constructor
         public SearchForm() {}
         public void reset(ActionMapping mapping, HttpServletRequest request) {
              // Reset values are provided as samples only. Change as appropriate.
              name = null;
              ssNum = null;
              results = null;
         //validate form data.
         public ActionErrors validate(
              ActionMapping mapping,
              HttpServletRequest request) {
              ActionErrors errors = new ActionErrors();
              // Validate the fields in your form, adding
              // adding each error to this.errors as found, e.g.
              // if ((field == null) || (field.length() == 0)) {
              //   errors.add("field", new ActionError("error.field.required"));
              boolean nameEntered = false;
              boolean ssNumEntered = false;
              //Determine if name has been entered.
              if(name != null && name.length() > 0){
                   nameEntered = true;
              //Determine if social security number has been entered
              if(ssNum != null && ssNum.length() > 0){
                   ssNumEntered = true;
              /* validate that either name or ssnum has
               * been entered */
               if(!nameEntered && !ssNumEntered){
                    errors.add(null,new ActionError("error.search.criteria.missing"));
               /* validate format of ssnum if it has been entered */
               if(ssNumEntered && !isValidSsNum(ssNum.trim())){
                    errors.add("ssNum",
                       new ActionError("error.search.ssNum.invalid"));
              return errors;
         //validate format of social security number
         private static boolean isValidSsNum(String ssNum){
              if(ssNum.length() < 11){
                   return false;
              for(int i=0;i<11;i++){
                   if(i==3 || i==6){
                        if(ssNum.charAt(i) != '-'){
                             return false;
                   }else if("0123456789".indexOf(ssNum.charAt(i)) == -1){
                        return false;
              return true;
    searchAction.java
    package minihr.actions;
    import java.util.ArrayList;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import minihr.forms.SearchForm;
    import common.EmployeeSearchService;
    * @version      1.0
    * @author
    public class SearchAction extends Action {
         * Constructor
         public SearchAction() {}
         public ActionForward perform(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws Exception {
              EmployeeSearchService service = new EmployeeSearchService();
              ArrayList results;
              SearchForm searchForm = (SearchForm) form;
              //perform employee search based on what criteria was entered
              String name = searchForm.getName();
              if(name != null && name.trim().length() > 0)
                results = service.searchByName(name);
              else
                   results = service.searchBySsNum(searchForm.getSsNum().trim());
              //place search results in searchform for access by JSP.
              searchForm.setResults(results);
              //forward control to this actions input page
              return mapping.getInputForward();
    EmployeeSearchService.java
    package common;
    import java.util.ArrayList;
    import common.Employee;
    * @author Niharika
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class EmployeeSearchService {
         private static Employee[] employees =
              new Employee("samuel","123-45-6789"),
              new Employee("Robert","234-56-7890"),
              new Employee("smith","345-67-8901"),
              new Employee("Frank","456-78-9012")
         // search for employees by name
         public ArrayList searchByName(String name){
              ArrayList resultList = new ArrayList();
              for(int i=0; i<employees.length; i++)
                   if(employees.getName().toUpperCase().indexOf(name.toUpperCase()) != -1)
                        resultList.add(employees[i]);
              return resultList;
    // search for employee by social security number
    public ArrayList searchBySsNum(String ssNum){
         ArrayList resultList = new ArrayList();
         for(int i=0;     i<employees.length; i++)
              if(int i=0; i<employees.length; i++)
                   if(employee[i].getSsNum().equals(ssNum))
                        resultList.add(employees[i]);
              return resultList;
    Employee.java
    package common;
    * @author Niharika
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class Employee {
    private String name;
    private String ssNum;
    public Employee(String name,String ssNum)
         this.name=name;
         this.ssNum=ssNum;
    public void setName(String name)
         this.name=name;
    public String getName()
         return name;
    ApplicationResources.properties
    # Label Resources
    label.search.name=Name
    label.search.ssNum=Social Security Number
    # Error Resources
    error.search.criteria.missing=<li>Search Criteria Missing</li>
    error.search.ssNum.invalid=<li>Invalid Social Security Number</li>
    errors.header=<font color="red"><b>Validation Errors </b></font><ul>
    errors.footer=</ul><hr width="100%" size="1" noshade="true">
    In searchAction.java
    it is showing 2 errors
    public ActionForward perform(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws Exception {
    error is: Exception Exception is not compatible with throws clause in
    org.apache.struts.action.Action.Perform()
    Another error is shown at :
    return mapping.getInputForward();
    error is:
    method is undefined for typt org.apache.struts.action.ActionMapping
    please give me a solution for this watching the code
    i have opened the server perspective and started the server.
    next i am clicking run on server. There i am getting an error like this:
    Error Received while starting the server
    Reason:
    Launching the server failed:
    server port 9080 is in use.
    ORB bootstrap port 2809 is in use.
    SOAP connector port 8880 is in use.
    change each used port number to another unused port on the ports page of the server configuration editor. In case u have another websphere server running , you can try to increase each used port number by one and try again.please solve this problem

    Nothing at all to do with struts.
    Some of the ports that WSAD wants to use are already in use.
    Maybe you have a copy of websphere running already?
    If so stop that one, and try running again.

  • Internationalization in struts application

    Hi,
    I am trying to implement the multilingual in my struts application.I have done it successfully through browser setting.Now I want to select a language on my login page through drop down and then application should be opened in the choosen language. i.e. i want to change the locale through code.
    Can anybody suggest me what to do?

    I am preparing a multi language support for a project. I have 2
    resource file for now, these are ApplicationResource (for English words)
    and ApplicationResource s_de(for German words). And I have flag buttons
    when user login into system can see flags(German and English flags). I
    defined these resources files in struts-config, xml like this:
    <message-resources key="application" parameter="com. ps.action. common.config. ApplicationResou rces" />
    <message-resources key="german" parameter="com. ps.action. common.config. ApplicationResou rces_de" />
    and than, I use words from resource files like this:
    <bean:message bundle="application " key="issue.headerPa rt"/>
    I want to this: if user login into system user can see flags, than he
    can click flags, if he clicks German flag
    ApplicationResoirce s_de.properties file will be called and I will see
    <bean:message bundle="application " key="issue.headerPa rt"/>
    this in German. when I click German flag, bundle must be change to bundle="german" automatically. How I can do this?
    thx a lot

Maybe you are looking for

  • Slow network printing on Windows 2008 Server

    Hi, We are just testing/configuring a Windows 2008 (x64) server to replace an aging Windows 2000 file & print server. I have added the print services role and added a network TCP/IP printer (a HP Laserjet 2200). When I print to this printer from eith

  • Monitor out of calibration

    I've been successfully calibrating my Apple 20" display with Spyder3. A week ago my calibration went out- way out. Everything is posterized, there is no detail in the highlights or shadows. The brightness button(which I locked) is missing from the "D

  • New event - default times

    In month view when I double click on a day to create a new event the timings default to 2300 until 0000. I can't find any way to change these timings - can anyone help?

  • Regarding the path variable. somebody please help !!!

    I have a small problem, I have to change the path variable often. So I thought of creating two .bat files to change it when i needed. But the problem is in XP... set Path=%Path%;C:\myfolder; command doesnt seems to be working. Actually it doesnt chan

  • Getting the TextInput data

    This seems like it should be a no-brainer, but I can't find any examples and have been unsuccessful in my attempts. I want to capture the input text as a string and display it in a text box. <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns