3 Replies Latest reply on Sep 9, 2007 1:05 AM by Igor Shabalov

    Dynamic number of input types

    zenon kowalski Newbie

      Hi all again,

      Now I'm trying to solve another JSF/Seam related problem and hope yopu will help me to do it :)

      I have an Seam component defined as:

      class Account {
       private String id;
       private String name;
       private List<Limit> limits;
       // getters and setters here
      class Limit {
       private String type;
       private Long value;
       // getters and setters here

      Now my problem begins here: each account can have different limits number. Limits are system-wide configuration (e.g. you can have 4 different limit types defined and the you get a list with 4 items in Account instance). I can easily print all limit types and their input types using facelets <ui:repeat>:

      <ui:repeat value="#{account.limits}" var="limit">
       <h:outputText value="limit.type"/>
       <h:inputText value="limit.value"/>

      But I'm affraid is't a bad solution. I want to submit form data together with limits data. Now I get NullPointerException on limits field in my action Bean. How can i properly get all the data? Do I need to use Limit as seam component also? Or do I have to use long running conversation somehow?

      Thanks for replies.