Internationalization I18N Support 200 Languages
Localization L10N Support Validations like Indian USA
How to read data from property files and How to populate Dynamically?
How to override session locale values
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<div style="border-color:maroon; color:red; font-size:50">
<center>
<bean:message key="title">
</center>
<html:form action="reg">
<pre>
<bean:message key="id"/> <html:text property="id"/>
<bean:message key="name"/> <html:text property="name"/>
<bean:message key="email"/> <html:text property="email"/>
<bean:message key="address"/> <html:text property="address"/>
<html:submit><bean:message key="submit"
<a href="./changeLang.do?Language=te" style="border-style:dashed;">Telugu</a>
<a href="./changeLang.do?Language=hi" style="border-style:dashed;">Hindi</a>
<a href="./changeLang.do?Language=ta" style="border-style:dashed;">Tamil</a>
<a href="./changeLang.do?Language=en" style="border-style:dashed;">English</a>
</pre>
</html:form>
</div>
Now ChangeLanguageController.java
package beans;
import java.util.Locale;
import org.apache.struts.action.Action;
public class ChangeLanguageController extends Action
{
@Override
public ActionForward execute(ActionMapping mapping,ActionForm form
HttpServletRequest request,HttpServlet Response)
throws Exception{
String language=request.getParameter("language");
locale locale=new Locale(language);
HttpSession session = request .getSession();
session.setAttribute("org.apache.struts.action.LOCALE",locale);
return mapping.findForward("index");
}
}
struts-config.xml
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="RF" type="beans.AdharForm"/></form-beans>
<action-mappings>
<action path="/reg" name="RF"/>
<action path="/changeLang" type="beans.ChangeLanguageController/>
<forward name="index" path="/.index.jsp"></forward>
</action>
</action-mappings>
</struts-config>
Localization L10N Support Validations like Indian USA
How to read data from property files and How to populate Dynamically?
How to override session locale values
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<div style="border-color:maroon; color:red; font-size:50">
<center>
<bean:message key="title">
</center>
<html:form action="reg">
<pre>
<bean:message key="id"/> <html:text property="id"/>
<bean:message key="name"/> <html:text property="name"/>
<bean:message key="email"/> <html:text property="email"/>
<bean:message key="address"/> <html:text property="address"/>
<html:submit><bean:message key="submit"
<a href="./changeLang.do?Language=te" style="border-style:dashed;">Telugu</a>
<a href="./changeLang.do?Language=hi" style="border-style:dashed;">Hindi</a>
<a href="./changeLang.do?Language=ta" style="border-style:dashed;">Tamil</a>
<a href="./changeLang.do?Language=en" style="border-style:dashed;">English</a>
</pre>
</html:form>
</div>
Now ChangeLanguageController.java
package beans;
import java.util.Locale;
import org.apache.struts.action.Action;
public class ChangeLanguageController extends Action
{
@Override
public ActionForward execute(ActionMapping mapping,ActionForm form
HttpServletRequest request,HttpServlet Response)
throws Exception{
String language=request.getParameter("language");
locale locale=new Locale(language);
HttpSession session = request .getSession();
session.setAttribute("org.apache.struts.action.LOCALE",locale);
return mapping.findForward("index");
}
}
struts-config.xml
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="RF" type="beans.AdharForm"/></form-beans>
<action-mappings>
<action path="/reg" name="RF"/>
<action path="/changeLang" type="beans.ChangeLanguageController/>
<forward name="index" path="/.index.jsp"></forward>
</action>
</action-mappings>
</struts-config>