• 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
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Text Box Validation in JSP

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

I have scenarion below
username txtfield
password txtfield

submit button

if username is not entered
error msg should be displayed in front of text field
username txtfield *please enter username

i want to do this in jsp and not in struts or any framework
anyone have idea regarding this.any custom tags or code you already have
 
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a simple way just have hidden <td> which contains error message and make it display when the script finds user name field is empty when to submit the form.
 
Niraj Jamun
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:As a simple way just have hidden <td> which contains error message and make it display when the script finds user name field is empty when to submit the form.



Hi,
thanks for the reply
i just gave eg of username n password jsp
in my jsp i have many field for each field new TD is not a good solution
it will increase the logic in my code also
Do you know any custom tag which will solve my prblm?
 
Ranch Hand
Posts: 32
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Use jQuery to do this.
Have you ever tried it?
 
Niraj Jamun
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Flores wrote:Hi,

Use jQuery to do this.
Have you ever tried it?



Hi,
No, I haven't used jquery
if possible can you give me code for eg username textfield
how to display error in jsp in front of username textfield.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
simple jsp coding
 
Niraj Jamun
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pondurai Singh wrote:simple jsp coding



Hi Pondurai,

Can you please attache the /customtable1 tld which you have referred in jsp?
customtable1.tld and the respective java file

Thanks
 
Get off me! Here, read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic