aspose file tools
The moose likes Other Application Frameworks and the fly likes Localisation errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Localisation errors" Watch "Localisation errors" New topic

Localisation errors

krishna Gajarla

Joined: Oct 02, 2005
Posts: 21
I am trying to run an application to implemet localisation. 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 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
System.out.println("1");"SpringappController - returning hello view");
return new ModelAndView("hello.jsp");

springapp-servlet.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<!-- - 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' ''>






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

Thanks and Regards,<br />krishna<br />------------------<br />Charles Darwin: <br />"It is not the strongest of the species that survives, <br />nor the most intelligent, <br />but the one most responsive to change"
Jordi Monn�

Joined: Feb 28, 2006
Posts: 21
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, 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

Joined: Oct 02, 2005
Posts: 21
Thank you for your reply,

i am going through...the code
subject: Localisation errors