• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

front end jsp conforming to sql  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A data entry form is on the front end. This allows one to enter say emails, addresses, etc. It utilizes a jsp, jstl, servlets, and beans. The backend sql has say a size of 50 for email. If more than 50 char are entered on the form, w/o any intervention, a truncation error is thrown. A static class was set up to hold the input element names and max sizes. It seems to work well keeping all in check, names and sizes on form, names in servlets, size of sql.



Is there any other system of keeping everything in sync. I am building it all, but I was wondering how this is parsed out if there are separate sql, middle-tier, and front-end developer? It seems better just to have good documentation that would be shared between the different implementors.



 
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About the max size thing, why not set it in the jsp text filed? So that users will only able to enter 50 chars.

The validation can so such check as well.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are trying to put user entries into SQL statements, please remember the dangers of SQL injection attacks.

Bill
 
p paul
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

K. Tsang wrote:About the max size thing, why not set it in the jsp text filed? So that users will only able to enter 50 chars.

The validation can so such check as well.



How does the front-end know the size? That is why I have the following:

<input
maxlength="${date.maxLength}"
name="${date.inputName}" />

rather than

<input
maxlength="50"
name = "date" />
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where you set the "date" variable? Are you using a servlet to forward to the jsp or display the jsp directly? I recommend/prefer the former.

I reckon such variables are constants, then you should able to use then directly by importing that class. But then is it a good approach I don't know.
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!