Current URL /web/guest/HTML generates exception: n

2020-07-30 02:39发布

问题:

I develop an example of Struts2 with Jasper Reports and every thing work fine. In my index.jsp I have

index.jsp:

<body>
  <a href="HTML.action" target="_blank" >click to generate pdf report</a>
</body> 

struts.xml:

<struts>
  <package name="default" extends="struts-default,jasperreports-default">
    <action name="HTML" class="com.tutorialspoint.DataBeanList" method="exporte">
      <result name="success">/index.jsp</result>
    </action>
  </package>
</struts>

but when I want to do that with Liferay 6.0.6 I got this error:

INFO [PortalImpl:3829] Current URL /web/guest/HTML.action generates exception: null

In my struts.xml I have:

<!-- Action pour générer un rapport pdf -->

<package namespace="/reporting" extends="struts-portlet-default,json-default,jasperreports-default" name="reportingview"> 
  <action name="HTML" class="com.xxxxxx.struts2.actions.genererQPpdf" method="exporte">
    <result name="success">/JSPs/reporting/resultQP.jsp</result> 
  </action> 
</package>

so any one can help me.

回答1:

Better use the struts tags to exclude errors in the code. For example url tag could be used to construct the correct link that point to the action.

<a href="<s:url namespace="/reporting" action="HTML"/>" target="_blank" >click to generate pdf report</a>