• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Populating drop down from Database

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic