![]() | ![]() | ![]() | ![]() | ![]() |
This sample shows a JSP ComboBoxView connecting to data via a JDBC connection.
Here are the steps for creating a simple ComboBoxView:
CAUTION: This sample does not create a complete Web application. The purpose of the sample is to demonstrate how to use a particular component. The sample does not address the issue of immediately freeing up resources when the user navigates off the Web application or closes the Web browser. Any necessary resources created in the sample will persist until the associated HTTPSession times out. If this sample is used in a multi-user environment, it is possible to exhaust the available resources until HTTPSessions time out and frees up their associated resources.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Tip: For help with building a Web application project and testing a Web application, see SAS Note 32218.
<%@ taglib uri="http://www.sas.com/taglib/sas" prefix="sas" %>
<%@ page pageEncoding="UTF-8"%>
<html>
<head>
<link href="styles/sasComponents.css" rel="STYLESHEET" type="text/css">
</head>
<body>
<sas:ComboBoxView id="cb1" model="sas_combo">
</sas:ComboBoxView>
</body>
</html>
|
For demonstration purposes, the code below creates a temporary data set in the Work library. To use a permanent data set, make the following changes.
String jdbcQuery = "select * from work.leveltree";
createComboDataSet(sas_JDBCConnection);
private static final String JDBC_DATABASE_URL = "jdbc:sasiom://servername:8591";
package servlets;
public class JDBCDefaultExampleControllerServlet ...sas_actionProvider.setControllerURL(request.getContextPath()+ "/JDBCDefaultExampleViewer.jsp");
package servlets;
import java.io.IOException;
import java.sql.Statement;
import java.util.Properties;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.DefaultComboBoxModel;
import listeners.ExamplesSessionBindingListener;
import com.sas.actionprovider.HttpActionProvider;
import com.sas.servlet.tbeans.models.JavaScriptNode;
import com.sas.servlet.util.BaseUtil;
import com.sas.storage.jdbc.JDBCConnection;
import com.sas.storage.jdbc.JDBCToComboBoxModelAdapter;
import com.sas.util.SasPasswordString;
import com.sas.web.keys.ComponentKeys;
public class JDBCDefaultExampleControllerServlet extends
javax.servlet.http.HttpServlet {
// Declare a default version ID since parent class implements
// java.io.Serializable
private static final long serialVersionUID = 1L;
// Global webapp Strings
private static final String ACTION_PROVIDER = "sas_actionProvider_JDBCDefaultExample";
// Global webapp JDBC variables
private static final String SAS_MODEL = "sas_model_JDBCDefaultExample";
private static final String COMBO_MODEL = "sas_combo";
private static final String JDBC_CONNECTION = "sas_JDBCConnection_JDBCDefaultExample";
private static final String JDBC_DRIVER_NAME = "com.sas.rio.MVADriver";
private static final String JDBC_DATABASE_URL = "jdbc:sasiom://servername:8591";
private static final Properties staticJDBCConnectionProperties = new Properties();
static { // Specify JDBC connection properties here
// Use: staticJDBCConnectionProperties.put("
|
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Following is an example of the ComboBoxView connecting to JDBC test data and displaying the results.

| Type: | Sample |
| Date Modified: | 2008-08-05 16:41:41 |
| Date Created: | 2006-02-14 14:51:23 |
| Product Family | Product | Host | Product Release | SAS Release | ||
| Starting | Ending | Starting | Ending | |||
| SAS System | SAS AppDev Studio | Microsoft Windows Server 2003 Standard Edition | 3.2 | 9.1 TS1M3 SP4 | ||
| Microsoft Windows Server 2003 Enterprise Edition | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Datacenter Edition | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows NT Workstation | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Professional | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Server | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Datacenter Server | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Advanced Server | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft® Windows® for x64 | 3.2 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows XP Professional | 3.2 | 9.1 TS1M3 SP4 | ||||
| Windows Vista | 3.2 | 9.1 TS1M3 SP4 | ||||




