Phpnuke hosting - JavaSercer Pages The Column class is an abstract

January 26, 2007 on 6:32 am | In Java |

JavaSercer Pages The Column class is an abstract class, very similar to the Value class shown in Example 17.4. It contains access methods for all datatypes, with default implementations that throw an UnsupportedConversionException . Each subclass provides a real implementation of the access method corresponding to its type, plus the getString( ) method. Example 17.13 shows the IntColumn class. Example 17.13. The IntColumn Class package com.ora.jsp.sql.column; import com.ora.jsp.sql.Column; public class IntColumn extends Column { private int value; public IntColumn(String name, int value) { super(name); this.value = value; } public int getInt( ) { return value; } public String getString( ) { return String.valueOf(value); } } The constructor takes the column name and value as arguments. The name is used to initialize the Column superclass and is returned by its getName( ) method. 17.3 Developing Generic Database Custom Actions The database custom actions introduced in Chapter 9 can be used like this in a JSP page: UPDATE Account SET Balance = Balance - ? WHERE AccountNumber = ? UPDATE Account SET Balance = Balance + ? WHERE AccountNumber = ? The database custom actions use all of the classes described previously in this chapter. A DataSource available in the application scope is used to get a Connection, and an SQLCommandBean is used to execute the SQL statement specified in the database action element body. The nested value actions create Value subclass instances and add them to a list held by the parent action tag handler. The action saves the result as a Vector of Row objects in the scope specified by the page author. In this section, we first look at how the tag handlers for the , , and actions are implemented. All value actions follow the same pattern as , so they are not described here. At the end of this section, we also look at the tag handler for the action to see how it provides a transaction scope for the database actions nested in its body. page 249
Hint: If you are looking for good and high quality web space to host and run your java application check Vision java web hosting services

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.