当使用另一个 portlet 时,我可以使基于 struts 的 portlet 记住它的视图吗?
我使用 struts portlet 桥编写了一个相当基本的 portlet,并将其部署到 liferay,我的 portlet 中的导航似乎很好,但是每当我单击门户中另一个 portlet 上的链接时,我的 portlet 就会恢复到我的 portlet 中的视图操作设置。 xml 而不是重新呈现现有状态。 我究竟做错了什么?
我的 portlet.xml
是:
<?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>test</portlet-name>
<display-name>Test</display-name>
<portlet-class>com.perceptive.ctms.test.portlet.TestPortlet</portlet-class>
<init-param>
<name>ServletContextProvider</name>
<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>
</init-param>
<init-param>
<name>StrutsPortletConfigLocation</name>
<value>/WEB-INF/struts-portlet-config.xml</value>
</init-param>
<init-param>
<name>HelpPage</name>
<value>/portlet_action/test/help</value>
</init-param>
<init-param>
<name>ViewPage</name>
<value>/portlet_action/test/start</value>
</init-param>
<init-param>
<name>EditPage</name>
<value>/portlet_action/test/preferences</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
<portlet-mode>help</portlet-mode>
</supports>
<portlet-info>
<title>Test</title>
<short-title>Test</short-title>
<keywords>Test</keywords>
</portlet-info>
</portlet>
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>com.perceptive.ctms.framework.portlet.filter.AuthenticationFilter</filter-class>
<lifecycle>RENDER_PHASE</lifecycle>
<lifecycle>ACTION_PHASE</lifecycle>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<portlet-name>test</portlet-name>
</filter-mapping>
</portlet-app>
struts-portlet-config.xml
是:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<render-context>
<attribute name="errors"/>
<attribute name="message" keep="true"/>
<attribute prefix="com.perceptive" keep="true"/>
</render-context>
<portlet-url-type default="render">
<render path="/test/help.do"/>
<render path="/test/start.do"/>
<render path="/test/preferences.do"/>
<render path="/test/tableTest.do"/>
<render path="/test/displayTagTest.do"/>
<render path="/test/lookupTest.do"/>
<render path="/test/lookupTestSave.do"/>
</portlet-url-type>
</config>
PS 我已经在 liferay 论坛上问过这个问题,但我也在此处询问希望尽快得到答复。
I've written a fairly basic portlet using the struts portlet bridge and deployed it to liferay, navigation within my portlet seems fine, but whenever I click a link on another portlet in the portal my portlet reverts to the view action setup in my portlet.xml rather than re-rendering the existing state. What am I doing wrong?
My portlet.xml
is:
<?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>test</portlet-name>
<display-name>Test</display-name>
<portlet-class>com.perceptive.ctms.test.portlet.TestPortlet</portlet-class>
<init-param>
<name>ServletContextProvider</name>
<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>
</init-param>
<init-param>
<name>StrutsPortletConfigLocation</name>
<value>/WEB-INF/struts-portlet-config.xml</value>
</init-param>
<init-param>
<name>HelpPage</name>
<value>/portlet_action/test/help</value>
</init-param>
<init-param>
<name>ViewPage</name>
<value>/portlet_action/test/start</value>
</init-param>
<init-param>
<name>EditPage</name>
<value>/portlet_action/test/preferences</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
<portlet-mode>help</portlet-mode>
</supports>
<portlet-info>
<title>Test</title>
<short-title>Test</short-title>
<keywords>Test</keywords>
</portlet-info>
</portlet>
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>com.perceptive.ctms.framework.portlet.filter.AuthenticationFilter</filter-class>
<lifecycle>RENDER_PHASE</lifecycle>
<lifecycle>ACTION_PHASE</lifecycle>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<portlet-name>test</portlet-name>
</filter-mapping>
</portlet-app>
and struts-portlet-config.xml
is:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<render-context>
<attribute name="errors"/>
<attribute name="message" keep="true"/>
<attribute prefix="com.perceptive" keep="true"/>
</render-context>
<portlet-url-type default="render">
<render path="/test/help.do"/>
<render path="/test/start.do"/>
<render path="/test/preferences.do"/>
<render path="/test/tableTest.do"/>
<render path="/test/displayTagTest.do"/>
<render path="/test/lookupTest.do"/>
<render path="/test/lookupTestSave.do"/>
</portlet-url-type>
</config>
PS I've already asked this on the liferay forums, but am asking here as well in the hope of a quick answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
portlet.xml
中,尝试将以下行更改为:这意味着 portlet 的缓存版本立即过期,
这意味着它永远不会过期。 从
portlet-app_2_0.xsd
:In the
portlet.xml
try changing the line:which means the cached version of the portlet expires immediately to:
which means it never expires. From the
portlet-app_2_0.xsd
: