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

Dynamic Forms

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Hi there,

I have a Backing Bean for my Edit User page. The Edit User page allows an admin to edit the user details.

Now, I want to create a View User page which is exactly similar to the Edit User page except that it doesnt allow you to edit the details (read only)

I dont want to make two seperate pages for this. How can I achieve this using my backing bean?

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Well, you can simply disable all the controls, but that usually looks pretty ugly. Plus when everything's framed in a control object, users are apt to get confused when they see an "editable" form with nothing editable on it.

I've always (dating all the way back to when JSPs first came out) maintained 2 separate JSPs for this kind of stuff. It may seem like duplication, but it gives a lot more control over the appearance. Usually my display and edit views don't look that much alike anyway.

An IDE is no substitute for an Intelligent Developer.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
It may seem like duplication

thats exactly what i am trying to avoid
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You can go for disabling the fields. But then you need to beautify the stuff. And, surely, need to handle those confusions which might occur when user see the same with disabled field. We can spiffy that using CSS.

I agree. Here's the link:
subject: Dynamic Forms
It's not a secret anymore!