• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Question regarding one-to-one mapping

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need to have one-to-one mapping between fields on the jsp page which contains the form, and the fields in the ActionForm subclass ? Or is it just one-to-one mapping between the fields on the jsp page and the getter and setter methods in the ActionForm subclass?

Example : Can I do this?

public class AddPayeeForm extends ActionForm
{
private Payee p;

public void setName (String name)
{
p.setName (name);
}

String getName ()
{
return p.getName ();
}


public void setAddressLine1 (String addressLine1)
{
p.setAddressLine1 (addressLine1);
}

public String getAddressLine1 ()
{
return p.getAddressLine1 ();
}

and so on ..


I have to create a Payee object since I have to show all the payees in ShowPayees.jsp and I will be repeating the same methods in my Payee class and AddPayeeForm class (ActionForm subclass) , so this will avoid duplication of code to a certain extent.

Or is there any other better way to do this?

Any help will be greatly appreciated!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?

As far as I know there's no reason you can't do this, although you could also just change the form to use the payee object.
 
Meg Jolie
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.. I will try it then.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic