This is my Strut file.
The problem with
String path2=request.getParameter("path1");
This method may return null
if parameter path1
is missing. If it's not null
then it should be a valid path to the readable file that you application has access.
Read the example How to read file in Java – FileInputStream. You can trace the output with the code.
System.out.println("Total file size to read (in bytes) : "
+ getFileInputStream().available());
The getter is needed to return a stream
result, and as you are using dynamic parameter in the result config. You should provide the getter for fileName
.