Archive for the 'Java' Category

JavaSercer Pages 17.3.1 (Php5 hosting) The and Actions The and

Friday, January 26th, 2007

JavaSercer Pages 17.3.1 The and Actions The and actions both need access to the action body to read the SQL statement. Hence, the corresponding tag handlers extend the BodyTagSupport class described in Chapter 16. They also implement an interface called com.ora.jsp.sql.ValueParent, which is used by the nested value actions to find the correct parent, following the pattern described for cooperating actions in Chapter 16. These two actions share the same set of attributes and have almost the same behavior, so a common superclass called com.ora.jsp.tags.sql.DBTag implements most of the tag handler functionality for both actions. Example 17.14 shows the top part of the DBTag class, with the class declaration and all property setter methods. Example 17.14. The DBTag Declaration and Properties package com.ora.jsp.tags.sql; import java.util.*; import java.sql.*; import javax.sql.*; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import com.ora.jsp.sql.*; import com.ora.jsp.sql.value.*; public abstract class DBTag extends BodyTagSupport implements ValueTagParent { private SQLCommandBean sqlCommandBean = new SQLCommandBean( ); private String dataSourceName; private String id; private int scope = PageContext.PAGE_SCOPE; private String sqlValue; private Vector values; private boolean isExceptionThrown = false; private boolean isPartOfTransaction = false; public void setDataSource(String dataSourceName) { this.dataSourceName = dataSourceName; } public void setId(String id) { this.id = id; } public void setScope(String scopeName) { if (”page”.equals(scopeName)) { scope = PageContext.PAGE_SCOPE; } else if (”request”.equals(scopeName)) { scope = PageContext.REQUEST_SCOPE; } else if (”session”.equals(scopeName)) { scope = PageContext.SESSION_SCOPE; } else if (”application”.equals(scopeName)) { scope = PageContext.APPLICATION_SCOPE; } } An instance of the SQLCommandBean is kept as a private instance variable. The bean is used to perform all database operations; the tag handler just provides an easy-to-use interface to the bean for page authors. The setter methods for the dataSource and id properties set the corresponding instance variables. The setter method for the scope property converts the String value to the corresponding scope int value defined by the PageContext class before saving the value, since the int value is later needed in the doEndTag( ) method. The page author specifies the SQL statement to execute in the action element’s body. Because the tag handler implements the BodyTag interface (by extending the BodyTagSupport class), it can read the SQL statement in the doAfterBody( ) method as shown in Example 17.15. page 250

Hint: This post is supported by Gama web hosting php mysql provider


Phpnuke hosting - JavaSercer Pages The Column class is an abstract

Friday, January 26th, 2007

Budget web hosting - JavaSercer Pages Example 17.12. The Row’s Column Value

Thursday, January 25th, 2007

JavaSercer Pages 17.2.2 The Row and Column Classes (Windows web hosting)

Thursday, January 25th, 2007

JavaSercer Pages The executeUpdate( ) method, shown in

Thursday, January 25th, 2007

JavaSercer Pages The code for creating (Domino hosting) the PreparedStatement

Thursday, January 25th, 2007

JavaSercer Pages public int getInt( ) { return (Verizon web hosting)

Wednesday, January 24th, 2007

JavaSercer Pages 17.2.1 The SQLCommandBean and Value Classes

Wednesday, January 24th, 2007

Cms hosting - JavaSercer Pages The initialization servlet should also clean

Wednesday, January 24th, 2007

JavaSercer Pages The servlet class, defined by the (Web hosting india)

Tuesday, January 23rd, 2007