This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie Encapsulation / Information Hiding Question

 
Rob Shoults
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to java and JSF. For a project I am working on, I have objects that I know need to be app or session scope but I want to hide those completely from the UI designers that might call them. How is this typically accomplished in the java web world?

I know that i can add these as managed beans for JSF or manually add them to the arttributes map for a specific context. However, I am under the impression that UI designer for JSP or JSF could still access these beans in their pages. Is this true? Does the class/member access modiers have any control over page access? What options do I have to solve this problem?

Any help is much appreciated.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Shoults wrote:I am new to java and JSF. For a project I am working on, I have objects that I know need to be app or session scope but I want to hide those completely from the UI designers that might call them. How is this typically accomplished in the java web world?

provide a private no-argument constructor!
Rob Shoults wrote:
I know that i can add these as managed beans for JSF or manually add them to the arttributes map for a specific context. However, I am under the impression that UI designer for JSP or JSF could still access these beans in their pages. Is this true?

Yes!
 
Rob Shoults
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman,

What I really want to do is setup an AppMgr class that completes all the application setup and is callable by other business logic classes. Of course, this class should be a singleton and application scoped and should not be accessible to any designers through their page logic.

How would I do that? I know you mentioned providing a private parameterless constructor but I don't understand how that would work. Can you elaborate?
 
Rob Shoults
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked a related question on another forum post concerning Singleton implementation in JSF. This issue was resolved on that post.
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob, maybe you could you post a link or something, otherwise it's just been a waste of time reading this...
 
Rob Shoults
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Brendan,

Here is the related post: http://www.coderanch.com/t/558593/JSF/java/Newbie-Singleton-Enforcement
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob, I'll take a look tomorrow.

Regards,
Brendan.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!