| Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML | ||||
|
||||
| Tutorial Categories: Ajax
| Articles
| JSP
| Bioinformatics
| Database
| Free
Books |
Hibernate
| J2EE
| J2ME
| Java
| JavaScript
| JDBC
| JMS
| Linux
| MS
Technology |
PHP
| RMI
| Web-Services
| Servlets
| Struts
| UML
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
Current Comments
23 comments so far (post your own) View All Comments Latest 10 Comments:Hi I am doing internationalization for struts based project.my problem is i want to change ApplicationResource bundel name,i used LocaleAction and it workes fine but if i change the name of the ApplicatinoResource_ja.peroperties to Application126_ja.peroperties then in jsp it shows key not found problem.can anybody help me out?how to change name of the peroperties file.
Posted by Arunkumar on Thursday, 04.17.08 @ 15:04pm | #56792
want to know how to make hindi supported web site
Posted by kk on Wednesday, 03.26.08 @ 16:07pm | #54393
It is very good for a newbie. Thank you.
Posted by Indranil Bhakat on Monday, 02.25.08 @ 20:20pm | #49975
I am also facing the same issue.Please help
Posted by Akansha on Monday, 01.21.08 @ 13:14pm | #45753
How Can I Set the Default LOCALE Language (Ex. Application en Francais, Applicazione in Italiano) in a STRUTS 1.x Application ?
Is There some <TAG> in Struts-config or web.xml
or some use about <PLUGIN> ?
Please Help Me ,it' s very very urgent & important for my work ! Many Thanks.
Posted by Julian on Thursday, 01.17.08 @ 19:09pm | #45453
what is struts?
Posted by ganesh on Thursday, 12.27.07 @ 18:24pm | #43962
ok, i have the language change in an action. But my problem is, i have the main tile with the buttons for languages, and below i have other tiles where different pages are loaded. I want to be able to choose the language, (perform the action) and just reload the whole page with the new language. I mean, is it possible to perform an action without forwarding to a specific page? I would want just to change the language, and reload the current page (whatever is is) with the new language selected. Hope i as clear. Thanks in advance.
Posted by pantominas on Tuesday, 06.26.07 @ 15:25pm | #20211
with out changing browser settings how can we display different locales.one can came from french how can he access the page displayed in french.
with out changing browser options can u provide one sample example with jsp and servlet.
Posted by ranjith on Friday, 06.15.07 @ 14:05pm | #19303
java i18n internationalization using struts with options drop down list.
generate the localedemo.jsp file as
<%@ page language="java" %>
<%@ 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:html locale="true">
<body bgcolor=pink>
<form name="language" action="Locale1" method="POST">
<select name="language">
<option value="en">English</option>
<option value="de">German</option>
<option value="fr">French</option>
</select>
<p>
</P>
<table border="1">
<tbody>
<tr>
<td><bean:message key="user.name" /></td>
<td><input type="text" name="username" value="" /></td>
</tr>
<tr>
<td><bean:message key="password.name" /></td>
<td><input type="text" name="password" value="" /></td>
</tr>
<td><input type="submit" value="<bean:message key="submit.name" />" /></td>
<tr> </tr>
</tbody>
</table>
<%--
<bean:message key="index.info" />
--%>
</form>
</body>
</html:html>
and write the servlet file(java file)locale1.java as
/*
* Locale1.java
*
* Created on April 19, 2007, 5:25 PM
*/
import java.io.*;
import java.net.*;
import java.util.Locale;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Javeed
* @version
*/
public class Locale1 extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String formLanguage = request.getParameter("language");
Locale newLanguage = new Locale(formLanguage, "US");
Locale.setDefault(newLanguage);
HttpSession hs = request.getSession();
hs.setAttribute("org.apache.struts.action.LOCALE", newLanguage);
response.sendRedirect("localedemo.jsp");
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
use the two .properties files like ApplicationResourse.properties and ApplicationResourse_de.properties (ApplicationResourse_xx.properties format files only)
/*
* Locale1.java
*
* Created on April 19, 2007, 5:25 PM
*/
import java.io.*;
import java.net.*;
import java.util.Locale;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Javeed
* @version
*/
public class Locale1 extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String formLanguage = request.getParameter("language");
Locale newLanguage = new Locale(formLanguage, "US");
Locale.setDefault(newLanguage);
HttpSession hs = request.getSession();
hs.setAttribute("org.apache.struts.action.LOCALE", newLanguage);
response.sendRedirect("localedemo.jsp");
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
Javeed M R
javeed.mca@gmail.com
Posted by Javeed M R on Thursday, 04.19.07 @ 19:30pm | #14576
i have changed the brower language settings to other countries, i am not getting the required pages depending upon the languages changes. but i have observed that the .properties file present in the last is executing every time.
example:
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
<message-resources parameter="com/myapp/struts/Application_fr"/>
<message-resources parameter="com/myapp/struts/Application_en"/>
<message-resources parameter="com/myapp/struts/Application_de"/>
so Application_de.properties file is executing ,
if i keep Application_fr.properties as the last line then the _fr.properties file is executing.
could any one help me.
M R Javeed.
javeed.mca@gmail.com
Posted by Javeed on Wednesday, 04.11.07 @ 13:52pm | #13852
Hi thanks for this good tutorial.Also it was good to show how we can actually demontrate the change of language by making change in the browser language setting.
Good work.
Posted by ragh on Tuesday, 03.27.07 @ 07:00am | #12765
i tried doing the same for Marathi( similar to Hindi) language but the text wriiten in ApplicationResources_mr.properties and being file ApplicationResources_mr.properties saved as UTF-8 encoding the text are not getting displayed properly in jsp page.
can u tell me why ?
Posted by Nisha on Friday, 02.23.07 @ 15:04pm | #8974
thanks is a good resouse and good example
Posted by nasir on Friday, 02.16.07 @ 18:08pm | #8066
Hai
This is Mohan, I am working as a java developer in Bonsai Consulting inc at chennai. I found small link error problem in your site. I could find the link in the whole area, inspite of the link to be found only in the line given. Further details are furnished below to check the problem.
Step1:
Please type this link in your url
http://www.roseindia.net/struts/struts-presentations.shtml
Step2:
Oracle JavaServer Faces between these two link if u click in that space(gap) its also having the link X-Hive/DB
With regards,
Mohanraj Ramaraj
Posted by MohanRaj on Thursday, 02.15.07 @ 15:07pm | #7967
The goog article, but i think its better if you guide how to programming with i18n, because you only create some message_resource files with some languages, and when coding, how programmer will set the language for system?
Thanks very much
Posted by hungnm on Thursday, 02.8.07 @ 11:31am | #6751
Great Tutorial!!!
I found it very helpful and have implemented it too.
For changing the locale programatically use
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, new java.util.Locale("","") );
Posted by Rajesh on Wednesday, 01.31.07 @ 15:39pm | #4904
Hi
This example is OK. BUt threre is a problem. Suppose one spain came here and he want to see the page in spanish. But default it will be displayed only in English. So he have to change the setting of browser. It's not a good thing. But there should be option in the home page itself to select the language. It will be a best idea, So that one can view the pages as he like from anywhere in the world without changing the browser settings.
Please provide the example code for the same also.
Posted by Rathishkumar on Monday, 01.29.07 @ 10:39am | #4603
itz deprecated u should update it
Posted by mahesh on Thursday, 01.11.07 @ 16:03pm | #3202
I was traid i18N internalization but not working my machine.I was chage browser language setting.
Posted by Jana on Wednesday, 12.27.06 @ 22:53pm | #2114
HiSTRUTS INTERNATIONALIZATION good tutorial with simple example, i havn't seen such simple exmaples of struts before.
thanx
regards
shuja
Posted by Shuja on Tuesday, 12.19.06 @ 13:34pm | #1229
HI, Can you please tell me if mentioning locale="true" in the jsp , is the only way to enable internationalization. Also should we only change the browser setting to change the language?
Posted by deepa on Monday, 12.11.06 @ 13:21pm | #766
can you tell me a small example of that.
Posted by chandra prakash on Friday, 12.1.06 @ 14:12pm | #317
NOT THAT MUCH CLEAR.NEED MORE INFORMATION.
Posted by PINKYE on Thursday, 11.30.06 @ 23:57pm | #264