JavaSercer Pages In the doEndTag( ) method, all (Postgres hosting)

January 28, 2007 on 5:35 pm | In Java |

JavaSercer Pages In the doEndTag( ) method, all request parameters with information about the employee are first retrieved. If a parameter is missing, an exception is thrown. Then an SQLCommandBean instance is created, the DataSource object fetched from the application scope, and a Connection created and provided to the bean. The bean is used to execute a SELECT statement to find out if the specified employee is already defined in the database. If not, the bean is used to execute an INSERT statement with all the information provided through the request parameters. Otherwise, the bean is used to execute an UPDATE statement. The tag handler class described here is intended only to show how you can use the database access classes to implement your own custom actions. The tag handler class could be improved in several ways. For instance, it could provide default values for missing parameters, such as the current date for a missing employment date, or an email address based on the employee’s first and last names if the email address is missing. You could also use a bean as input to the action instead of reading request parameters directly. This would allow the bean to be used as described in Chapter 6, and Chapter 8, to capture and validate the user input until all information is valid, and then pass it on to the custom action for permanent storage of the information in a database. page 259
Hint: If you are looking for high quality webhost to host and run your jsp application check Vision web hosting jsp services

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.