aspose file tools
The moose likes JSF and the fly likes Displaying dynamic fields (with JSF validation) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Displaying dynamic fields (with JSF validation)" Watch "Displaying dynamic fields (with JSF validation)" New topic
Author

Displaying dynamic fields (with JSF validation)

David Win
Greenhorn

Joined: Dec 10, 2008
Posts: 3
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

Joined: Oct 08, 2006
Posts: 2458
You can use h:dataTable for that.


Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Displaying dynamic fields (with JSF validation)
 
Similar Threads
Jsp-page populated after succesful insert
HashMap and For loop issue
dynamic navigation
any othe way to getParameters?
How to load input textfields dynamically in my web page using Spring roo?