• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Advice on managing objects in requests

 
Ranch Hand
Posts: 231
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

First off, sorry if this is posted in the wrong forum, couldn't decide between newbie, servlet/JSP or general

I'm looking for some advice on how I should be managing my objects via requests, I have several JSPs that deal with handling different parts of my objects, and I'm getting a bit confused as to how I should be passing them through the requests as I go between the pages

My main domain object is my "client", which looks as follows



My client has a number of "contacts" attached to it, there can be zero to unlimited of these.


My application has a structure similar to this




From the start, on my list of clients I can easily create a link called "edit" that passes the client Id as a parameter to my action and then looks up the object. I can easily switch between the client overview and client edit page by passing the client ID through the request parameter.

My problems come with dealing with contacts, I can display a list of the contacts OK as I use the client ID to look these up. but if I want to edit a contact that is where I struggle.

I pass the client ID and the contact ID through to the action, and lookup the client, but what should I do to ensure I get the right contact? What about issues with the contact becoming detached from the client? therefore I have trouble persisting?

The technologies I'm using are Stripes MVC framework, JPA, Hibernate, Spring, and JSPs

How would you implement the passing of objects? Is there some framework that would help with this, or am I just not understanding my current frameworks enough?

Thanks

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I pass the client ID and the contact ID through to the action, and lookup the client, but what should I do to ensure I get the right contact?


I'm not sure I understand the problem. Given the contactID (or maybe the combination of clientID and contactID, depending on the data model), what problem is there getting the "right" contact? The ID (or IDs) should identify the contact uniquely, no?
 
reply
    Bookmark Topic Watch Topic
  • New Topic