Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Action Forms - Struts in Action Book  RSS feed

 
aparna chi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Struts in Action book in in action forms chapter mentions that Action Forms should use only String and boolean properties. Does this mean that we can not or should not user properties of other types? What will be the happen if properties of other types are used?
 
Zeeshan Faisal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its Better to map the data Types if you are sending any type other than String or Boolean. e.g., you can convert Int to a String and later remap it to int when u will have to perform any operation.
I hope It will be helpful for you.
 
aparna chi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks.
I just want to know can i declare a property in action form as:

int a

and have getter & setters like

public void setA(int a)
{
this.a = a;
}

public int getA()
{return this.a}

What will happen if i write this code in ActionForm?
 
Ankur Srivastava
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would work fine. Infact not just primitive data types but you can have instances of Objects also in your form. The book must be talking about best practices not that you can only pass Strings using the ActionForm
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!