Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating drop down from Database

 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I have few doubts,
1.I have an application in which some 10 jsp's are there, each having many dependencies, how can this drop down selection be made easier and high performance.
Example
Country -- List of countries
State -- List of states of that country
City -- List of Cities of that state.
Data has to be pulled from database smiliarly checkboxe values has to be pulled from database
2.I have many validations for submitting the form, how can we judge which one to put on client and which one on server (like mandatory fields and business rules).

Thanks in advance
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Retrieve the DB values in a servlet and attach them in a scope. Then forward to the JSP and display them. What validations need to be on the client/server depends on your scenario. Alternatively you could also use AJAX to do it. Would be pretty efficient and fast but needs more coding and you have to explore that area. Like stuff where your javascript etc etc have to conform to MVC for better code maintainance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the dependent drop-downs, Ajax can be used to fetch the data for each subsequent drop-down when a selection is made from the previous one.

The validation question is easier: all data must be validated on the server. Always!

You can perform client-side validation in order to give your user quicker feedback, but regardless of whether client-side validation takes place the data must be validated on the server.
[ March 31, 2007: Message edited by: Bear Bibeault ]
 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

But this is a huge transaction oriented application (webservices) where >100 validations has to be done and speed also less (100kb)
Still need to go for Server side ?


Thanks
Rudresh
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rudresh kumar:
Still need to go for Server side ?


Always. Absolutely. Always. Without question. Always. And did I mention always?

Data from the client can never be trusted -- it's too easy for everybody from script kiddies to malicious hackers to spoof requests to your site. Ignoring data validation on the server opens your site up to a variety of security concerns.

Likewise any user-entered data must always be checked for cross-site scripting attacks and must be HTML-encoded when displayed on a page. What will happen, for example, if a user enters the string "</HTML>" as a data value that you later emit, unencoded to the page?
[ March 31, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic