hi all
   
  Infact the constructor of Action is called but i am getting a blank screen 
and in the log file just getting the SOP in the constructor not even getting 
the Sop in the Exceute method.
   
  plz help
   
  Thanks

krishan rathi <[EMAIL PROTECTED]> wrote:
  Hi all

I am trying to use struts with netbeans 5.0 but having strange problems.

I have wrtten One ActionForm i.e EmployeeForm ,one action i.e AddEmpAction.

then in the struts-config.xml provided following entries:







and using /addEmployee.jsp as welcomefile.

But when i run my application it is displaying the addemployee.jsp correctly 
but when i click on the submit button it just displays a blank screen showing 
addemp.do in the address bar.

can anybody provide what i am missing.

the listing of my formbean and action class is following.

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
*
* @author admin
*/
public class AddEmpAction extends Action{

public ActionForward excecute(ActionMapping mapping,ActionForm 
form,HttpServletRequest request,HttpServletResponse response){
try{
System.out.println("inside action******************************************");
EmployeeForm empForm=(EmployeeForm)form;
String name=empForm.getName();
float salary=empForm.getSalary();
String address=empForm.getAddress();
Employee emp=new Employee(name,salary,address);
EmployeeDao dao=new EmployeeDao();
dao.insertEmployee(emp,1);

}
catch(Exception e){
e.printStackTrace();
}
return mapping.findForward("success");
}

}




/*
* EmployeeForm.java
*
* Created on September 11, 2006, 11:52 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.myapp.struts.forms;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
*
* @author admin
*/
public class EmployeeForm extends ActionForm {
private String name;
private float salary;
private String address;

public void reset(ActionMapping mapping,HttpServletRequest request){
setName(null);
setSalary(0.0F);
setAddress(null);
}
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
return null;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}


thanks

Krishan rathi. 


---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates 
starting at 1¢/min.

                
---------------------------------
How low will we go? Check out Yahoo! MessengerÂ’s low  PC-to-Phone call rates.

Reply via email to