Hello,
If I try to upload three images at a time, than it is generating an error "No result defined for action" and my code is as per follows:
QuestionAction.java
public void imageUpload_ans(String filename, File file){
try {
String filePath = "F:/bigroshan/EzySystemTest/images/";
File fileToCreate = new File(filePath, filename);
System.out.println(filename);
FileUtils.copyFile(file, fileToCreate);
answerTable.setAnswerImage(filename);
} catch(Exception e) {
System.out.println("Error");
answerTable.setAnswerImage("");
}
} and struts.xml
<action name="addQuestionAnswerToDB" class="com.digitize.ezysystemtest.QuestionAnswerAction"
method="addQuestionAnswerToDB">
<interceptor-ref name="fileUpload">
<param name="allowedTypes">
image/png,image/gif,image/jpeg,image/pjpeg
</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<result name="success" type="redirect">questionAnswer</result>
</action>
and index.jsp
<s:file id="ans1" formIds="formQuestionAnswer" name="ans1Image" label="Answer 1" />
<s:file id="ans2" formIds="formQuestionAnswer" name="ans2Image" label="Answer 2" />
<s:file id="ans3" formIds="formQuestionAnswer" name="ans3Image" label="Answer 3" />