Hi,
I have some complex JSP pages that deal with a complex underlying domain model. I have written a lot of code that maps the parameters from the HTTP Request object into this domain model. Then I can do things like validation and persistence etc. But as I write this code I begin to feel there has to be a better way. I have A LOT of set() and get() methods and it gets hard to maintain if the domain model changes or the on screen parameters change.
So, is there a general way of solving this that I should know about?
Many thanks,
Mike.
Discussions
Web tier: servlets, JSP, Web frameworks: Mapping the HTTP request to a bean / domain object
-
Mapping the HTTP request to a bean / domain object (4 messages)
- Posted by: Mike Hogan
- Posted on: January 22 2002 13:18 EST
Threaded Messages (4)
- Mapping the HTTP request to a bean / domain object by Adam Young on January 22 2002 13:27 EST
- Mapping the HTTP request to a bean / domain object by Mike Hogan on January 23 2002 03:15 EST
- Mapping the HTTP request to a bean / domain object by Vivek Srivastava on February 04 2002 03:25 EST
- Mapping the HTTP request to a bean / domain object by Adam Young on February 04 2002 10:05 EST
- Mapping the HTTP request to a bean / domain object by Mike Hogan on January 23 2002 03:15 EST
-
Mapping the HTTP request to a bean / domain object[ Go to top ]
- Posted by: Adam Young
- Posted on: January 22 2002 13:27 EST
- in response to Mike Hogan
-
Mapping the HTTP request to a bean / domain object[ Go to top ]
- Posted by: Mike Hogan
- Posted on: January 23 2002 03:15 EST
- in response to Adam Young
Adam, thanks for the reply.
I've taken a quick look at struts. From what I have seen so far it seems struts maps the request parameters only into a single, flat bean. But I have a more complex domain model i.e one that involves a hierarchy.
I need the address.city field in the JSP to be mapper to user.getAddress().getCity(). Can struts do that?
Thanks again,
Mike. -
Mapping the HTTP request to a bean / domain object[ Go to top ]
- Posted by: Vivek Srivastava
- Posted on: February 04 2002 03:25 EST
- in response to Mike Hogan
Hi Mike,
I m doing the same thing in my application. We are using struts but for now we are converting the form into domain objects before passing them into the action bean. However when we want to display the data in the jsp we can directly call the hierarchical objects.
have you found a better way to do it.
Thanks in advance -
Mapping the HTTP request to a bean / domain object[ Go to top ]
- Posted by: Adam Young
- Posted on: February 04 2002 22:05 EST
- in response to Mike Hogan
Sorry so long in replying. THe nightly builds allow nested parameters. YMMV. We use it.
The documentation is supplied with the distro for the build