aspose file tools*
The moose likes JSP and the fly likes Text Box Validation in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Text Box Validation in JSP" Watch "Text Box Validation in JSP" New topic
Author

Text Box Validation in JSP

Niraj Jamun
Greenhorn

Joined: Apr 17, 2012
Posts: 5
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
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

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.


No pain, No gain.
OCJP 1.6
Niraj Jamun
Greenhorn

Joined: Apr 17, 2012
Posts: 5
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?
William Flores
Greenhorn

Joined: Dec 14, 2011
Posts: 29

Hi,

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

Joined: Apr 17, 2012
Posts: 5
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.
Pondurai Singh
Ranch Hand

Joined: Jun 27, 2011
Posts: 35
simple jsp coding


Software Developer, Oracle Java Certification Training Labs at EPractize Labs.
Niraj Jamun
Greenhorn

Joined: Apr 17, 2012
Posts: 5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Text Box Validation in JSP
 
Similar Threads
Retriving value from the JTextField(Challanging task....)
addActionListener problem...
Automatic Tab
Use of "MultipartParser" in com.oreilly.mulitpart
Data truncation: Truncated incorrect DOUBLE value: