You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@locus.apache.org on 2000/07/05 19:45:10 UTC

cvs commit: jakarta-tomcat/src/examples/WEB-INF/classes LocalStrings_en.properties HelloWorldExample.java

nacho       00/07/05 10:45:09

  Modified:    src/examples/WEB-INF/classes Tag: tomcat_32
                        HelloWorldExample.java
  Added:       src/examples/WEB-INF/classes Tag: tomcat_32
                        LocalStrings_en.properties
  Log:
  Make HelloWorld servlet aware to the
  request locale not the server's locale
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.4.1   +7 -6      jakarta-tomcat/src/examples/WEB-INF/classes/HelloWorldExample.java
  
  Index: HelloWorldExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/examples/WEB-INF/classes/HelloWorldExample.java,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- HelloWorldExample.java	2000/04/02 00:09:38	1.2
  +++ HelloWorldExample.java	2000/07/05 17:45:01	1.2.4.1
  @@ -1,4 +1,4 @@
  -/* $Id: HelloWorldExample.java,v 1.2 2000/04/02 00:09:38 costin Exp $
  +/* $Id: HelloWorldExample.java,v 1.2.4.1 2000/07/05 17:45:01 nacho Exp $
    *
    */
   
  @@ -16,21 +16,22 @@
   
   public class HelloWorldExample extends HttpServlet {
   
  -    ResourceBundle rb = ResourceBundle.getBundle("LocalStrings");
   
       public void doGet(HttpServletRequest request,
                         HttpServletResponse response)
           throws IOException, ServletException
       {
  +        ResourceBundle rb =
  +            ResourceBundle.getBundle("LocalStrings",request.getLocale());
           response.setContentType("text/html");
           PrintWriter out = response.getWriter();
   
           out.println("<html>");
           out.println("<head>");
   
  -	String title = rb.getString("helloworld.title");
  +	    String title = rb.getString("helloworld.title");
   
  -	out.println("<title>" + title + "</title>");
  +	    out.println("<title>" + title + "</title>");
           out.println("</head>");
           out.println("<body bgcolor=\"white\">");
           out.println("<body>");
  @@ -42,9 +43,9 @@
   
           // XXX
           // making these absolute till we work out the
  -        // addition of a PathInfo issue 
  +        // addition of a PathInfo issue
   
  -	out.println("<a href=\"/examples/servlets/helloworld.html\">");
  +	    out.println("<a href=\"/examples/servlets/helloworld.html\">");
           out.println("<img src=\"/examples/images/code.gif\" height=24 " +
                       "width=24 align=right border=0 alt=\"view code\"></a>");
           out.println("<a href=\"/examples/servlets/index.html\">");
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +38 -0     jakarta-tomcat/src/examples/WEB-INF/classes/Attic/LocalStrings_en.properties