Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object as a parameter

 
Ali Yuruz
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,
Here is my JSF page. I try to send current HyperlinkBean Object to HyperlinkVerwalterObject.
It will be saved in that class. The class has a method which accepts HyperlinkBean as a parameter.

How is it possible? I didn't find any way to solve it..

Method in HyperlinkVerwalter:


JSF Page :
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JSF View is (normally) rendered as HTML. HTML is a text-only format (no binary information). Objects are binary constructs.

That means that to pass an object on a web page (HTML View), you'd have to convert the object to text format as part of the page rendering process and convert the text representation of the object back to binary form when the page is submitted. And as a bonus, it won't actually be the same object as what you started with (so the "==" test fails).

Actually, in addition to the trouble and overhead, passing internal objects back and forth across web pages makes for a very insecure webapp, since a hacker can tinker with the object while it's on the client side.

More commonly, one would pass the identifier of an object and use that to reference the original object back on the server. Session-scope objects work that way, for example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic