In this method, the public inputstream gettargetfile () {// corresponds to the file path above, and the input stream is provided, corresponding to the inputname attribute name in the configuration file
Return servletactioncontext. getservletcontext (). getresourceasstream (downloadfile );
}
When configuring strutts. XML, <Param name = "downloadfile">/Mo .jpg </param> corresponds to the preceding
The console output value is null as follows:
Null
17:49:17 com. opensymphony. xwork2.util. Logging. commons. commonslogger Error
Severe: can not find a java. Io. inputstream with the name [targetfile] in the invocation
Stack. Check the <Param name = "inputname"> tag specified for this action.
After correction:
The console output value is
Information: server startup in 16424 MS
Java. Io. bytearrayinputstream @ c1e4d5
Java. Io. bytearrayinputstream @ 119b1ca
Java. Io. bytearrayinputstream @ 98b13b
After three downloads, there will naturally be three ~~~