struts+Action+netbeans 5.0 problem

2006-09-11 Thread krishan rathi
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:
   
  form-bean type=com.myapp.struts.forms.EmployeeForm name=employee/
   
  action input=/addEmployee.jsp type=com.myapp.struts.actions.AddEmpAction 
validate=false scope=session path=/addemp name=employee
forward path=/index.jsp name=success/
/action
   
  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.

Constructor of Action is executed but getting a blank screen

2006-09-11 Thread krishan rathi
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.

RE: Constructor of Action is executed but getting a blank screen

2006-09-11 Thread krishan rathi
thanks

Emilia Ipate [EMAIL PROTECTED] 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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

Re: Radio Button

2006-08-25 Thread krishan rathi
use the code given below
  logic:iterate id=bean name=CmdConstants propertyy=DEVICE_ID_LIST
  bean:write name=bean property=label/html-el:radio property=deviceId 
value=${value}/
/logic:iterate
   
  cheers
   
  krishan rathi.

sheetal [EMAIL PROTECTED] wrote:
  Hi,

To prepopulate, list box , I had attached LabelValueBean, with the 
select's collection ,attribute


property=value labelProperty=label / 



But Does anybody knows how to associate labelvaluebean with radio button }
(As per my knowledge we do not have a collection attrib. for radio).

Regards,
Sheetal



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.

exception java.lang.IllegalArgumentException: No bean specified while using indexed properties

2006-08-25 Thread krishan rathi

Hi all  

I am getting following exception  java.lang.IllegalArgumentException:

No bean specified while using indexed properties in struts.

MyForm Bean is 

 public class ReportItemForm extends ActionForm { 

   FormItem [] formItem=null;   

   public void setItem(int index, FormItem formItem){ 
this.formItem[index] = formItem;} public FormItem 
getItem(int index){ if(formItem==null ||(formItem.length)==0)   
  return new FormItem();

 return formItem[index]; 

   }  

and  FormItem bean is specified like this 

public class FormItem { String formitem; int order; 
public int getOrder() {return order;}/*** 
@param i*/public void setOrder(int i) {  order = i;}/** 
   * @return*/public String getFormitem() {  return formitem;   
 }/*** @param string*/public void setFormitem(String string) {  
   formitem = string;}  i have set this array of  FormItem 
i.e formItem() properly

 and the data is dispalyed correctly on the page like this  
html-el:hidden property=item[${count}].formItem /html-el:text 
styleId=order property=item[${count}].order   size=1 /  but 
when i submitting this form i am getting following

 Exception  java.lang.IllegalArgumentException: No bean specified  can 
anybody help me. any help will be greatly appriciated. thanks   
  Krishan.   



-
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small 
Business.

Getiing java.lang.IllegalArgumentException: No bean specified while using indexed properties in struts

2006-08-23 Thread krishan rathi
Hi all
   
  i am getting following exception  java.lang.IllegalArgumentException: No bean 
specified while using indexed properties in struts.
   
  MyForm Bean is 
  public class ReportItemForm extends ActionForm {
FormItem [] formItem=null;
  
   public void setItem(int index, FormItem formItem){
   this.formItem[index] = formItem;
  }
  public FormItem getItem(int index){
if(formItem==null ||(formItem.length)==0)
 return new FormItem();
return formItem[index];
  }
   
   
  }
   
   
  and  FormItem bean is specified like this 
  public class FormItem {
   String formitem;
  
   int order;
   
  public int getOrder() {
  return order;
  }
  /**
  * @param i
  */
  public void setOrder(int i) {
order = i;
  }
  /**
  * @return
  */
  public String getFormitem() {
return formitem;
  }
  /**
  * @param string
  */
  public void setFormitem(String string) {
   formitem = string;
  }
   
   
  i have set this array of  FormItem i.e formItem() properly and the data is 
dispalyed correctly on the page like this 
   
  html-el:hidden property=item[${count}].formItem /
  html-el:text styleId=order property=item[${count}].order size=1 /
   
   
  but when i submitting this form i am getting following Exception
   
  java.lang.IllegalArgumentException: No bean specified 
   
  can anybody help me.
   
  any help will be greatly appriciated.
   
  thanks
   
  Krishan.
   


-
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.

having problem Using Indexed properties with Multi select inside logic iterate

2006-06-27 Thread Krishan Rathi

 Hi i am trying to use a multi select box in logic iterate 
in this way 

logic-el:iterate indexId=ctr id=admindepartment 
name=admindepartments 

html-el:select property=bookMapped(${ctr}) multiple=true   
size=2 

html-el:options name=bean property=dbBookType/ 
/html-el:select 

/logic-el:iterate  

in the form bean i have following code. 

private Map selectedBooks; 

public Object getBookMapped(String index) { 
return selectedBooks.get(key); 
} 

public void setBookMapped(String index,Object value) { 
selectedBooks.put(key,value); 
} 
now in each multiple select box i am selecting 
multiple books but in the resulting map selectedBooks 
i am getting one value for each multiple selection 
then i had also tried using 

public void setBookMapped(String index,Object[] 
value) { 
selectedBooks.put(key,value); 
} 

but which is throwing an illegelargumenttype 
exception. 

please help. 

thanks in advance. 

krishan.



krishan Rathi


having problem Using Indexed properties with Multi select inside logic iterate

2006-06-27 Thread krishan rathi
 Hi i am trying to use a multi select box in logic iterate 
in this way 

logic-el:iterate indexId=ctr id=admindepartment name=admindepartments 

html-el:select property=bookMapped(${ctr}) multiple=true   
size=2 

html-el:options name=bean property=dbBookType/ 

/html-el:select 

/logic-el:iterate  

in the form bean i have following code. 

private Map selectedBooks; 

public Object getBookMapped(String index) { 
return selectedBooks.get(key); 
} 

public void setBookMapped(String index,Object value) { 
selectedBooks.put(key,value); 
} 
now in each multiple select box i am selecting 
multiple books but in the resulting map selectedBooks 
i am getting one value for each multiple selection 
then i had also tried using 

public void setBookMapped(String index,Object[] 
value) { 
selectedBooks.put(key,value); 
} 

but which is throwing an illegelargumenttype 
exception.

Can anybody suggest how should i use  indexed properties to tackle a group of 
multi select boxes. 

please help. 

thanks in advance. 

krishan.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]