Java & J2EE Page 5 - The JSP Files (part 7): Bugs, Beans And Banks |
It's also possible to use the Java "throw" construct to artificially induce an exception in your JSP script. This comes in handy, for example, when validating form field data - if the values entered are not in the expected format, you can throw an exception (with an informative error message) and re-direct the user to an error page. Here's an example of how this can be used. This is a simple form which asks you to enter a number
and this is the server-side JSP script which checks it for errors, and throws an exception if certain conditions are not met.
Next up, a brief look at JavaBeans and how they integrate with the JSP environment.
blog comments powered by Disqus |