aspose file tools*
The moose likes JSP and the fly likes Wanted to hide and show the fields at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Wanted to hide and show the fields at runtime" Watch "Wanted to hide and show the fields at runtime" New topic
Author

Wanted to hide and show the fields at runtime

Ankit Khandelwal
Greenhorn

Joined: Feb 21, 2012
Posts: 13
Hello All

I have a requirement in my project in which i need to choose the fields to display on my page conditionally . e.g May be for one customer i have to show 10 fields in my one page and for other cutomer i have to show 12 fields for the same screen. Becuase of less awareness about the technologies , i am not able to understand how could i achive this requirement.

Moreover i need to select field type ( Input Box, Drop Down and radio button ) and whether it is mandatory or non mandatory check at runtime.

Please suggest me , if you have proper idea regarding this query.


Thanks
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
From your question, I am guessing you are new to web applications. It would be helpful, if you let us know what have you done so far and if you are stuck anywhere.

I have a requirement in my project in which i need to choose the fields to display on my page conditionally . e.g May be for one customer i have to show 10 fields in my one page and for other cutomer i have to show 12 fields for the same screen. Becuase of less awareness about the technologies , i am not able to understand how could i achive this requirement.


http://docs.oracle.com/javaee/1.4/tutorial/doc/JSTL4.html Here, you should find Conditional JSTL tag <c:if/>. It can be used.

Moreover i need to select field type ( Input Box, Drop Down and radio button ) and whether it is mandatory or non mandatory check at runtime.


Javascript/Ajax can be used here.

Ankit Khandelwal
Greenhorn

Joined: Feb 21, 2012
Posts: 13
Thanks Saurabh for your quick reply.

I have gone through with various technologies like spring/jsp/servlet/Java Script but i am getting the exact idea , how to achieve this kind of req. But yes i am new to this forum.

I am trying to explain my problem statement again here.

I have to render fields in my page after reading some configurations from DB like I need 'First Name' , 'last name' and address for customer one and I need only First Name and Last Name for another customer. Its a kind of ERP solution.

Let me know if you feel any problem to understand my problem.

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
Ankit Khandelwal wrote:
I have to render fields in my page after reading some configurations from DB like I need 'First Name' , 'last name' and address for customer one and I need only First Name and Last Name for another customer. Its a kind of ERP solution


How do you identify that for one customer you need X number of fields and for another customer you need Y number of fields? I am sure there some decisive attribute.
Ankit Khandelwal
Greenhorn

Joined: Feb 21, 2012
Posts: 13
We will have an organization id associated with user id... then we will have screen ids with org id in another table than w.r.t each screen id we will have columns id..like that
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
I would follow following steps,

1) Now, it really depends on you where you want to apply orgId/screenId filter
1) At database level i.e. fetch only what you need
2) At presentation level i.e. JSP or whatever you are using

2) After you have data, you prepare beans/list of objects and pass it to presentation layer
3) Here, you have to iterate over data, use <c:forEach/> tag.
- Using that access screenId propperty, and use it <c:if/> i.e. if screen id is X do this, else do that etc.

Let me know if any of steps are unclear.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wanted to hide and show the fields at runtime
 
Similar Threads
Program action of a page dynamically depending on the link from where it is called
the old form values
carrying info across pages...Pls help.
intermediate submit and validation of a form
Invoking java layer from JSP