• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 result type stream problem

 
Rajani Panchumarthy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have the following configuration in struts.xml:
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment; filename="${filename}"</param>
<param name="bufferSize">1024</param>
</result>

There is a method in the action class that returns bytearray input stream as follows:
public InputStream getInputStream () { return new ByteArrayInputStream (caseBytes ); }

But I get an exception saying that inputName parmater does not match the inputStream.
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.


Could you please help.


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Can you show the complete action configuration and the URL you're using to access it?
 
Rajani Panchumarthy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Below is the action class code:

2. struts.xml contains the following configuration:
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code doesn't reflect the code you showed in the first post.

Can you post the current code and the URL you're using to access the action?
 
Rajani Panchumarthy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please find the current code:

1. Below is the action class code:


2. The method showCaseAttachmt() is written in ejb layer, where the business object,mgmtBO invokes the call.This method talks to the database, fetches the bytes of the file and returns a ByteArrayInputStream.



3. struts.xml contains the following configuration:


And the URL that is being used in JSP to invoke the action:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic