• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

localisation problems

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have written

TestController.java

package com.egatematrix.ess.controller.model;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

import org.springframework.web.servlet.*;
import org.springframework.web.servlet.mvc.*;

public class TestController implements Controller
{
public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception
{
System.out.println("1");
return new ModelAndView("Home", "message", greeting);
}
private String greeting;

public void setGreeting(String greeting)
{
this.greeting=greeting;
}
}


index.jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:redirect url="/home.htm"/>

web.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<servlet>
<servlet-name>cbtech</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>cbtech</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>

messages.properties:

success=You are a Valid User

cbtech-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean name="/home.htm" class="com.egatematrix.ess.controller.model.TestController">
<property name="greeting">
<value>Welcome to Cybertech</value>
</property>
</bean>

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
<value>buttons</value>
</list>
</property>

</bean>

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.KookieLocaleResolver"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>

</bean>
</beans>


Home.jsp:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head><title>Spring Training, Inc.</title></head>
<body>
<h2><fmt:message key="success"/></h2>
<input type=submit class="button" value="<fmt:message key="submit"/>">
</body>
</html>


In the above code i have miss spelt Cookie as Kookie.

Can any one help me. And also i want to use Hyperlinks to change locales in jsp using interceptors. Can anyone give me the code.

Thanks in advance

Radha Krishna
 
reply
    Bookmark Topic Watch Topic
  • New Topic