• Post Reply Bookmark Topic Watch Topic
  • New Topic

front end jsp conforming to sql  RSS feed

 
p paul
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.



 
K. Tsang
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!