Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anil Jain
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anil Jain
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks jason and jeya!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic