Why my Struts 1 I18N could not locate the properties files?












0















I am implementing a basic Struts 1 i18n web application and the expected output (multi-language.jsp) should be similar as screenshot below:



p.s. My project is only available in English & German, properties files are named as Common.properties & Common_de.properties respectively.



enter image description here



However, my application could not locate the properties files in project (located under src/properties/$Common_CountryCode.properties$). When I hit the application URL, console pops up some warnings:



Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en_US.properties Not Found.
Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en.properties Not Found.


But the fact is my project doesn't even have these two properties file in it. And again, when I click the preferred language, console pops up some info (not sure if it matters) and browser will shows 404--Not Found:



Nov 15, 2018 4:50:00 PM org.apache.struts.chain.ComposableRequestProcessor init
INFO: Initializing composable request processor for module prefix ''
Nov 15, 2018 4:50:01 PM org.apache.struts.chain.commands.servlet.CreateAction createAction
INFO: Initialize action of type: action.Action


This is my struts-config.xml



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>

<form-beans>
<form-bean
name="userForm"
type="form.Form"/>

</form-beans>

<action-mappings>

<action
path="/LoginPage"
type="org.apache.struts.actions.ForwardAction"
parameter="/WebRoot/multi-language.jsp"/>

<action
path="/Submit"
type="action.Action"
name="userForm"
validate="true"
input="/WebRoot/multi-language.jsp"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

<action
path="/Locale"
type="action.Action"
name="userForm"
parameter="method"
validate="false"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

</action-mappings>

<message-resources
parameter="properties.Common" />

</struts-config>


The multi-language.jsp



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>multi-language.jsp</title>
</head>
<body>
<h1><bean:message key="label.common.message" /></h1>

<html:messages id="err_name" property="common.username.err">
<div style="color:red">
<bean:write name="err_name" />
</div>
</html:messages>

<html:messages id="err_password" property="common.password.err">
<div style="color:red">
<bean:write name="err_password" />
</div>
</html:messages>
<br />
<br />

<html:link page="/Locale.do?method=english">English</html:link>
<html:link page="/Locale.do?method=german">German</html:link>


<html:form action="/Submit">
<br />
<bean:message key="label.common.username" /> : <html:text property="username" />
<br />
<br />
<bean:message key="label.common.password" /> : <html:text property="password" />
<br />
<br />

<html:submit><bean:message key="label.common.button.submit" /></html:submit>
</html:form>


</body>
</html>


Action.java (controller)



package action;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class Action extends DispatchAction {

public ActionForward german(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.GERMAN);

return mapping.findForward("success");
}

public ActionForward english(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.ENGLISH);

return mapping.findForward("success");
}
}


Form.java (view)



package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class Form extends ActionForm{
String username;
String password;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

if( getUsername() == null || ("".equals(getUsername())))
{
errors.add("common.username.err",
new ActionMessage("error.common.username.required"));
}

if( getPassword() == null || ("".equals(getPassword())))
{
errors.add("common.password.err",
new ActionMessage("error.common.password.required"));
}

return errors;
}

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
// reset properties
username = "";
password = "";
}
}


Apologize if too much of code up here, just wanna makes the scenario clear.










share|improve this question























  • "But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

    – Dave Newton
    Nov 15 '18 at 14:44











  • Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

    – Boosted Nub
    Nov 16 '18 at 0:29











  • Did you try putting the English properties in the file it's looking for them in?

    – Dave Newton
    Nov 16 '18 at 2:08











  • Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

    – Boosted Nub
    Nov 16 '18 at 2:20


















0















I am implementing a basic Struts 1 i18n web application and the expected output (multi-language.jsp) should be similar as screenshot below:



p.s. My project is only available in English & German, properties files are named as Common.properties & Common_de.properties respectively.



enter image description here



However, my application could not locate the properties files in project (located under src/properties/$Common_CountryCode.properties$). When I hit the application URL, console pops up some warnings:



Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en_US.properties Not Found.
Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en.properties Not Found.


But the fact is my project doesn't even have these two properties file in it. And again, when I click the preferred language, console pops up some info (not sure if it matters) and browser will shows 404--Not Found:



Nov 15, 2018 4:50:00 PM org.apache.struts.chain.ComposableRequestProcessor init
INFO: Initializing composable request processor for module prefix ''
Nov 15, 2018 4:50:01 PM org.apache.struts.chain.commands.servlet.CreateAction createAction
INFO: Initialize action of type: action.Action


This is my struts-config.xml



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>

<form-beans>
<form-bean
name="userForm"
type="form.Form"/>

</form-beans>

<action-mappings>

<action
path="/LoginPage"
type="org.apache.struts.actions.ForwardAction"
parameter="/WebRoot/multi-language.jsp"/>

<action
path="/Submit"
type="action.Action"
name="userForm"
validate="true"
input="/WebRoot/multi-language.jsp"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

<action
path="/Locale"
type="action.Action"
name="userForm"
parameter="method"
validate="false"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

</action-mappings>

<message-resources
parameter="properties.Common" />

</struts-config>


The multi-language.jsp



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>multi-language.jsp</title>
</head>
<body>
<h1><bean:message key="label.common.message" /></h1>

<html:messages id="err_name" property="common.username.err">
<div style="color:red">
<bean:write name="err_name" />
</div>
</html:messages>

<html:messages id="err_password" property="common.password.err">
<div style="color:red">
<bean:write name="err_password" />
</div>
</html:messages>
<br />
<br />

<html:link page="/Locale.do?method=english">English</html:link>
<html:link page="/Locale.do?method=german">German</html:link>


<html:form action="/Submit">
<br />
<bean:message key="label.common.username" /> : <html:text property="username" />
<br />
<br />
<bean:message key="label.common.password" /> : <html:text property="password" />
<br />
<br />

<html:submit><bean:message key="label.common.button.submit" /></html:submit>
</html:form>


</body>
</html>


Action.java (controller)



package action;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class Action extends DispatchAction {

public ActionForward german(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.GERMAN);

return mapping.findForward("success");
}

public ActionForward english(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.ENGLISH);

return mapping.findForward("success");
}
}


Form.java (view)



package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class Form extends ActionForm{
String username;
String password;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

if( getUsername() == null || ("".equals(getUsername())))
{
errors.add("common.username.err",
new ActionMessage("error.common.username.required"));
}

if( getPassword() == null || ("".equals(getPassword())))
{
errors.add("common.password.err",
new ActionMessage("error.common.password.required"));
}

return errors;
}

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
// reset properties
username = "";
password = "";
}
}


Apologize if too much of code up here, just wanna makes the scenario clear.










share|improve this question























  • "But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

    – Dave Newton
    Nov 15 '18 at 14:44











  • Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

    – Boosted Nub
    Nov 16 '18 at 0:29











  • Did you try putting the English properties in the file it's looking for them in?

    – Dave Newton
    Nov 16 '18 at 2:08











  • Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

    – Boosted Nub
    Nov 16 '18 at 2:20
















0












0








0








I am implementing a basic Struts 1 i18n web application and the expected output (multi-language.jsp) should be similar as screenshot below:



p.s. My project is only available in English & German, properties files are named as Common.properties & Common_de.properties respectively.



enter image description here



However, my application could not locate the properties files in project (located under src/properties/$Common_CountryCode.properties$). When I hit the application URL, console pops up some warnings:



Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en_US.properties Not Found.
Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en.properties Not Found.


But the fact is my project doesn't even have these two properties file in it. And again, when I click the preferred language, console pops up some info (not sure if it matters) and browser will shows 404--Not Found:



Nov 15, 2018 4:50:00 PM org.apache.struts.chain.ComposableRequestProcessor init
INFO: Initializing composable request processor for module prefix ''
Nov 15, 2018 4:50:01 PM org.apache.struts.chain.commands.servlet.CreateAction createAction
INFO: Initialize action of type: action.Action


This is my struts-config.xml



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>

<form-beans>
<form-bean
name="userForm"
type="form.Form"/>

</form-beans>

<action-mappings>

<action
path="/LoginPage"
type="org.apache.struts.actions.ForwardAction"
parameter="/WebRoot/multi-language.jsp"/>

<action
path="/Submit"
type="action.Action"
name="userForm"
validate="true"
input="/WebRoot/multi-language.jsp"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

<action
path="/Locale"
type="action.Action"
name="userForm"
parameter="method"
validate="false"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

</action-mappings>

<message-resources
parameter="properties.Common" />

</struts-config>


The multi-language.jsp



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>multi-language.jsp</title>
</head>
<body>
<h1><bean:message key="label.common.message" /></h1>

<html:messages id="err_name" property="common.username.err">
<div style="color:red">
<bean:write name="err_name" />
</div>
</html:messages>

<html:messages id="err_password" property="common.password.err">
<div style="color:red">
<bean:write name="err_password" />
</div>
</html:messages>
<br />
<br />

<html:link page="/Locale.do?method=english">English</html:link>
<html:link page="/Locale.do?method=german">German</html:link>


<html:form action="/Submit">
<br />
<bean:message key="label.common.username" /> : <html:text property="username" />
<br />
<br />
<bean:message key="label.common.password" /> : <html:text property="password" />
<br />
<br />

<html:submit><bean:message key="label.common.button.submit" /></html:submit>
</html:form>


</body>
</html>


Action.java (controller)



package action;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class Action extends DispatchAction {

public ActionForward german(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.GERMAN);

return mapping.findForward("success");
}

public ActionForward english(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.ENGLISH);

return mapping.findForward("success");
}
}


Form.java (view)



package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class Form extends ActionForm{
String username;
String password;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

if( getUsername() == null || ("".equals(getUsername())))
{
errors.add("common.username.err",
new ActionMessage("error.common.username.required"));
}

if( getPassword() == null || ("".equals(getPassword())))
{
errors.add("common.password.err",
new ActionMessage("error.common.password.required"));
}

return errors;
}

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
// reset properties
username = "";
password = "";
}
}


Apologize if too much of code up here, just wanna makes the scenario clear.










share|improve this question














I am implementing a basic Struts 1 i18n web application and the expected output (multi-language.jsp) should be similar as screenshot below:



p.s. My project is only available in English & German, properties files are named as Common.properties & Common_de.properties respectively.



enter image description here



However, my application could not locate the properties files in project (located under src/properties/$Common_CountryCode.properties$). When I hit the application URL, console pops up some warnings:



Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en_US.properties Not Found.
Nov 15, 2018 4:45:20 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource properties/Common_en.properties Not Found.


But the fact is my project doesn't even have these two properties file in it. And again, when I click the preferred language, console pops up some info (not sure if it matters) and browser will shows 404--Not Found:



Nov 15, 2018 4:50:00 PM org.apache.struts.chain.ComposableRequestProcessor init
INFO: Initializing composable request processor for module prefix ''
Nov 15, 2018 4:50:01 PM org.apache.struts.chain.commands.servlet.CreateAction createAction
INFO: Initialize action of type: action.Action


This is my struts-config.xml



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>

<form-beans>
<form-bean
name="userForm"
type="form.Form"/>

</form-beans>

<action-mappings>

<action
path="/LoginPage"
type="org.apache.struts.actions.ForwardAction"
parameter="/WebRoot/multi-language.jsp"/>

<action
path="/Submit"
type="action.Action"
name="userForm"
validate="true"
input="/WebRoot/multi-language.jsp"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

<action
path="/Locale"
type="action.Action"
name="userForm"
parameter="method"
validate="false"
>
<forward name="success" path="/WebRoot/multi-language.jsp"/>
</action>

</action-mappings>

<message-resources
parameter="properties.Common" />

</struts-config>


The multi-language.jsp



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>multi-language.jsp</title>
</head>
<body>
<h1><bean:message key="label.common.message" /></h1>

<html:messages id="err_name" property="common.username.err">
<div style="color:red">
<bean:write name="err_name" />
</div>
</html:messages>

<html:messages id="err_password" property="common.password.err">
<div style="color:red">
<bean:write name="err_password" />
</div>
</html:messages>
<br />
<br />

<html:link page="/Locale.do?method=english">English</html:link>
<html:link page="/Locale.do?method=german">German</html:link>


<html:form action="/Submit">
<br />
<bean:message key="label.common.username" /> : <html:text property="username" />
<br />
<br />
<bean:message key="label.common.password" /> : <html:text property="password" />
<br />
<br />

<html:submit><bean:message key="label.common.button.submit" /></html:submit>
</html:form>


</body>
</html>


Action.java (controller)



package action;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class Action extends DispatchAction {

public ActionForward german(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.GERMAN);

return mapping.findForward("success");
}

public ActionForward english(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception {

request.getSession().setAttribute(
Globals.LOCALE_KEY, Locale.ENGLISH);

return mapping.findForward("success");
}
}


Form.java (view)



package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class Form extends ActionForm{
String username;
String password;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

if( getUsername() == null || ("".equals(getUsername())))
{
errors.add("common.username.err",
new ActionMessage("error.common.username.required"));
}

if( getPassword() == null || ("".equals(getPassword())))
{
errors.add("common.password.err",
new ActionMessage("error.common.password.required"));
}

return errors;
}

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
// reset properties
username = "";
password = "";
}
}


Apologize if too much of code up here, just wanna makes the scenario clear.







java internationalization struts struts-1






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 9:04









Boosted NubBoosted Nub

22013




22013













  • "But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

    – Dave Newton
    Nov 15 '18 at 14:44











  • Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

    – Boosted Nub
    Nov 16 '18 at 0:29











  • Did you try putting the English properties in the file it's looking for them in?

    – Dave Newton
    Nov 16 '18 at 2:08











  • Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

    – Boosted Nub
    Nov 16 '18 at 2:20





















  • "But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

    – Dave Newton
    Nov 15 '18 at 14:44











  • Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

    – Boosted Nub
    Nov 16 '18 at 0:29











  • Did you try putting the English properties in the file it's looking for them in?

    – Dave Newton
    Nov 16 '18 at 2:08











  • Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

    – Boosted Nub
    Nov 16 '18 at 2:20



















"But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

– Dave Newton
Nov 15 '18 at 14:44





"But the fact is my project doesn't even have these two properties file in it." Well... where are the property files you speak of then?

– Dave Newton
Nov 15 '18 at 14:44













Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

– Boosted Nub
Nov 16 '18 at 0:29





Only Common.properties & Common_de.properties for English and German language respectively under src/properties/.

– Boosted Nub
Nov 16 '18 at 0:29













Did you try putting the English properties in the file it's looking for them in?

– Dave Newton
Nov 16 '18 at 2:08





Did you try putting the English properties in the file it's looking for them in?

– Dave Newton
Nov 16 '18 at 2:08













Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

– Boosted Nub
Nov 16 '18 at 2:20







Common.properties actually is the one for English properties. But then the console shows xxx.properties is missing (as stated in question) so I created it and leave it empty then put it together with other .properties. However I don't see this is the issue causing the 404--NotFound.

– Boosted Nub
Nov 16 '18 at 2:20














1 Answer
1






active

oldest

votes


















0














The configuration in your struts-config.xml should be something like this



  <message-resources parameter="Common" null="true" />


Then Struts 1 (Java) tries to resolve the ResourceBundle Inheritance for your locale using Common_en_US, Common_en and Common. In the end, if no bundle is found, MissingResourceException is thrown.



The class responsible for loading of resources, org.apache.struts.util.PropertyMessageResources, replaces "." in



    <message-resources parameter="properties.Common" />


with "/" resulting in your warning Resource properties/Common_en.properties Not Found as ".properties" is being added automatically and "properties/" is added to the path.



Assuming your files lie somewhere on the classpath, like WEB-INF/classes, Struts should be able to find them without warning once you correct the config.






share|improve this answer
























  • Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

    – Boosted Nub
    Nov 29 '18 at 5:47













  • Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

    – briadeus
    Nov 29 '18 at 9:05











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315764%2fwhy-my-struts-1-i18n-could-not-locate-the-properties-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The configuration in your struts-config.xml should be something like this



  <message-resources parameter="Common" null="true" />


Then Struts 1 (Java) tries to resolve the ResourceBundle Inheritance for your locale using Common_en_US, Common_en and Common. In the end, if no bundle is found, MissingResourceException is thrown.



The class responsible for loading of resources, org.apache.struts.util.PropertyMessageResources, replaces "." in



    <message-resources parameter="properties.Common" />


with "/" resulting in your warning Resource properties/Common_en.properties Not Found as ".properties" is being added automatically and "properties/" is added to the path.



Assuming your files lie somewhere on the classpath, like WEB-INF/classes, Struts should be able to find them without warning once you correct the config.






share|improve this answer
























  • Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

    – Boosted Nub
    Nov 29 '18 at 5:47













  • Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

    – briadeus
    Nov 29 '18 at 9:05
















0














The configuration in your struts-config.xml should be something like this



  <message-resources parameter="Common" null="true" />


Then Struts 1 (Java) tries to resolve the ResourceBundle Inheritance for your locale using Common_en_US, Common_en and Common. In the end, if no bundle is found, MissingResourceException is thrown.



The class responsible for loading of resources, org.apache.struts.util.PropertyMessageResources, replaces "." in



    <message-resources parameter="properties.Common" />


with "/" resulting in your warning Resource properties/Common_en.properties Not Found as ".properties" is being added automatically and "properties/" is added to the path.



Assuming your files lie somewhere on the classpath, like WEB-INF/classes, Struts should be able to find them without warning once you correct the config.






share|improve this answer
























  • Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

    – Boosted Nub
    Nov 29 '18 at 5:47













  • Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

    – briadeus
    Nov 29 '18 at 9:05














0












0








0







The configuration in your struts-config.xml should be something like this



  <message-resources parameter="Common" null="true" />


Then Struts 1 (Java) tries to resolve the ResourceBundle Inheritance for your locale using Common_en_US, Common_en and Common. In the end, if no bundle is found, MissingResourceException is thrown.



The class responsible for loading of resources, org.apache.struts.util.PropertyMessageResources, replaces "." in



    <message-resources parameter="properties.Common" />


with "/" resulting in your warning Resource properties/Common_en.properties Not Found as ".properties" is being added automatically and "properties/" is added to the path.



Assuming your files lie somewhere on the classpath, like WEB-INF/classes, Struts should be able to find them without warning once you correct the config.






share|improve this answer













The configuration in your struts-config.xml should be something like this



  <message-resources parameter="Common" null="true" />


Then Struts 1 (Java) tries to resolve the ResourceBundle Inheritance for your locale using Common_en_US, Common_en and Common. In the end, if no bundle is found, MissingResourceException is thrown.



The class responsible for loading of resources, org.apache.struts.util.PropertyMessageResources, replaces "." in



    <message-resources parameter="properties.Common" />


with "/" resulting in your warning Resource properties/Common_en.properties Not Found as ".properties" is being added automatically and "properties/" is added to the path.



Assuming your files lie somewhere on the classpath, like WEB-INF/classes, Struts should be able to find them without warning once you correct the config.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 21:45









briadeusbriadeus

434148




434148













  • Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

    – Boosted Nub
    Nov 29 '18 at 5:47













  • Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

    – briadeus
    Nov 29 '18 at 9:05



















  • Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

    – Boosted Nub
    Nov 29 '18 at 5:47













  • Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

    – briadeus
    Nov 29 '18 at 9:05

















Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

– Boosted Nub
Nov 29 '18 at 5:47







Sorry for the late reply. Actually something was wrong with the overall project so I reconstructed it in a new web project. I put *.properties under a package named properties and define the parameter in struts-config.xml this way: <message-resources parameter="properties/ApplicationResource" />. Now it works as a charm. Thanks, though.

– Boosted Nub
Nov 29 '18 at 5:47















Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

– briadeus
Nov 29 '18 at 9:05





Glad it works now, you could use "properties.ApplicationResource" as well as mentioned.

– briadeus
Nov 29 '18 at 9:05




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315764%2fwhy-my-struts-1-i18n-could-not-locate-the-properties-files%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine