• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Localisation errors

Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run an application to implemet localisation.

SpringappController.java is :

package com.cybertech;

import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SpringappController implements Controller

/** Logger for this class and subclasses */
protected final Log logger = LogFactory.getLog(getClass());

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
logger.info("SpringappController - returning hello view");
return new ModelAndView("hello.jsp");

springapp-servlet.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- - Application context definition for "springapp" DispatcherServlet. -->
<bean id="springappController" class="com.cybertech.SpringappController"/>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<prop key="/hello.htm">springappController</prop>
<bean id="bundleViewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basename">

web.xml is:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>






hello.jsp is:

<%@ taglib uri="/WEB-INF/spring.tld" prefix="spring" %>

<title>Example :: Spring Application</title>
<spring:message code="hello.username"/><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">

and i have written two proeprties files


I am getting an error:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hello': Instantiation of bean failed; nested exception is java.lang.IllegalStateException: Bean definition does not carry a resolved bean class
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Krishna.

Seems like you are trying to configure your i18n with a ViewResolver and it is impossible. ViewResolver interface has been created to achieve other issues.

To achieve the i18n for your application you need to configure the messageSource interface.

For example:

messages and errors are a properties files, messages_it_IT.properties for example.

Then, if you want a way to change the language of your web application you just have to add a localeInterceptor like this:

If you want to change the language you need something like <a href="login.html?language=it_IT">

The locale will be kept in a cookie.

Note: replace &CookieLocaleResolver for CookieLocaleResolver. I can't post without "&" symbol.

Regards, Jordi.
[ November 03, 2006: Message edited by: Jordi Monn� ]
krishna Gajarla
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply,

i am going through...the code
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!