我在试用I18N的时候,碰到了一个问题还请。
我的代码是这样的:
package test.org.test.spring;
import java.util.Date;
import java.util.Locale;
import org.omg.CORBA.Object;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.test.spring.HelloAction;
import junit.framework.TestCase;
public class HelloSystem extends TestCase{
public void testI18N(){
ApplicationContext context = new ClassPathXmlApplicationContext("beans");
String greeting = context.getMessage("greeting",null,Locale.CHINESE);
String date = context.getMessage("date",new Object[]{(Object) new Date()},Locale.CHINESE);
HelloAction hello = (HelloAction)context.getBean("hello");
System.out.println(hello.sayHello(greeting));
System.out.println(date);
}
}
我在调试的时候,ApplicationContext context = new ClassPathXmlApplicationContext("beans");这句代码抛出了异常。我去网上找了很多资料,试着去改beans.xml文件路径。但是都不行。不知道为什么!哪位啊!
我的代码是这样的:
package test.org.test.spring;
import java.util.Date;
import java.util.Locale;
import org.omg.CORBA.Object;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.test.spring.HelloAction;
import junit.framework.TestCase;
public class HelloSystem extends TestCase{
public void testI18N(){
ApplicationContext context = new ClassPathXmlApplicationContext("beans");
String greeting = context.getMessage("greeting",null,Locale.CHINESE);
String date = context.getMessage("date",new Object[]{(Object) new Date()},Locale.CHINESE);
HelloAction hello = (HelloAction)context.getBean("hello");
System.out.println(hello.sayHello(greeting));
System.out.println(date);
}
}
我在调试的时候,ApplicationContext context = new ClassPathXmlApplicationContext("beans");这句代码抛出了异常。我去网上找了很多资料,试着去改beans.xml文件路径。但是都不行。不知道为什么!哪位啊!
本文介绍了一个关于Spring框架中I18N国际化配置的问题。作者在尝试使用Spring的I18N功能时遇到异常,特别是在加载配置文件beans时出现问题。文章探讨了可能的原因及解决方案。
940

被折叠的 条评论
为什么被折叠?



