Liferay 5.2.3 portlet配置页面问题

时间:2012-12-23 16:16:45

标签: liferay

我在这里编写了一个自定义配置页面的portlet是配置操作类:

public class ConfigurationActionImpl implements ConfigurationAction {

private static Logger log = Logger.getLogger(ConfigurationActionImpl.class);
private config conf=config.getInstance(); 
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {

    if(renderRequest.isUserInRole("administrator")){
        log.info("UserRole:::admin");
        return "/config.jsp";
    }else if(renderRequest.isUserInRole("guest")){
        log.info("UserRole:::guest");
    }else if(renderRequest.isUserInRole("power-user")){
        log.info("UserRole:::power-user");
        return "/config.jsp";
    }else if(renderRequest.isUserInRole("user")){
        log.info("UserRole:::user");
    }else{
        log.info("UserRole:::dafug");
    }
    return "/config.jsp?mode=guest";
}

public void processAction(PortletConfig config, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { 

    conf.Names.clear();
    String count = ParamUtil.getString(actionRequest, "count");
    String portletResource = ParamUtil.getString(actionRequest, "portletResource"); 
    PortletPreferences prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
    String[] list=count.split("/");
    for(String a : list){
        if( a!=null&& !a.equals("")){
            String en = ParamUtil.getString(actionRequest,"En"+a);
            String pa = ParamUtil.getString(actionRequest,"Pa"+a);
            if(!en.equals("")&&!pa.equals("")){
                conf.Names.put(pa,en);
                log.info("word::"+en+"::::"+pa);
                prefs.setValue("En"+a,en);
                prefs.setValue("Pa"+a,pa);
            }else if(a!=null&& !a.equals("")){
                count=count.substring(0,count.lastIndexOf("/"+a))+count.substring(count.lastIndexOf("/"+a)+("/"+a).length());
            }

        }
    }
    prefs.setValue("count",count);
    prefs.store();
}
public void serveResource(ResourceRequest request, ResourceResponse response){
    log.info("HERE in conf");
}
}

这个类在单击返回整页后只工作了一次,位于portlet右上角的按钮不起作用,我再也无法进入配置页面了! 从配置页面返回后,门户网站右上角的菜单栏也无效,除非我删除了我的portlet,所有这些都将再次正常工作!

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。 我的问题是,首先我应该改变所有 并且我将所有JQuery代码更改为JavaScript,因为我使用的这些版本的JQuery如何使用此版本的Liferay(5.2.3)生成一些错误