1

The plugin does not seem to work properly.

This is my action declared in the struts.xml:

<action name="actionName" class="isa.presentation.jasper.MyClass">
    <result name="success" type="jasper">
        <param name="location">jasper/courriers/mutuelle.jasper</param>
        <param name="dataSource">resultats</param>
        <param name="format">HTML</param>
        <param name="documentName">xxx</param>
    </result>
</action>

So for some format (HTML, XML), the name of the output file is not what it should be (xxx.[format]) but (the name of the action).action !!

Why? Can something be done?

Question 2 : For some format (PDF, HTML, XML) the file appears directly in the good application, for the others there is a prompt asking if you want to open it or record it. The problem with the HTML et XML formats is that they open directly in the browser instead of the site... So is it possible that the prompt box appears all the time (whatever the format). If not, is it possible to ask to open the file in another tab of the browser?

4

1 回答 1

2

I've never used Jasper result, but according to the documentation,

1) format must be one of the JasperReportConstants,

then FORMAT_HTML instead of HTML

2) You missed the contentDisposition param, that specifies both the filename AND the type of disposition (default inline):

<param name="contentDisposition">inline; filename="yourFileName.html"</param>

or

<param name="contentDisposition">attachment; filename="yourFileName.html"</param>

Inline means you want to open it in browser (if a plugin is found), Attachment that you want to ask if download it or open it with a program from your computer.

I can't understand what documentName param stand for, but you can try and update your question with the results ;)

Summarizing:

<action name="actionName" class="isa.presentation.jasper.MyClass">
    <result name="success" type="jasper">
            <param name="location">jasper/courriers/mutuelle.jasper</param>
            <param name="dataSource">resultats</param>
            <param name="format">FORMAT_HTML</param>
            <param name="contentDisposition">
                        attachment; filename="yourFileName.html"</param>
            <param name="documentName">yourFileName</param>
    </result>
</action>
于 2012-12-14T10:47:10.397 回答