File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Object as a parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Object as a parameter" Watch "Object as a parameter" New topic

Object as a parameter

Ali Yuruz

Joined: Oct 10, 2007
Posts: 8
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

Joined: Jun 25, 2001
Posts: 17421

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Object as a parameter
It's not a secret anymore!