0

I have a JSF page code snippet like below:

<h:inputText value="#{locConfigBB.fetchFldVal('FACEBOOK_PAGE_URL')}"/>
<h:inputText value="#{locConfigBB.fetchFldVal('TWITTER_ID')}"/>

My pojo 'FieldDetail' class has two attributes named 'fieldInternalName' & 'fieldInternalValue'.

The above code gives me value stored in the database associated with the 'fieldInternalName', which I am passing as parameter (e.g. 'TWITTER_ID'). But now my requirement is, if my database doesn't contain records with the given 'fieldInternalName' (i.e. 'TWITTER_ID'), I need to enter a value in the input text so that I will have a list of 'FieldDetail' (which will create records as per my user input)

It means if I would enter a value in the inputText field with label 'Facebook Id' n submit the form then my list in the baking bean will contain only one object

I had tried to search and explore but couldn't get right way to solve this problem.

How can I pass both the static value n user enterd value together to managed bean that create a list of objects ?

I would be very much greateful if anybody can help. Thanks in advance. Let me know if further information required.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Vebbie
  • 1,669
  • 2
  • 12
  • 18
  • @BalusC : Thank you for your consideration. It is already working well with the given jsf code. I am editing the question to give you some idea about my 'fetchFldVal()' – Vebbie Nov 24 '15 at 10:43
  • @BalusC : Yeah exactly. That is what happening. But I can't make them normal properties beacause they are arbitrary inputs (I need to create objects as and when user inputs are made). That is why I have taken a general attributes as 'fieldInternalName' and 'fldValue'. – Vebbie Nov 24 '15 at 10:45
  • @BalusC : Moreover, I have multiple inputs of the same kind.Which will create multiple objects. – Vebbie Nov 24 '15 at 10:50
  • @BalusC : I tried to explore on Map to bind properties with dynamic bean. I have got something like 'http://stackoverflow.com/questions/3510614/how-to-create-dynamic-jsf-form-fields?lq=1' & 'http://stackoverflow.com/questions/2226122/dynamic-value-binding-of-jsf-component?rq=1' but found not related to my problem.. I have shared my code here to let you know what I exactly required. – Vebbie Nov 24 '15 at 17:43
  • https://drive.google.com/open?id=0B4DLSMGbj7QnLUVDenBLeExCU0E – Vebbie Nov 24 '15 at 17:45

0 Answers0