هل يمكنني عمل مدخل قائم على الدعامات تذكر وجهة نظره عند استخدام مدخل آخر؟

StackOverflow https://stackoverflow.com/questions/1205926

سؤال

لقد كتبت مدخلًا أساسيًا إلى حد ما باستخدام جسر STRUTS Portlet ونشرته على Liferay ، ويبدو التنقل داخل المدخل الخاص بي جيدًا ، ولكن كلما قمت بالنقر فوق رابط على مدار آخر في البوابة ، يعود المدخل الخاص بي إلى إعداد إجراءات العرض في المدخل الخاص بي. 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>

ملاحظة: لقد طلبت ذلك بالفعل في منتديات Liferay ، لكنني أسأل هنا أيضًا على أمل إجابة سريعة.

هل كانت مفيدة؟

المحلول

في ال portlet.xml حاول تغيير الخط:

<expiration-cache>0</expiration-cache>

مما يعني أن النسخة المخزنة مؤقتًا من المدخل تنتهي على الفور إلى:

<expiration-cache>-1</expiration-cache>

مما يعني أنه لا ينتهي أبدًا. من portlet-app_2_0.xsd:

<annotation>
    <documentation>
        Expiration-time defines the time in seconds after which the portlet output expires. 
        -1 indicates that the output never expires.
        Used in: portlet
    </documentation>
</annotation>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top