0

我编写了一个具有自定义 conf 页面的 portlet,这里是 configuration-action-class:

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");
}
}

这个类在点击return to full page后只运行了一次,位于portlet右上角的按钮不起作用,我无法再次进入配置页面!并且从配置页面返回后,门户右上角的菜单栏也不起作用,除非我删除我的 portlet 并且它们都将再次正常工作!

4

1 回答 1

0

我解决了这个问题。我的问题是,首先我应该将所有内容更改为,然后将所有 JQuery 代码更改为 JavaScript,因为我使用的这些 JQuery 版本如何在此版本的 Liferay (5.2.3) 中产生一些错误

于 2012-12-24T08:18:21.743 回答