0

I'm using struts and hibernate, when i add multiple action in struts.xml file, it reads only one action not others and also there no error. Here is my struts config file....form action name of jsp page is same, please help me anyone if you know the way......

<struts>
<package name="addController" extends="struts-default">

<action name="see" method="user" class="addController.Addaction">
<result name="input">/read.jsp</result>
<result name="success">/successview.jsp</result>
</action>

<action name="adduser" method="addEmployee" class="addController.Addaction">

 <interceptor-ref name="fileUpload">  
  <param name="maximumSize">97097152</param>  
  <param name="allowedTypes">  
   image/png,image/gif,image/jpeg,image/jpg</param>  
  </interceptor-ref>  
  <interceptor-ref name="defaultStack"></interceptor-ref>  

<result name="input">/addemp.jsp</result>
<result name="success">/success.jsp</result>
</action>

</package>
</struts>

Action class

private HttpServletRequest request;
private long mobile;
private int id;
private String imageContentType, imageFileName, documentContentType, documentFileName; 
private String  name;
private String  comname, department, designation, email, address, city, empid, maritalstatus;
private Date dob,anniversary;
private File image,document;

//getters && setters

public String addEmployee() throws Exception {
   System.out.println("addEmployee");
   return "success";
}

public String user() {
   System.out.println("user");
   return "success";
}
Blasanka
  • 21,001
  • 12
  • 102
  • 104
P.Kumar
  • 1
  • 1
  • 1) Post your action name too 2) Define "don't work": you don't see any System.out printed ? What the NET panel of your browser's dev tools is getting as a response ? 3) You clearly have no idea about SRP: use one Action for every single action you have to perform ([read more](https://stackoverflow.com/a/35689796/1654265)) 4) Use camelCase, hence AddAction not Addaction, addUser not adduser, and try to keep naming convetions consistent 5) Extend ActionSupport and use constants for results, eg. SUCCESS instead of "success". Improving is good, always pursue the improvements over the immediateness – Andrea Ligios May 26 '17 at 12:16
  • 1
    And please indent your config file properly. – Dave Newton May 26 '17 at 15:01
  • Your problem is undefined. – Roman C May 26 '17 at 20:25

0 Answers0