简体   繁体   中英

Unable to set Window State to Exclusive in Struts2 Liferay Portlet

Overview: Porting a struts2 web-appp to liferay struts2 6.2 portlet

Issue: Unable to set windowState to be "Exclusive" in the the struts2 tag <s:url ..../>

Description:I need to set windowState to be "Exclusive" in the the struts2 tag <s:url ..../> .

I am trying the below option but not able to set url's window state as exclusive.

<s:url var="billingOverview" action="%{billingOverviewURL}"
       portletMode="view" portletUrlType="struts.portlet.action"
       windowState=<%=LiferayWindowState.EXCLUSIVE.toString()%> />

Initially I got the exception: "according to tld or attribute windowState, does not accept any expressions".I modified the struts2 core jar(struts2-core-2.3.7.jar)'s "struts-tags.tld" file , in which I made the below changes to accept the expressions as well in the windowState tag by changing rtexprvalue as TRUE:

<attribute>
      <description><![CDATA[The resulting portlet window state]]></description>
      <name>windowState</name>
      <required>false</required>
      <rtexprvalue>true</rtexprvalue>
</attribute>

It would be really great if I can get some pointer on above issue. Thanks in Advance!

You can't nest scriptlets ( <%...%> that you should not use anywhere else) inside Struts tags.

You need to enable static method access in struts.xml

 
 
 
  
  <constant name="struts.ognl.allowStaticMethodAccess" value="true" />
 
  

and then reference the FQCN with the following syntax:

Change it to:

<s:url portletUrlType="struts.portlet.action"
          portletMode="view" 
                  var="billingOverview" 
               action="%{billingOverviewURL}"   
          windowState="%{@com.liferay.portal.kernel.portlet.LiferayWindowState@EXCLUSIVE}" />

More on the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM