This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Java Script for testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Java Script for testing" Watch "Java Script for testing" New topic

Java Script for testing

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
Can anyone pls tell me why is Java Script preffered for validation of JSP's?
Thanking you
aziz d
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
JSP just generates an HTTP response. You need to validate the response. HTTPUnit is a good unit testing framework to do just that. I'm not sure I'd go as far as saying that JavaScript is preferred, but definitely some client-side unit testing framework is necessary to validate that your JSP files are generating the correct output.

Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30057

Do you mean testing the jsp or testing what the user entered on the jsp? If you are testing the jsp itself, I agree that HttpUnit is good.
If you are testing user input, javascript is good because it doesn't require a server roundtrip. It gives the user immediate feedback. It is good to have server side testing too in case someone turns over javascript.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Java Script for testing
Similar Threads
How to redirect to a new page using JSP?
on Action
Need help regarding text fields
use of JavaScript
how to get sum for dynamic checkboxes