Jboss 如何更改首选项,使每个窗口显示不同的内容?

Jboss 如何更改首选项,使每个窗口显示不同的内容?,jboss,preferences,portlet,jsr286,jboss-portal,Jboss,Preferences,Portlet,Jsr286,Jboss Portal,我试图覆盖首选项的值,但没有任何内容覆盖。 有人知道如何解决这个问题吗 portlet.xml <?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schema

我试图覆盖首选项的值,但没有任何内容覆盖。 有人知道如何解决这个问题吗

portlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
    <portlet>
        <portlet-name>cool_portlet</portlet-name>
        <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>view</portlet-mode>
        </supports>
        <supported-locale>en</supported-locale>
        <resource-bundle>com.app.portlet.cool_portlet</resource-bundle>
        <portlet-info>
            <title>Cool Portlet</title>
        </portlet-info>     
        <portlet-preferences>
            <preference>
                <name>KEY</name>
                <value>TEST</value>
                <read-only>false</read-only>
            </preference>
        </portlet-preferences>
    </portlet>
</portlet-app>
输出:

13:49:54,860 INFO  [STDOUT] KEY is : TEST
13:50:21,088 INFO  [STDOUT] KEY is : TEST

您需要调用setValue,然后存储PortletPreferences对象。请注意,首选项只能存储在操作阶段

您是否以具有管理员权限的用户身份登录?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
    <deployment>
        <parent-ref>comportal.import</parent-ref>
        <if-exists>overwrite</if-exists>
        <window>
            <window-name>impWindow</window-name>
            <content>
                <content-type>portlet</content-type>
                <content-uri>coolPortlet_IMPORT_newInstance</content-uri>
            </content>
            <region>center</region>
            <height>1</height>
            <supported-window-states>
                <window-state>normal</window-state>
                <window-state>maximized</window-state>
                <window-state>minimized</window-state>
            </supported-window-states>
            <initial-window-state>normal</initial-window-state>
        </window>
    </deployment>
    <deployment>
        <parent-ref>comportal.export</parent-ref>
        <if-exists>overwrite</if-exists>
        <window>
            <window-name>expWindow</window-name>
            <content>
                <content-type>portlet</content-type>
                <content-uri>coolPortlet_EXPORT_newInstance</content-uri>
            </content>
            <region>center</region>
            <height>1</height>
            <supported-window-states>
                <window-state>normal</window-state>
                <window-state>maximized</window-state>
                <window-state>minimized</window-state>
            </supported-window-states>
            <initial-window-state>normal</initial-window-state>
        </window>
    </deployment>
</deployments>
@RequestMapping(value = "VIEW")
@Controller(value = "mainController")
public class MainController {
    @RenderMapping
    public String init(@RequestParam(value = "key", required = false) String key, Model model, PortletRequest request) throws Exception {
        PortletPreferences preferences = request.getPreferences();
        String preferencesKey = preferences.getValue("KEY", "Not Found!!!");
        System.out.println("KEY is : " + preferencesKey);
        model.addAttribute("preferencesKey", preferencesKey);
        return "index";
    }
}
13:49:54,860 INFO  [STDOUT] KEY is : TEST
13:50:21,088 INFO  [STDOUT] KEY is : TEST