You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by krishan rathi <kr...@yahoo.com> on 2006/09/11 13:32:43 UTC
Constructor of Action is executed but getting a blank screen
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 <kr...@yahoo.com> 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! Messengers low PC-to-Phone call rates.
Re: Constructor of Action is executed but getting a blank screen
Posted by David Grundberg <c0...@cs.umu.se>.
Try overriding "execute", not "excecute" :)
krishan rathi wrote:
>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 <kr...@yahoo.com> 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.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Constructor of Action is executed but getting a blank screen
Posted by krishan rathi <kr...@yahoo.com>.
thanks
Emilia Ipate <ei...@nl.swets.com> wrote: Hi!
It might sound stupid, but just check: Your execute method from Action is actually called "excecute" instead of "execute".
-----Original Message-----
From: krishan rathi [mailto:kris_rathi79@yahoo.com]
Sent: Monday, September 11, 2006 1:33 PM
To: Struts Users Mailing List
Subject: Constructor of Action is executed but getting a blank screen
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 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
RE: Constructor of Action is executed but getting a blank screen
Posted by Emilia Ipate <ei...@nl.swets.com>.
Hi!
It might sound stupid, but just check: Your execute method from Action is actually called "excecute" instead of "execute".
-----Original Message-----
From: krishan rathi [mailto:kris_rathi79@yahoo.com]
Sent: Monday, September 11, 2006 1:33 PM
To: Struts Users Mailing List
Subject: Constructor of Action is executed but getting a blank screen
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 <kr...@yahoo.com> 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org