0

I need to design a JSF (or JSP) page where the text box vary dynamically based on key fields (fruits,Sweet, Biscuits ) . For example in a shop they have 3 product fruits (a,b,c), Biscuits (d,e) , Sweet s(f,g,h,I,j) if select

Select Option : Fruits

|Name|Price|

|A | 5|

|B | 6|

|c | 12|

It should show the 3 items in it and I need to get/Enter the price for it and I want to store it, likely Sweet means 4 text box .

2 Answers 2

1

Create a DO (data object) Fruit with fields name and price Create a Data Access Object to fetch the DO from database Create a Service Object to get value of DO from Data Access Object Create a managed bean to get value of DO from Service Object. Save the list of this DO object in managedbean as a List. Bind this list with the JSP (you can use h:dataTable)

Above steps will show you the list of fruits. If this all works well, you can proceed with implementing the edit logic.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to call a javascript function on selection/change of select box. Create a table with empty rows below select box, where you want to show fields name and price.

That javascript function will first delete all rows of table and then create new rows based on the field like fruit selected. Each row will have name and price in it. For creation of dynamic rows see here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.