Skip to content

rose如何在jsp里使用i18n支持? #31

@met-pub

Description

@met-pub

我按照 四步完成Spring国际化动态配置 上面配好了resolver

并在controller里处理:

    @Get
    public String index(Invocation inv, @Param("language") String language) {
        if (language != null) {
            Locale locale = org.springframework.util.StringUtils.parseLocaleString(language);
            logger.debug("language: {}, locale: {}", language, locale);
            resolver.setLocale(inv.getRequest(), inv.getResponse(), locale);
        }
        return "index";
    }

在jsp里打印:

${pageContext.request.locale}, <spring:message code="web.title"/>

结果 /?language=zh_CN 访问,logger里能打出来是:zh_CN,cookie里也能看到是zh_CN
但是jsp里,仍然是en_US
求教。。。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions