[Seasar-user:17488] [Teeda] アプリの実装でロケールを変更すること

thomas [E-MAIL ADDRESS DELETED]
2009年 5月 20日 (水) 00:04:24 JST


Hai

Hi i want to change locale in teeda...

*web.xml
*
<filter>
        <filter-name>requestDumpFilter</filter-name>
        <filter-class>*projectmgnt.util.RequestDumpFilter*</filter-class>
    </filter>

<filter-mapping>
        <filter-name>requestDumpFilter</filter-name>
        <url-pattern>*.html</url-pattern>
    </filter-mapping>


*RequestDumpFilter .java
::::::::::::::::::::::::::::::::::
*

public final class RequestDumpFilter implements Filter {

    private FilterConfig config=null;

    public Locale locale;

    public void destroy() {
        config=null;

    }
    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {

        if (request instanceof HttpServletRequest) {
            final HttpServletRequest hrequest = (HttpServletRequest)
request;
            final HttpSession session = hrequest.getSession(false);
            if(session!=null){

                if*
(request.getLocale().getLanguage().equals((String)session.getAttribute("language"))
*){
                    System.out.println("same");
                   * chain.doFilter(request,response);*
                    return;
                }
                else{

*//How can i change the locale here*


                }


                System.out.println("Get
Locales"+request.getLocale().getLanguage());
            }
            if(config==null){
                return;
            }

           * chain.doFilter(request,response);*

        }
    }
    public void init(FilterConfig filterConfig) throws ServletException {
        config=filterConfig;
    }
}

*Login.java*

public Class doLogin() {
        LoginCB loginCb = new LoginCB();
        loginCb.query().setLoginid_Equal(userid);
        loginCb.query().setPassword_Equal(pwd);
        if(loginBhv.selectCount(loginCb)>0){
            Login login = new Login();
            login = loginBhv.selectEntity(loginCb);
            session.setAttribute("usersession", userid);
            *session.setAttribute("language", language);*
            EmployeemasterCB empCb = new EmployeemasterCB();
            Employeemaster employee = new Employeemaster();
            empCb.query().setEmployeecode_Equal(login.getEmployeecode());
            employee = employeemasterBhv.selectEntity(empCb);
            if(employee.getDesignation().equals("admin"))
                session.setAttribute("userlevel", "2");
            else if(employee.getDesignation().equals("manager"))
                session.setAttribute("userlevel", "3");
            else
                session.setAttribute("userlevel", "1");
        }
        else{
            FacesMessageUtil.addErrorMessage("E02");
            return null;
        }

        return MenuPage.class;

    }

Please instruct to solve this problem

トマス
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20090520/09278489/attachment.html>


Seasar-user メーリングリストの案内