Hello,
I have a question about writing portlets in Tapestry. I'm writting portlets
to GridSphere. I wrote simple HelloWorld portlet. I'm trying to change
Locale of portlet. I use Locale loc = new Locale(); as well as Locale locale
= getEngine().getLocale(); as well as some code from JSFs. And it is working
while I'm logout from portat, change language and login again. But in the
portal (if I'm login into it) there is an option to change language too and
when I'm using it my tapestry portlet doesn't change its locale. It reacts
only when I'm login/out from portal when Tapestry page is reloading. How to
change Locale 'dynamically' ?
Here is my class:
public abstract class View extends BasePage 
        implements PageBeginRenderListener
{
        @InjectObject("service:tapestry.globals.PortletWebRequest")
        public abstract PortletWebRequest getRequest();
        
        public PortletRequest preq;
        public String loc;      
        private String greetingSubject; 
        private Date currentDateTime;
        private DateFormat currentDateTimeFormat;
        
        public void pageBeginRender(PageEvent event){
                        preq =  (PortletRequest) getRequest();
                        //it's ftom JSFs
                        Map userInfo = 
(Map)preq.getAttribute(PortletRequest.USER_INFO);        
                        loc =(String) userInfo.get("user.locale");
                        if (loc == null){
                             loc =preq.getLocale().toString();
                        }
        }
        public String getTimeDate(){
            currentDateTime = new Date();   
            Locale locale = new Locale(loc);
            //Locale locale = getEngine().getLocale();
            currentDateTimeFormat = 
DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.SHORT, locale);
            String date = currentDateTimeFormat.format(currentDateTime);
                return date;
        }
        public String getGreetingSubject() {
                return greetingSubject;
        }
        public void setGreetingSubject(String greetingSubject) {
                this.greetingSubject = greetingSubject;
        }       
}

Thanks,
Dominik
-- 
View this message in context: 
http://www.nabble.com/Tapestry-portlet-Locale-problem-tf2163269.html#a5978891
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to