GeeCON Prague 2014*
The moose likes JSP and the fly likes best way to display multiple pages with almost similar fields on them?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "best way to display multiple pages with almost similar fields on them??" Watch "best way to display multiple pages with almost similar fields on them??" New topic
Author

best way to display multiple pages with almost similar fields on them??

Anil Jain
Ranch Hand

Joined: Mar 10, 2002
Posts: 51
Friends:
I have a situation. I have to display 15-20 web pages. These web pages are forms and have almost same functionality. some pages require 5 fields while other require 8, something like that. but there are some pages that have almost same fields with a diffence of 1 or 2.

I don't want to hard code the 15-20 web pages. is there any way that we can create the web pages on the fly as per the user requirement.???
Every suggestion is appreciated
R
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Have some kind of object in some scope (say request) which keeps track of these requirements. In your JSP, refer to this object and conditionally render your form fields based on the properties of that object.
The object in question might return a simple boolean for whether or not to render a particular field. For example, let's say our object is called "requirements":

Anyway, you get the idea.
HTH
[ January 07, 2003: Message edited by: Jason Menard ]
Jeya Balaji
Ranch Hand

Joined: Jan 02, 2003
Posts: 40
How about having a collection object to hold different sets of field names?
for eg, let us have a Map in which we store the list of fields like this :
"page1" => {"name", "password", "age" ...}
"page2" => {"name", "addr", "acc" ...}
...
Disadvantage :
* This might end up in a rigid presentation * inflexible for tuning form tags
Have fun.
Regards,
Balaji


Regards, Balaji
Anil Jain
Ranch Hand

Joined: Mar 10, 2002
Posts: 51
thanks jason and jeya!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best way to display multiple pages with almost similar fields on them??