• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Object as a parameter

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :
Saloon Keeper
Posts: 24287
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic