Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying dynamic fields (with JSF validation)

 
David Win
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys


Is there a way in JSF/JSP to display dynamic fields (particularly text fields) without extensive java script? Its almost like I want dynamic setting/getter on fields on the bean but I don't know the field names until run time.


I am guessing the best way is to have a HashMap of (fieldname, value) and have the JSP page iterate the map for each fieldname.

for example, the hashMap could be ("FirstName","Ben"),("LastName","Smith"),("SSN","555-55-5555"),("DOB","1-1-1960")

I basically want the page to display FirstName, LastNameSSN (keys from the HashMap).


However, I can't find a tag that iterates or code that does this for me.


I am trying to find an elegant way to do it with minimal java script if possible and even better if JSF validates it for me.

Any help or info is much apperciated.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use h:dataTable for that.
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!