Sunteți pe pagina 1din 112

WebsydianTM WebClient

Reference Manual v1.4r1

This documentation and related computer software program (hereinafter referred to as "Documentation") is for the end user's informational purposes only and is subject to change or withdrawal by ADC Austin, Inc. ("ADC") at any time. Documentation may not be copied, transferred, reproduced, disclosed, or duplicated, in whole or in part, without the prior written consent of ADC. Documentation is proprietary information of ADC and protected by the copyright laws of the United States and international treaties. Notwithstanding the foregoing, licensed users may print a reasonable number of copies of Documentation for their own internal use, provided that all ADC copyright notices and legends are affixed to each reproduced copy. Only authorized employees, consultants, or agents of the user who are bound by the confidentiality provisions of the license for the software are permitted to have access to such copies. To the extent permitted by applicable law, ADC provides Documentation "as is" without warranty of any kind, including without limitation, any implied warranties of merchantability, fitness for a particular purpose or noninfringement. In no event will ADC be liable to the end user or any third party for any loss or damage, direct or indirect, from the use of Documentation, including without limitation, lost profits, business interruption, goodwill, or lost data, even if ADC is advised of the possibility of such loss or damage. The use of any product referenced in Documentation and Documentation is governed by the end user's applicable license agreements. The manufacturer of Documentation is ADC Austin, Inc. 2008 ADC Austin, Inc. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.

WebClient v1.4r1

Table of Contents
Chapter 1: Introduction Overview Current Limitations Using the Live Installer Chapter 2: Installation and Configuration Step 1: Verify Requirements Step 2: Installation Step 3: Configuring Apache Tomcat in Eclipse Step 4: Plex Model Configuration Plex v5.5 Model Configuration Plex v6.0 Model Configuration Step 5: Eclipse Project Configuration Create a New Dynamic Web Project Step 6: Setup Eclipse Environment to Enable the Compile of CA Plex-generated JAVA (PlexBuild) PlexBuild for Plex v5.5 PlexBuild for Plex v6.0 Step 7: PlexBuild Configuration Chapter 3: Deploying WebClient with J2eeProxy Introduction to J2eeProxy Create a New Servlet Configure J2eeProxy.prop Installing Javascript Resources Calling WebClient Applications from an External Application Configuring Session Timeout in Apache Tomcat Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries Introduction to WebClient Relay Service Pack WAR Files for Relay Service Import and Configure Web WAR modules in the Web Tools Project Configure RelayService.prop Generate and Build WebClient Business Process (Only Applies for Websydian Express v2.0) Web Module Deployment on Tomcat Server Create WebClient Business Process WebClient Business Process for Websydian Express v2.0 Create WebClient Business Process for Websydian Express v2.1 Run Websydian Express with WebClient Application 7 7 7 7 8 8 10 12 14 15 15 16 20 23 23 29 34 36 36 36 40 42 44 46 47 47 47 50 55 56 57 60 60 63 66

Page 3

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java Introduction to the Websydian Express Proxy (WxpProxy) Import and Configure Web WAR modules Configure ob600usr.properties Configure J2eeProxy.prop Web Module Deployment on Tomcat Server Creating the WebClient Business Process Running the Web Application Chapter 6: Customizing WebClient Attach point Bean controls Control action Control context Control name property Control reference Control template Default attach points for controls Name identifier Output path Page template Physical event Property modifier Root template Source Template generation Chapter 7: Troubleshooting What do I do if I get ''[PLEX0040] Location definition for WXPCOURSE55 is not complete. Attempting local function call.'' What do I do if I get the following error on Eclipse: Project PlexBuild is missing required library: 'C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant.jar'. The project cannot be build until build path error are resolved". What do I do if I get "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket"? What do I do if I get "[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt"? What do I do if I get "Party: Error creating socket (java.net.ConnectException: Connection refused: connect)"? What if my WebPlexBuild plugin does not show up on Plugin details in Eclipse? What do I do if I get "javax.servlet.ServletException: m_bStreamHandlerSet" error? Appendix A: Template Commands

69 69 70 74 75 75 77 79 82 82 82 82 83 84 84 84 85 85 86 86 86 87 87 88 88 90 90 90

90 91 91 91 92 93

Page 4

WebClient v1.4r1

-- comment ALERTS Action ActionArg AttachPoint ButtonGroup ButtonValue CheckedValue DataType DecLength Edit EditNameID EditProperty Embed EnableAction Event FOCUS FindControl GridEnd If IgnoreActions ImplName Length NameID OptSelected OptText OutTo Owner Owner Panel Param Parent Property Render Site State This This This Title

93 93 93 93 93 94 94 94 94 95 95 95 95 95 96 97 98 98 98 98 99 99 99 99 100 100 100 100 100 101 101 101 101 101 101 102 102 102 102 102

Page 5

WebClient v1.4r1

Type UncheckedValue Visible WsRes getVar(String var) jsonColVis jsonCols jsonImplNames jsonOptions jsonRows jsonSelected jsonValues processAction(String actionName [, Object arg] ) setVar(String var, Object val) value Appendix B: JDBC Driver Configuration Configuring and Using SQL Server 2000 Creating an ODBC Connection for SQL Server 2000 Configuring the SQL Server 2000 JDBC Driver in Eclipse Configuring and Using SQL Server 2005 Creating an ODBC Connection for SQL Server 2005 Configuring the SQL Server 2005 JDBC Driver in Eclipse

102 103 103 103 103 103 104 104 104 104 104 104 105 105 105 106 106 106 107 110 110 111

Page 6

WebClient v1.4r1

Chapter 1: Introduction

Chapter 1: Introduction
Overview
WebClient is an extension to the CA Plex development environment. It allows CA Plex-developed Java GUI applications to be deployed as web applications with minimal modifications. In order to use WebClient to deploy an application, you must: Have an application that is configured for and operational as a Plex Java client/server application Have a Java EE-compliant web application server Build and deploy the application using the Eclipse development environment WebClient consists of two principal components: A template generator which runs during the generate and build process. For each Plex GUI panel, a file is generated which contains the HTML and Javascript code needed to display the panel as a web page. The generated templates can be customized to alter the look and feel, implement new controls, and provide additional functionality to the panels. A servlet that is loaded into the Java EE application server at runtime. The servlet loads the Plex-generated Java application's class files and allows them to communication to and from the web user using the generated templates.

Current Limitations
WebClient is currently not able to produce a web version of every Plex Java application. There are limitations related to the web environment. In order for WebClient to work, your application must: Only use panels of type Dialog and Child Panel. Not attempt to interact directly with the local filesystem or computer. Not use Java beans or ActiveX controls unless they have been adapted with a custom WebClient template. (See Bean controls for more information.)

Using the Live Installer


If you do not already have an Eclipse environment, you may want to use the WebClient Live Installer to get set up. The Live Installer will install Eclipse, an instance of the Jetty application server, an instance of the Derby embedded SQL database, and a sample model and workspace.

Page 7

WebClient v1.4r1

Chapter 2: Installation and Configuration

Chapter 2: Installation and Configuration


Step 1: Verify Requirements
Before starting to install WebClient, verify that your system meets the following requirements. Microsoft Windows XP Professional The minimum recommended requirements for Plex 5.5SP1 or Plex 6.0 as per CA. Servlet Engine A servlet engine is required to run WebClient. If you do not have one installed, we recommend installing the Apache Tomcat servlet engine. It can be downloaded at http://tomcat.apache.org. CA Plex A licensed copy of CA Plex 5.5 SP1 or higher is required to run WebClient. CA Plex model level requirement is Plex 5.5 SP1 ENH1 or higher.

All system requirements necessary to install CA Plex 5.5 SP1 are also required. Microsoft Visual Studio.NET is not required for WebClient. Be sure to apply the CA Plex latest patches (PTF) before you start WebClient for Plex. http://supportconnectw.ca.com/public/cool/plex/downloads/plex55sp1/plex55sp1-solpatch.asp Java Java JDK 1.5 or higher is required.

A JRE may also be used. However, be aware that the character set support file charsets.jar is not installed by default on a JRE. If this file is not present, you

Page 8

WebClient v1.4r1

Chapter 2: Installation and Configuration

will be unable to use Plex to connect to an AS/400.

Eclipse Web Tools Platform (WTP) Eclipse 3.2 or higher. Eclipse WTP All-In-One Packages can be downloaded from http://download.eclipse.org/webtools/downloads/ It will be a zip file without automatic installer. Extract Eclipse zip file to your root directory. For Eclipse Europa (version 3.3) or later, you need to copy org.apache.jakarta_log4j plugin to your eclipse/plugins folder. The plugin is included as part of the WebClient distribution. Database Engine A database engine is required to run WebClient. If you do not have one installed, we recommend installing SQL Server 2005. It can be downloaded from http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx. Websydian Express v2.0 or v2.1 for Windows (optional) Contact Websydian Support at support@websydian.com for information on how to obtain Websydian Express. Note If you do not already have Eclipse installed, you may elect to use the WebClient Live Installer. This will install Eclipse with WebClient already installed and configured.

Page 9

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 2: Installation
Web Client for Plex can be downloaded from http://connect.adcaustin.com/wwc/. You need to be a registered user to download the plugin. Web Client for Plex package include PlexBuild.zip contains eclipse project to build Plex functions WebsydianWebClient Deployment.zip contains WebsydianWebClient project folder, javascript and images folders WebsydianWebClient Sample60.zip contains wxpcourse CA Plex v6.0 sample model WebsydianWebClient Sample55.zip contains wxpcourse CA Plex v5.5 sample model WebsydianWebClient Development.zip contains the WebClientBuild plugin for Eclipse, WEBCLIENT group model WebsydianWebClient Doc.zip contains user guide, tutorial guide, installation guide, J2eeProxy.prop sample file, and RelayService.prop sample file. express20_win_update.zip contains a patch necessary to use with Websydian Express 2.0. If you have Websydian Express 2.1, you don't need this patch. If you want to use the WebClient Live Installer, you may also download it as well. WebClient LiveInstall.exe complete Eclipse installer with WebClient If you use the WebClient Live Installer, most of the configuration will be done for you, and you should skip ahead to Step 7: PlexBuild Configuration. Note If you are using Websydian Express 2.0, unpack the contents of express20_win_update.zip to your Websydian Express installation folder.

A plugin, called WebClientBuild, needs to be installed into Eclipse. If you have a previous version of WebClientBuild, delete it from your Eclipse plugins folder. Copy com.adcaustin.webclient.WebClientBuild to your Eclipse plugins folder. To confirm that you have the correct plugin, open Help About Eclipse SDK Click Plug-in Details button Sort by Plug-in ID.

Page 10

WebClient v1.4r1

Chapter 2: Installation and Configuration

Page 11

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 3: Configuring Apache Tomcat in Eclipse


Background In order for Eclipse to deploy the application to an application server, the application server needs to be set up in Eclipse. To verify if you need to set up an application server, go to Window Show View Servers.

If you already see the server that you want to use, then you can skip ahead to Step 4: Plex Model Configuration. If not, then proceed with the following instructions. Instructions These instructions will guide you through setting up an Apache Tomcat 5.5 server on Eclipse. Start the Eclipse WTP workbench. Open Window Preferences Server Installed Runtimes to create a Tomcat installed runtime. Click on Add to open the New Server Runtime dialog, and then select your runtime under Apache (Apache Tomcat v5.5 in this example).

Click Next and browse to your Apache Tomcat installation directory.

Page 12

WebClient v1.4r1

Chapter 2: Installation and Configuration

Note

Ensure the selected JRE is a full JDK and is of a version that will satisfy Apache Tomcat (this scenario was written using SUN JDK 1.6.0_02). If necessary, you can click on Installed JREs to add JDKs to Eclipse. Click Finish. Go to Window Show View Servers. Right-click the server window Select New Server. Select Apache Tomcat v5.5 Server Click Next.

Right-click on the server and click Start.

Page 13

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 4: Plex Model Configuration


Background In order for Plex Java functions to work with WebClient, each panel function must inherit from a WebClient base function. This function is called ~WebShell and it is located in the WebClient group model. This section explains how to set up CA Plex local model to work with the WebClient pattern libraries. This document applies to CA Plex version 5.5SP1 and 6.0.

Instructions

The actions described in this document must be performed the first time you use the WebClient patterns in CA Plex 5.5SP1 and 6.0 models. The first thing to do is to add WebClient group model to the host group model of your application. This action is performed once per group model in the same way as adding any other library models to a host model. The Web Client library may be added during creation of a group model together with the CA Plex Pattern libraries and other library models needed by the model, or they can be added to an existing CA Plex group model. Once WebClient library is added to the group model and a local model has been defined, the objects in Websydian Web Client library models must be extracted to the local model. All Plex functions with panel should inherit from WEBCLIENT/~WebShell before generation. The FNC is ~WebShell should be the first triple in the pattern inheritance. Webclient only support dialog window type for tabstrip/frameproperty. If the function has FNC is ACTIVE/TabStrip, the function should inherit from FNC is WEBCLIENT/~TabStrip directly. If the function has FNC is UISTYLE/FrameProperty, the function should inherit from FNC is WEBCLIENT/~FrameProperty directly. To display web messages in web page, a plex function should inherit from WebMessages in WebUI. For example: XXX is a FNC WebMessages WebMessages is a WEBCLIENT/~WebUI WebMessages impl name NME WebMessages In the inheritance path for a WebClient function, the root template(WebShell) must precede page templates(WebMessages) for WebMessages to work. The Plex function should have triple inheritance path in the following order. For example: XXX is a FNC WEBCLIENT/~WebShell XXX is a FNC WebMessages

Page 14

WebClient v1.4r1

Chapter 2: Installation and Configuration

Plex v5.5 Model Configuration

Plex v6.0 Model Configuration

Page 15

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 5: Eclipse Project Configuration


Background The Web Application will be represented in Eclipse by at least two projects. The projects are:

A Dynamic Web Application project, which represents the WAR file that is to be deployed to the application server. It contains the WebClient JAR files and static resources such as Javascript and CSS files. A Java EE Utility project, which contains the generated Plex Java source code, resource files, and generated web templates. Instructions We will first create a new Java EE Utility Project in Eclipse. Open File New Project. Select Java Project. Click Next >

A wizard will be displayed. The wizard is used to configure Java project. Any name is allowed but consider using a name that is self-explanatory. In this example, we use Plex60Project. For Project Layout, select Create separate source and output folders. Click Next >

Page 16

WebClient v1.4r1

Chapter 2: Installation and Configuration

Open Libraries tab. Click on Add External Jars to add ObRun.jar and pvAll.jar. ObRun.jar can usually be found in C:\Program Files\CA\AllFusion Plex r5.5\ObJava\Lib or C:\Program Files\CA\AllFusion Plex r6.0\ObJava\Lib. pvAll.jar can usually be found in C:\Program Files\CA\AllFusion Plex r5.5\CLASS550\PatternLibs\ACTIVE\Beans or C:\Program Files\CA\AllFusion Plex r6.0\class600\PatternLibs\ACTIVE\Beans. Click Finish.

Page 17

WebClient v1.4r1

Chapter 2: Installation and Configuration

Your Package Explorer should look like below.

Import obXXXclient.properties file into the Java Project. Right click on src folder Plex60Project project. Select Import File System Next > Go to ObJava directory under CA Plex folder and select ob550client.properties or ob600client.properties and click Finish.

Page 18

WebClient v1.4r1

Chapter 2: Installation and Configuration

Open obXXXclient.properties with Text Editor. The file is configured differently depending on what driver and data source you are using. It determines which database and port to connect to. The example below is using SUN JDBC driver.
Environment.Default.Driver=sun.jdbc.odbc.JdbcOdbcDriver Environment.Default.DataSource=jdbc:odbc:webclient Environment.Default.User=username Environment.Default.Password=password Environment.Default.Resources= Environment.Default.ImagePath=

The resources and imagepath above should be left blank. Save the changes before continuing.

Page 19

WebClient v1.4r1

Chapter 2: Installation and Configuration

Create a New Dynamic Web Project


A Dynamic Web Project contains JSP (Java Server Pages) files, HTML files, servlets, and Plex runtime JAR files. The web project is then deployed on Apache Tomcat to be viewed on a browser. Create a new dynamic web project (WAR file). Go to File New Project Expand Web folder Select Dynamic Web Project Click Next >

A wizard will be displayed. The wizard is mainly used to configure Dynamic Web Project. Any name is allowed but consider using a name that is self-explanatory. For this example, the project name is Plex60Web. A Target Runtime needs to be specified. This example is using Apache Tomcat. Click Finish.

Page 20

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Yes to open J2EE perspective. Right-click on the web project, select Properties. Click on J2EE Module Dependencies Click OK Check WebsydianWebClient and Plex60Project

Add Websydian Web Client jar files. Click Add JARs Select all jar files from WebsydianWebClient folder Click OK.

Page 21

WebClient v1.4r1

Chapter 2: Installation and Configuration

Add Plex Runtime and pvAll jar files. Click Add External JARs Browse to CA Plex ObJava\lib folder Add ObRun.jar. Click Add External JARs Browse to CA Plex class600\PatternLibs\ACTIVE\beans Add pvAll.jar. Click Apply Click OK. Your Project Explorer should look like below.

Page 22

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 6: Setup Eclipse Environment to Enable the Compile of CA Plex-generated JAVA (PlexBuild)
PlexBuild is an Eclipse project that contains an Apache Ant script to move Plex Java source code into Eclipse for compilation. Ant allows Eclipse to create and run Ant buildfiles from the Eclipse workbench. On the classpath tab of the Ant Runtime preference page, additional classes defining tasks and types can be added to the Ant classpath. Because the Java generation paths are different for Plex v5.5 vs Plex v6.0 and above, please consult the following sections depending on your Plex version.

PlexBuild for Plex v5.5


Import PlexBuild project to your Eclipse workspace. Go to File Import and select General Existing Projects into Workspace. Click Next >

Import wizard will be displayed. Select archive file and click the associated Browse to locate PlexBuild.zip in your WebClient downloaded files. Under Projects, select PlexBuild. Click Finish to start the import.

Page 23

WebClient v1.4r1

Chapter 2: Installation and Configuration

Your Package Explorer should look like below.

If you see the following message: Project PlexBuild is missing required library: C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant.jar. The project cannot be build until build path error are resolved please refer to Troubleshooting. To modify the Ant classpath globally, open Window Preferences. Expand ANT Select Runtime. Select Global Entries and click Add JARS... Expand PlexBuild Select the antlr.jar and PlexBuild.jar files. Click OK.

Page 24

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Yes to ignore possible problem.

Click Apply to save.

Create a new task that will move Plex source from Plex gen directory to Eclipse workspace. Select the Tasks tab and click Add Task... Enter movePlexSource

Page 25

WebClient v1.4r1

Chapter 2: Installation and Configuration

for the name and select PlexBuild.jar in the Location dropdown. Expand the tree view and Select MoveFilesAntTask.class, click OK.

Click Apply to save. Open the Properties tab and click Add Property... Enter "plex.workspace_loc" for the Name and "${workspace_loc}" for the Value Click OK.

Click Apply Click OK. To modify and create an ANT classpath for launch configuration, go to Run External Tools External Tools. In the External Tools window, click Ant Build and press the New button to create a configuration of a selected type. Name the new configuration PlexBuild. Set the Buildfile to ${workspace_loc:/PlexBuild/BuildConfig/build.xml} and Base Directory to ${workspace_loc:/PlexBuild/BuildConfig}.

Page 26

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Apply to save. Open the Refresh tab. Check on Refresh Resources upon Completion. The ANT task does not trigger the Eclipse workspace listeners so you have to force a refresh for Eclipse to see the new and changed files. Note If your workspace is small, refresh entire workspace is recommended. If it is a large workspace, you may want to limit it. Just be sure you have the resource you want refreshed selected, or you can manually refresh it.

Page 27

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Apply to save. Open the Build tab. Uncheck Build before launch.

Click Apply to save. Open Targets tab. Check movePlexSource and moveresources [default] as targets to execute.

Click Apply to save Click Run to run PlexBuild. You should see on your console that the functions are successfully built and moved to your project source folder.

Page 28

WebClient v1.4r1

Chapter 2: Installation and Configuration

PlexBuild for Plex v6.0


Import PlexBuild project to your Eclipse workspace. Go to File Import and select General Existing Projects into Workspace. Click Next >

Import wizard will be displayed. Select archive file and click the associated Browse to locate PlexBuild.zip in your WebClient downloaded files. Under Projects, select PlexBuild. Click Finish to start the import.

Page 29

WebClient v1.4r1

Chapter 2: Installation and Configuration

Your Package Explorer should look like below.

To modify Ant classpath globally, open Window Preferences. Expand ANT Select Runtime. Open the Properties tab and click Add Property... Enter "plex.workspace_loc" for the Name and "${workspace_loc}" for the Value Click OK.

Click Apply Click OK. To modify and create an ANT classpath for launch configuration, go to Run External Tools External Tools. In the External Tools window, click Ant Build and press the "New" button to create a configuration of a selected type.

Page 30

WebClient v1.4r1

Chapter 2: Installation and Configuration

Name the new configuration PlexBuild. Set the Buildfile to ${workspace_loc:/PlexBuild/BuildConfig/build.xml} and Base Directory to ${workspace_loc:/PlexBuild/BuildConfig}.

Click Apply to save Open the Refresh tab. Check on Refresh Resources upon Completion. Please note that if your workspace is small, refreshing the entire workspace is recommended. If it is a large workspace, you may want to limit it. Just be sure you have the resource you want refreshed selected, or you can manually refresh it. The ANT task does not trigger the Eclipse workspace listeners so you have to force a refresh for Eclipse to see the new and changed files.

Page 31

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Apply to save. Open the Build tab. Uncheck Build before launch.

Click Apply to save. Open Targets tab. Check movePlex60Source as targets to execute.

Page 32

WebClient v1.4r1

Chapter 2: Installation and Configuration

Click Apply to save Click Run to run PlexBuild. You should see on your console that the functions are successfully built and moved to your project source folder.

Page 33

WebClient v1.4r1

Chapter 2: Installation and Configuration

Step 7: PlexBuild Configuration


Background The PlexBuild project has a few settings which need to match your Plex Gen and Build settings. If you are configuring PlexBuild for the first time, or you have changed your gen and build directory, follow the instructions in this section.

Instructions

Under the PlexBuild project, locate the file build.properties. Modify build.properties according to the Java project and Plex gen directory information. Expand PlexBuild Expand BuildConfig Select the build.properties file. Right-click and choose Open With Text Editor. In the build.properties view, find the line plex.import.project_name=xxxx. Edit the line to read plex.import.project_name=Plex60Project. This should be the name of the Eclipse project that is to contain the generated Java sources; it is not the name of the project that contains the ANT scripts.

Find the line plex.gen.root=XXX. Edit the line to read plex.gen.root=(your gen directory). Note that forward slashes will be used, instead of backward slashes.

Page 34

WebClient v1.4r1

Chapter 2: Installation and Configuration

Save the properties file.

Page 35

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Chapter 3: Deploying WebClient with J2eeProxy


Introduction to J2eeProxy
Background J2eeProxy is a method of deploying the WebClient architecture. It consists of a servlet, called WebClientServlet, which launches your WebClient Plex application within a servlet container, and a configuration file, called J2eeProxy.prop, which contains settings for the servlet. In this mode, a single Plex function is the top-level component of your web application, known as the entry point. Consequentially, J2eeProxy is not suitable when you wish to launch a Plex function as a subfunction of a Websydian application, such as Websydian Express. If you are using Websydian Express, see chapters Deploying WebClient with Websydian Express for Windows/iSeries or Deploying WebClient with Websydian Express for Java. Instructions This chapter will guide you through the configuration of J2eeProxy to run a WebClient Plex application as the toplevel function of a web application.

Create a New Servlet


A servlet is used to connect the Plex runtime environment to the Java EE server. Right-click the Dynamic Web Project. Select New Servlet Check on Use Existing Servlet Class Click Browse button.

Page 36

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Choose WebClientServlet and click OK.

Click Finish to complete the process.

Import the J2eeProxy-sample.prop file from WebClient downloaded files (WebClient-Doc.zip). Expand Plex60Web WebContent. Right-click WEB-INF Select Import Select File System Next >

Browse to your Websydian installation folder and check J2eeProxy.prop file or WebClient download folder and look for J2eeProxy-sample.prop. Click

Page 37

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Finish. Note that the name of this file is case sensitive when deployed in the WAR file (under WEB-INF). The name should be renamed to J2eeProxy.prop.

Import WebsydianWebClient project to your Eclipse workspace. WebsydianWebClient creates WebClient Web-generated templates based on CA Plex panel properties and WebClient system templates files. Right-click Plex60Project folder Select Build Path Configure Build Path Open Projects tab. Click Add button Check Websydian Web Client Click OK.

Open Libraries tab. Click Add JARs... Expand WebsydianWebClient project and select WebClientCommon.jar Page 38

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Click OK.

Right-click Plex60Project Select Enable Websydian Web Client for Plex. WebGenTemplates folder will be automatically created under Plex60Project folder. The console should display "Generating Web templates" with no error message.

You should have WebGenTemplates folder created under Plex60Project.

Page 39

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Configure J2eeProxy.prop
In the file J2eeProxy.prop, located in the WEB-INF folder under WebContent of your Dynamic Web Project, change the properties parameters as follows. websydianserver.ipaddr: specifies the ipaddress for websydian server. For example: websydianserver.ipaddr=192.168.0.14 or computername websydianserver.tcpport: specifies the port for websydian server. For example: websydianserver.tcpport=11200 servlet.service: Name of the Application Service to use (Application Service Name). For example: servlet.service=Plex60Web servlet.log.level: The granularity of the log messages. Legal values are: TRACE, INFO, WARN, ERROR, FATAL.TRACE should only be used when debugging and in test environments. In a production environment use WARN or ERROR. For example: servlet.log.level: INFO servlet.log.file: specifies the path and the name of the log file. For example: servlet.log.file: C:/webclient.log webclient.entry: <package name>.<Plex function implementation name>. The entry point to the Web Application; i.e., the initial function to be called when a new session is created. Specify the full name of the class including package names. For example: webclient.entry=WXPCOURSEPNL.WXfF webclient.entry.timeout: The entry point that is called if a session has timed out on the server and the user attempts to resume the session. For example:WXPCOURSE55.sesstimeout webclient.entry.url.<path>: The entry point that is associated with a specific url. The url is determined by taking the components after the word "url", and changing dots to forward slashes (/). For example:webclient.entry.url.pub.item=com.foo.bar causes the relative url /pub/item to launch the function com.foo.bar. Wildcards are allowed and are specified with an asterisk(*). For example:webclient.entry.url.api.*=com.foo.api.* causes the relative url /api/myfunc to launch the function com.foo.api.myfunc. In both cases, the url specified is relative to the url-pattern in the servlet-mapping of the servlet in the web.xml file. The url-pattern must end with "/*" in order for this to work. For example, if the url-pattern is /webclient/*, then the url mappings above

Page 40

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

will be relative to /webclient (e.g., /webclient/pub/item and /webclient/api/myfunc) servlet.errorpage.url: specifies a relative URL to an error page within the context of the WAR file where the Relay Service is deployed. On errors the Relay Service will then call this error page which then is responsible of generating a response to the user. The error page have to be placed within the scope of the WAR-file where / (slash) indicates the root of the WAR-file. For example: servlet.errorpage.url: /Plex60Web/js/error.jsp resurl.com.adcaustin.webclient: URL reference for JavaScript resource and style sheet (CSS). For example: resurl.com.adcaustin.webclient=/Plex60Web Define.WSACTION: /<DynamicWebProject>/<ServletName>. URL reference for servlet. For example: Define.WSACTION=/Plex60Web/WebClientServlet servlet.statistics.level: Set this option to cause the servlet to gather some runtime statistics on called functions. The valid levels are as follows: 1 = Collect data on called functions grouped by function type and function name. The number of times each function is called as well as its inclusive run time. After each request, a report is logged to the servlet log at the INFO log level. For example: servlet.statistics.level=1 Save changes.

Page 41

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Installing Javascript Resources


Background Before you can run a WebClient application, certain static runtime resources must be set up to be deployed. WebClient at a minimum requires a version of the Dojo Javascript toolkit. This toolkit is provided in the file WebClientDojo.zip.

Create a folder for Javascript files. Right-click the WebContent folder of your web project Select New Folder Enter js for the new folder name. Import javascript files from WebClientDojo folder. Right-click js folder Select Import Select File System Browse to your directory that contains javascript folder Click Finish. Create a new folder for image files. Right-click WebContent folder Select New Folder Enter images for the new folder name. Import image files from deployment resource folder. Right-click images folder Select Import Select File System Browse to your directory that contains images folder Click Finish.

Create a new folder named css for css files. Your Package Explorer should look like below.

Page 42

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Start Websydian Express Server. Click the Windows Start menu and select All Programs Websydian Websydian Express v2.0 for Windows Start Websydian Express. Right-click Plex60Web Select Run As Run on Server. Choose an existing server Click Next > Make sure Plex60Web is on configured projects column Click Finish.

The URL format is http://localhost:8080/(webprojectname)/(servletname). The link is case-sensitive.

Page 43

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Calling WebClient Applications from an External Application


This section demonstrates how to pass a parameter to WebClient function. The following example is based on wxpcourse60 model calling the function WXwF, which prompts the user to insert an item record. The first step is to create a URL which calls the insert item function, without parameters. To accomplish this, open J2EEProxy.prop file and add the following property. webclient.entry.url.InsertItem=WXPCOURSE60.WXwF Now, the servlet will respond to the URL /WebClientServlet/InsertItem by calling the function WXPCOURSE60.WXwF as the WebClient entry point. However, it does not yet allow parameters to be passed. To pass parameters in, a custom servlet needs to be created. Open J2EE perspective. Right-click on web project Select New Select Servlet. Enter deeplink as the Java package and Class name. For the servlet mapping, specify InsertItem. Click Finish.

Page 44

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

In the WebClient documentation folder, there exists a sample custom servlet, called deeplink.java, which will help you create a servlet that sends parameters to a Plex function. Copy and paste the code from deeplink.java to the newly created servlet. Change the package name to deeplink.

Change the class name to deeplink.

The parameters are passed to WebClient using an XML format. Locate the variable plexXML in the source code; this contains the XML data that is sent. Modify the input variable name and field name to match those expected by the WXwF function.
final String plexXML = "<PlexFunction xmlns=\"http://adcaustin.com/ws-plex/1.0\"> <InputVariables Name=\"Input\"><Field Name=\"ItemID\">"+ encodeToXML(myVariable) + "</Field></InputVariables> </PlexFunction>";

Modify webclient URL from final String webclientURL = "/webclient/test"; to final String webclientURL = "/WebClientServlet/InsertItem";

Page 45

WebClient v1.4r1

Chapter 3: Deploying WebClient with J2eeProxy

Now the InsertItem servlet will forward its requests to the WebClient servlet. Save changes. The last change that needs to be made is the servlet mapping. It needs to have the characters /* at the end to match against any parameter that is passed in the URL. Open web.xml and change deeplink servlet mapping to <url-pattern>/InsertItem/*</url-pattern> Save changes. Build the web project and publish to the server. To call the function, open a web browser and enter the following URL. http://localhost:8080/Plex60Web/InsertItem/001 URL format: http://<host>/<Context Root>/<Servlet Mapping>/<parameter>

Configuring Session Timeout in Apache Tomcat


The session timeout is the maximum length of time that Tomcat will retain the information pertaining to a user's session, in the absence of any user activity. This value is configurable per application as follows: Open web.xml. Add the following XML element:
<listener> <listener-class> com.adcaustin.webclient.servletproxy.WebSessionListener </listener-class> </listener> <session-config> <session-timeout>30</session-timeout> </session-config>

The code above will set the session to time out in 30 minutes. Save changes. Open J2eeProxy.prop and find webclient.entry.timeout. Specify the name of the function that you want to display when the session is timed out. Save changes.

Page 46

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries


Introduction to WebClient Relay Service
Background The Relay Service for WebClient is a method of deploying the WebClient architecture with Websydian Express, when Websydian Express is running as an application service on either the Windows or iSeries platform. In this mode, a servlet, called WebClientRelayService resides on a Java servlet container, and a property file, called RelayService.prop. The servlet communicates with the Websydian Express application service, and also hosts a WebClient runtime environment for Plex functions that are deployed to the Java server.

Note

The RelayService is not suitable for deploying with Websydian Express where Websydian Express runs on a Java application server directly. For this mode, see Deploying WebClient with Websydian Express for Java.

Instructions

These instructions will guide you setting up WebClient for Relay Service

Pack WAR Files for Relay Service


WAR file is a packaged web application that can be used to import Web application into a web server. Relay service WAR file should be created when Websydian Express is installed. The WAR file (express20.war) can be found in \Websydian\Express v2.0 for Windows\Web Server Component. Skip step 1 10 if you have the war file. Open Websydian Websydian Express v2.0 for Windows Web Server Component Pack Servlet Relay Service. Click Next > to continue. Accept the terms of the license agreement and click Next > Choose destination location.

Page 47

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Enter basic relay service servlet information and click Next >

Enter Websydian Server information and click Next >

Page 48

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Enter relay service information and click Next >

Click Install. Click No to not deploy the Relay Service on Tomcat.

Click OK to finish packaging.

Copy webservercomponent.prop and rename it to RelayService.prop in \Websydian\Express v2.0 for Windows\Web Server Component. Please verify that RelayService.prop is in the right case as Apache Tomcat is case sensitive.

Page 49

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Import and Configure Web WAR modules in the Web Tools Project
From the J2EE Perspective, go to Open Window Open Perspective Other Select J2EE or Java EE and click OK.

Right-click on the Project Explorer window. Select Import WAR File. Browse to the location where your WAR file is located (Websydian Express installation folder). Keep your default project name and choose Apache Tomcat as target runtime. Then click Next >

Click Finish. Your Project Explorer should look like below.

Page 50

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Open WebContent/WEB-INF/web.xml with text editor Change "com.websydian.pka.servlet.RelayService" to "com.adcaustin.webclient.relayservice.WebClientRelayService" between <servlet-class></servlet-class>

Delete "C:/Program Files/Websydian/Express v2.0 for Windows/Web Server Component/webservercomponent.prop" between <param-value></param-value>. Save changes.

Right-click on WEB-INF under WebContent and select Import. Import File System and click Next >

Page 51

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Select RelayService.prop in\Websydian\Express v2.0 for Windows\Web Server Component and click Finish.

Add web library dependency. Add WebsydianWebClient and Plex60Project projects to the web project J2EE Module Dependencies to associate Java projects to the web library project. Right-click express20 project. Select Build Path Configure Build Path Open J2EE Module Dependencies Check WebsydianWebClient and Plex60Project.

Page 52

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Add WebsydianWebClient jar files. Click Add JARs Expand WebsydianWebClient Select all jars Click OK.

Add ObRun.jar and pvAll.jar. Click Add External JARs Browse to CA Plex ObJava\lib folder Add ObRun.jar. Click Add External JARs Browse to CA Plex class600\PatternLibs\ACTIVE\beans or class550\PatternLibs\ACTIVE\beans Add pvAll.jar.

Page 53

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Click Apply Click OK. Your Project Explorer should look like below.

Page 54

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Configure RelayService.prop
Open RelayService.prop and add the parameter below at the end of the file.

servlet.webclient.signatureencoding=ISO-8859-1

Save changes.

Page 55

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Generate and Build WebClient Business Process (Only Applies for Websydian Express v2.0)
Skip this step if you have Websydian Express v2.1 Open the WebPlexWin.mdl model. Go to Tools Generate and Build Build Generate and Build Options System Definitions Select System Name Click Properties. In 32-bit C++ Build Check Use pre-built libraries. For example: Libraries: C:\ProgramFiles\Websydian\Websydianv6.0\Development\Express\Win\websyd.lib; C:\ProgramFiles\Websydian\Websydianv6.0\Development\Express\Win\wsexpress.lib; C:\Program Files\CA\AllFusion Plex r5.5\CLASS550\PatternLibs\obpt32.lib Header Directories: C:\Program Files\Websydian\Websydian v6.0\Development\include Generate and build WebPlexProcessEntryPoint function. Copy WPWebPlx.dll, WPWebPlx.pnl, WCSNDHDR.dll and from release folder to C:\ProgramFiles\Websydian\Express v2.0 forWindows\Application Service\WebsydianExpress. Copy the file EXPRESS.INI then rename it to WSEXPRSS.INI in C:\Program Files\Websydian\Express v2.0 for Windows\Application Service. Open settings.cmd Change the line "set APP_NAME" to: set APP_NAME=WSEXPRSS. Run the script file "_SQLScripts\WSPRPVP_Table.sql" against database named WebsydianExpress20 in SQL Server Management Studio or Enterprise Manager.

Page 56

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Web Module Deployment on Tomcat Server


Go to Window Show View Select Server. Right-click in the Server window Select New Server.

Select Tomcat v5.5 server Click Next > Add express20 project to configured projects column Click Finish.

Page 57

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Start Tomcat server. Right-click the Tomcat server Select Start. Start Websydian Express server. Click the Windows Start menu and select All Programs Websydian Websydian Express v2.0 for Windows Start Websydian Express. Right-click on express20 project and select Run As Run on Server. Select Tomcat server and click Next >

Add the project from available projects column to configured projects column and click Finish.

Page 58

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Go to http://localhost:8080/express20/site/basicsite/admin Login information.

Username: WSADMIN Password: ADMIN

Page 59

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Create WebClient Business Process


A business process is the term for a function that is called by Websydian Express in response to user input. In order to call a WebClient function, a special business process must be generated and built that interfaces Websydian Express to WebClient. The business process that is used depends on your Websydian Express version (2.0 or 2.1). The next two sections cover each setup in detail.

WebClient Business Process for Websydian Express v2.0


Expand Site Configuration. In the site settings change the "Library for created events" to the WebsydianExpress folder. For example: C:\Program Files\Websydian\Express20win\Application Service\WebsydianExpress

Create a new business process. Expand Content loader Click Business Processes. Click +Insert. Enter the following business process information. Name: webclient Program name: WPWebPlx Description: webclient Check Create Default Presentation

Page 60

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Find the business process created above Select Presentations. Click +Insert to create a new presentation for the business process. You can enter any value for the Name (just remember it for later use) but keep the Template suffix and Template override name empty. Click Properties for the newly created presentation and define the following properties for the presentation: WCENTRY: <Package Name>.<Plex Function Implementation Name>. It contains the class name for the Plex functions that should be executed by the web client runtime. For example: Property Name: WCENTRY. Value: WXPCourse2.WXuF WCURL: /<endpath>. The endpath of the URL. Any name is allowed. This is used by the web client servlet so it knows that it should execute the above Plex function instead of redirecting control to the application service. For example: Property Name: WCURL. Value: /webclient. Click Done.

Expand Site structure menu Click Site Structure. Expand Main Frameset Click Menu Menu Loader Click +Add. Select Create new site element Click Next => Select webclient. Enter the following basic business process information. Menu item text: java Alignment: Left Sequence: 10

Page 61

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Display in frame: Main

Click Next => Add Administrator to the assigned roles column Click Finish. Expand Templates Select Folders Click +Insert to create a new folder. Enter the following information for the new folder and click +Insert.

Click Folder Lists Click Update for Admin folder list Click Next => Click +Add to add com.adcaustin.webclient folder to the folder list Click Select com.adcaustin.webclient folder.

Click Finish. Create a new folder named com.adcaustin.webclient in C:\Program Files\Websydian\Express v2.0 for Windows\Application Service\html. Create a new file named webclient.HTM in the new folder. This new file should be named according to the value of <endpath> in WCURL property. Expand Welcome Click Logout- > Click Logout again. Page 62

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Create WebClient Business Process for Websydian Express v2.1


Expand Content loader Click Business Processes. Find Run WebClient Application business process. Select Presentation.

Create a new presentation by entering a presentation name. Click +Insert.

Click on Properties button for the new presentation.

Page 63

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Add properties information. WCENTRY: <Package Name>.<Plex Function Implementation Name>. It contains the class name for the Plex functions that should be executed by the web client runtime. For example: Property Name: WCENTRY. Value: WXPCOURSE60.WXs4F WCURL: /<endpath>. The endpath of the URL. This is used by the web client servlet so it knows that it should execute the above Plex function instead of redirecting control to the application service. For example: Property Name: WCURL. Value: /webclient. Click Done.

Expand Site structure menu Click Site Structure. Expand Main Frameset Select Menu Menu Loader Click +Add. Select "Create new site element" Click Next => Select the new presentation.

Enter the following basic business process information. Menu item text: java Alignment: Left Sequence: 10 Display in frame: Main

Page 64

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Click Next => Add Administrator to the assigned roles column Click Finish. Expand Templates Select Folders Click +Insert to create a new folder. Enter the following information for the new folder and click +Insert.

Click Folder Lists Click Update for Admin folder list Click Next => Click +Add to add com.adcaustin.webclient folder to the folder list Click Select com.adcaustin.webclient folder.

Click Finish. Expand Welcome Click Logout- > Click Logout again. Create a new folder named com.adcaustin.webclient in C:\Program Files\Websydian\Express v2.1 for Windows for Plex 5.5\Application Service\html or C:\Program Files\Websydian\Express v2.1 for Windows for Plex 6.0\Application Service\html Create a new file named webclient.HTM in the new folder. This new file should be named according to the value of <endpath> in WCURL property. Expand Welcome Click Logout- > Click Logout again.

Page 65

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Run Websydian Express with WebClient Application


Create a new folder for Javascript files. Expand express20 Right-click WebContent folder Select New Folder Enter js for the new folder name. Right-click js folder Select Import Select File System Browse to your directory that contains WebClientDojo folder Click Finish.

Create a new folder for image files. Right-click WebContent folder Select New Folder Enter images for the new folder name. Right-click images folder Select Import Select File System Browse to your directory that contains images folder Click Finish.

Page 66

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

Create a new folder named css for css files. Open a web browser. Type the following url http://localhost:8080/express20/site/basicsite Login information: User: WSADMIN Password: ADMIN Your browser should look like below.

Click java. The web client application should now be launched in the main frame.

Page 67

WebClient v1.4r1Chapter 4: Deploying WebClient with Websydian Express for Windows/iSeries

If your images file does not show on the browser, restart Apache Tomcat server.

Page 68

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Chapter 5: Deploying WebClient with Websydian Express for Java


Introduction to the Websydian Express Proxy (WxpProxy)
Background The Websydian Express Proxy for Java (Wxp4J) is an implementation of Websydian Express where all business logic, including Websydian Express system functions, business processes, and WebClient functions, run inside of a Java EE-compliant servlet container. In this mode, all Plex functions are generated for the Java platform, and deployed to a web application archive (WAR) file.

Instructions

The following instructions will guide you through the configuration and deployment of WxpProxy for a WebClient application.

Import the WebsydianWebClient project to your Eclipse workspace. Go to File Import and select General Existing Projects into Workspace. Click Next >. Import wizard will be displayed. Select archive file and click the associated Browse... to locate WebsydianWebClient.zip in your WebClient downloaded files. Under Projects, select WebsydianWebClient. Click Finish to start the import. Right-click your Plex Java Project Select Build Path Configure Build Path Open projects tab. Click Add... button Check WebsydianWebClient Click OK.

Open Libraries tab. Click Add JARs.... Expand WebsydianWebClient and select WebClientCommon. Click OK.

Page 69

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Right-click on your Plex Java Project Select Enable Websydian Web Client for Plex. WebGenTemplates folder will be automatically created under your project folder. Refresh your project if it does not show WebGenTemplates folder. The console should display "Generating Web templates" with no error message.

You should have WebGenTemplates folder created under your project.

Import and Configure Web WAR modules


Open J2EE Perspective. Go to Open Window Open Perspective Other... Select J2EE or Java EE and click OK

Page 70

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Right-click on the Project Explorer window. Select Import WAR File. Browse to the location where your WAR file is located (Websydian Express Installation folder). Keep your default project name and choose Apache Tomcat as target runtime. Then click Next >

Click Finish. Your Project Explorer should look like below.

Page 71

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Open WebContent/WEB-INF/web.xml with Text Editor Change "com.websydian.pka.servlet.J2eeProxy" to "com.adcaustin.webclient.servlet.WxpProxy" between <servlet-class></servlet-class>

Delete all jar files under WebContent/WEB-INF/lib folder.

Right-click express21java project. Select Build Path Configure Build Path Open J2EE Module Dependencies Check WebsydianWebClient and your Plex Java Project.

Page 72

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Add WebsydianWebClient jar files. Click Add JARs... Expand WebsydianWebClient. Add asm.jar, asm-analysis.jar, asm-commons.jar, asm-tree.jar, asm-util.jar, commons-httpclient.jar, WebClientCommon.jar and WxpServletProxy.jar. Click OK. Add express21java jar files. Click Add External JARs... Browse to Websydian\Express v2.1 for Java\webcontainer\WEB-INF\lib folder Add all jar files. Add pvall.jar file. Click Add External JARs... Browse to CA Plex class600\PatternLibs\ACTIVE\beans Add pvAll.jar.

Page 73

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Click Apply Click OK. Your Project Explorer should look like below.

Configure ob600usr.properties
Expand express21java project Expand Java Resources: src folder Open ob600usr.properties file with Text Editor. The file is configured differently depending on what driver and data source you are using. The example below is using JTDS JDBC Driver.

# Current connection information #-------------------------------------------------------------------------------------Environment.Default.Driver=net.sourceforge.jtds.jdbc.Driver Environment.Default.DataSource=jdbc:jtds:sqlserver://localhost:1433/WebsydianExpressFor Environment.Default.User=sa Environment.Default.Password=sa

# Current database connection configuration #-------------------------------------------------------------------------------------Environment.Default.DBCon.WebsydianExpress.Driver=net.sourceforge.jtds.jdbc.Driver Environment.Default.DBCon.WebsydianExpress.DataSource=jdbc:jtds:sqlserver://localhost:1 Environment.Default.DBCon.WebsydianExpress.User=sa Environment.Default.DBCon.WebsydianExpress.Password=sa

Save changes. Page 74

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Configure J2eeProxy.prop
Expand express21java project Expand WebContent folder Expand WEB-INF folder Open J2eeProxy.prop and add the parameter below at the end of the file.

websydianserver.log.level=TRACE websydianserver.log.file=C:/Program Files/Websydian/Express v2.1 for Java/logs/websydia websydianserver.licensefilepath=C:/Program Files/Websydian/Express v2.1 for Java/licens servlet.log.level=ERROR servlet.log.file=C:/Program Files/Websydian/Express v2.1 for Java/logs/J2eeProxy.log servlet.plex.eventdispatchername=com.websydian.express.client.WSDispaJ servlet.service=J2EEPROXY servlet.websydianserver.wrap=TRUE websydianserver.ipaddr=localhost websydianserver.tcpport=0 servlet.plex.propertyfilename= servlet.plex.session.timeout=-1 servlet.plex.function.init=com.websydian.express.client.WSSVLINI servlet.plex.function.destroy=com.websydian.express.client.WSSVLDST servlet.plex.propertyfilename=this_value_is_not_used servlet.plex.session.timeout=-1 servlet.plex.function.init=com.websydian.express.client.WSSVLINI servlet.plex.function.destroy=com.websydian.express.client.WSSVLDST # Define standard runtime for Websydian Express for Java servlet.plex.runtime.express.appclass=ObRun.ObFunction.ObUserApp servlet.plex.runtime.express.propertyfilename= servlet.plex.runtime.express.allocation=PerServlet, 500, unlimited servlet.plex.runtime.express.environmentname= servlet.plex.runtime.express.packages=com.websydian.express # User-defined runtime servlet.plex.runtime.user.appclass=com.adcaustin.webclient.WxpWebClientApp servlet.plex.runtime.user.propertyfilename= servlet.plex.runtime.user.allocation=PerFrame, 1, 1 servlet.plex.runtime.user.environmentname= servlet.plex.runtime.user.packages=* # The search order to use when mapping a function to a runtime servlet.plex.runtime.order=express, user

Save changes.

Web Module Deployment on Tomcat Server


Go to Window Show View Select Server. Right-click in the Server window Select New Server.

Page 75

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Select Tomcat v6.0 server Click Next > Add express21java project to configured projects column Click Finish.

Start Tomcat server. Right-click the tomcat server Select Start. Right-click on express21java project and select Run As Run on Server. Select Tomcat server and click Next >

Page 76

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Click Finish. Go to http://localhost:8080/express21java/site/basicsite/admin Log in to the admin site to setup the basicsite. Login information.

Username: WSADMIN Password: ADMIN

Creating the WebClient Business Process


In the Websydian Express admin site, Expand Global Settings Click on Java Packages. Click +Insert Add WXPCOURSE60 package name.

Create a new business process. Expand Content loader Click Business Processes. Click +Insert. Enter the following business process information. Page 77

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Name: Employee Program name: WXs4F Description: Employee Check Create Default Presentation.

Expand Site structure menu Click Site Structure. Expand Main Frameset Click Menu - Menu Loader Click +Add. Select "Create new site element" Click Next => Select Employee. Enter the following basic business process information. Menu item text: Employee Alignment: Left Sequence: 10 Display in frame: Main

Click Next => Add Administrator to the assigned roles column Click Finish. Expand Templates Select Folders Click +Insert to create a new folder. Enter the following information for the new folder and click +Insert. Description: com.adcaustin.webclient Template path relative to root: com.adcaustin.webclient URL reference for resources: /express21java

Page 78

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Click Folder Lists Click Update for Admin folder list Click Next => Click +Add to add com.adcaustin.webclient folder to the folder list Click Select com.adcaustin.webclient folder.

Click +Finish. Create a new folder named com.adcaustin.webclient in C:\Program Files\Websydian\Express v2.1 for Java\html. Expand Welcome Click Logout- > Click Logout.

Running the Web Application


Create a new folder for Javascript resources. Expand express21java Right-click WebContent folder Select New Folder Enter js for the new folder name. Import the Javascript files from WebClientDojo folder. Right-click Select Import Select File System Browse to your directory that contains javascript folder Click Finish.

Page 79

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Create a new folder for images. Right-click WebContent folder Select New Folder Enter images for the new folder name. Import image files from deployment resource folder. Select Import Select File System Browse to your directory that contains images folder Click Finish.

Create a new folder named CSS for CSS files.

Page 80

WebClient v1.4r1

Chapter 5: Deploying WebClient with Websydian Express for Java

Your Project Explorer should look like below.

Go to http://localhost:8080/express21java/site/basicsite. Login information.

User: WSADMIN Password: ADMIN

Your browser should look like below.

Click on Employee link. The web client application should now be launched in the main frame.

If your images file does not show on the browser, restart Apache Tomcat server.

Page 81

WebClient v1.4r1

Chapter 6: Customizing WebClient

Chapter 6: Customizing WebClient


Attach point
A template for a given screen can be generated from more than one template by using attach points. The templates are arranged in order from root to leaf. An attach point is a location defined in a template that other templates further towards the leaf can populate with data. See Template generation. Attach points can be defined in the root template or a page template using the /(!AttachPoint) command. When an attach point is defined, it is initally empty (it will not expand to anything), until it is populated by templates further down the inheritance path, or by controls via their control name property. See Also /(!AttachPoint)

Bean controls
Some controls are implemented in Plex as a Java Bean control. Although Java Beans cannot be loaded in WebClient, their functionality can be emulated through the use of a custom template and customized source code objects in Plex. The name property of the bean control is the default name of template that is used (without the .ctrl extension.) In the source code objects, variables in the control may be created using names which you define. The methods that do this are called setVar and getVar and they are located in the class WebBeanData. The source code objects may also call the method processAction to send a control action to the template. In the bean control's template, the variables may be retrieved using the /(!Var) control command. If the bean control sends a value to the server as a request parameter, the data in the parameter is taken to be a JSON object, and bean's variables are updated with the keys and values of that object. Example See DojoTab.ctrl in the distribution for an example of a tab control implemented in Javascript.

Control action
If the value of a control changes, the rendering on the web browser needs to be updated. WebClient supports this two different ways. In the first method, page refresh, when the value of a control changes, the web browser is instructed to reload the page from the server. This will cause the template to be re-evaluated and the user will see the new data. This is the default method that is used to update the display. In order to avoid page reloads, a second method is supported. In this method, called action updates, the page is not reloaded. Instead, the server sends back commands corresponding to only the changes that have occurred. These are called actions. An Page 82

WebClient v1.4r1

Chapter 6: Customizing WebClient

action has a name and an optional argument. Each action is expanded into a block of Javascript code that is then used to incrementally update the screen. In order to use action updates with a control, the desired actions must be enabled for that control. This is accomplished by using the /(!EnableAction) template command within the control template for that control. The names of the actions that are going to be handled by the template are specified as parameters to that command. Then the /(!Action) command can be used to specifiy that commands that should be expanded when that action occurs. Ordinarily, the /(!Action) command is placed within an attach point that is within a Javascript output path. The following actions are defined: SetValue sent when the value of a field has been changed. SetState sent when the state of the control has been changed. SetFocus sent when the control is to be given focus. Refresh sent to a panel or site control when the panel needs to be refreshed. The argument is the panel control. Alert sent when a Dialog Message or Status Message has been sent to the panel. Enquiry sent when an Enquiry Message has been sent to the panel. Load sent to a site control when the child panel has been loaded. The argument is the panel control. Hide sent to a site control when the child panel has been hidden. Show sent to a site control when the child panel has been shown. Grid.Insert sent to a grid when a row has been inserted. The argument is the row. Grid.Clear sent to a grid when the grid has been cleared. Grid.Remove sent to a grid when a row has been removed. The argument is the row. Grid.Update sent to a grid when a row has been updated. The argument is the row.

Page 83

WebClient v1.4r1

Chapter 6: Customizing WebClient

Control context
When the template generator is in a control context, it is expanding a template for a specific control. This means it is possible to use control commands to access that control. The template generator is automatically in a control context when it is expanding a control template. It is also in a control context when expanding the /(FOCUS) command.

Control name property


The control name property is a panel property that can be set in Plex for each control. Although it is not required to be set, it is strongly recommended that the control name be set for each control that is to be used under WebClient. The control name property can take two syntaxes. The first syntax is simply a unique name given to the control. This name appears in the generated HTML and Javascript and aids in debugging. In the second syntax, the unique name is followed by a colon, then an attach point name, then optionally another colon and template parameters. In this case, the control is given a name and also a location in the template where it is to appear. The control will be placed in the named attach point, which must be defined in the current panel's root template or page template. Any additional parameters following the attach point are passed to the control's template. Example If you have defined an attach point named ButtonsArea, and you want to place a button in it, you might assign the button the control name ExitButton:ButtonsArea.

Control reference
Certain template commands are not intended to expand to text, but rather are used to refer to a control to which another command is addressed. The next parameter of the command is taken to be the next command to be applied. Any control with a control name can be used as a control reference, by giving the control name as a command. In addition, there are special template commands which are useful as control references. Example If you have a control named Grid1 and wish to access its size, you can may write /(!Grid1:Size). Here, Grid1 is functioning as a control reference command. If you have a column heading control and need the NameID of the corresponding edit control, you can write /(!Edit:!NameID). /(!Edit) is a control reference command.

Control template
A control template is used to produce HTML and Javascript for a control that is on a Plex panel. A control template is expanded and placed in the attach point that is associated with the control via the control name property. The default control template that is used is in a file that is named by taking the type for of the control and prefixing it by Web. The extension that is used is .ctrl. For example, the default control template used for edit fields is WebEdit.ctrl. These control files are normally located in the SysTemplates folder.

Page 84

WebClient v1.4r1

Chapter 6: Customizing WebClient

To override and specify a specific control template that is to be used for a control, specify the template= parameter in the control name property for that control. The value of this parameter will be suffixed with the extension .ctrl and used instead of the default control template. Example If you have a custom template called ToggleButton.ctrl and wish to use this template for a check box control, you may set the control name parameter template=ToggleButton.

Default attach points for controls


If the control name property for a control does not specify an attach point for the control, a default attach point is selected based on the type of the control. The attach point is selected as follows: Column heading ColumnsArea Grid edit control CellsArea Menu bar MenuBarArea Menu MenuArea Menu item or separator MenuItemArea Toolbar ToolbarArea Toolbar Button ToolArea All other controls MainArea In addition, the parameter default is passed to the template when the default attach point is selected. Example If an edit field control is given a control name property of MyControl, the default attach point of MainArea applies and the parameter default is also passed to the template. In other words, it is as if the edit field control had a control name property of MyControl:MainArea:default.

Name identifier
If a Plex panel contains child panels, the control name of a control, as given by /(!Name), may not uniquely identify a control in the web browser. This is because even though the control is unique within a page, it still may appear in multiple child panels and create duplicates.

Page 85

WebClient v1.4r1

Chapter 6: Customizing WebClient

To resolve this issue, use the /(!NameID) command to generate a unique name identifier. This name will be prefixed by both the site's control name and the child panel's name. This name is suitable for use an identifier in the web browser's DOM.

Output path
WebClient can send a response back to the client of several different types. The output path is a parameter that determines what type of response is sent. In addition, some response formats can include hierarchical data. The output path can be used to index into that data. The main output paths supported are: html the response mime-type is text/html. The contents are escaped according to HTML rules. json the response mime-type is application/json. The contents are encoded as a valid JSON expression. For the json output type, a hierarchical naming scheme is possible. After the json component, which must be the top-level component in the path, a dot-separated path may be placed. The components of this path are created as JSON sub-objects in the JSON path. Example Suppose a response is created with the command /(!OutTo:json.x.y.z)abc/(!OutTo). If this response is returned to a web browser and loaded as a JSON expression and assigned to the variable t, then t.x.y.z == "abc".

Page template
A page template is an optional template that is expanded during the template generation process. A page template can place data into attach points that are defined by either the root template or another page template. See Also: Template generation

Physical event
The Plex physical events which may be handled in WebClient are: Pressed Load Grid Double Click Select Mouse Down Mouse Move Mouse Up

Page 86

WebClient v1.4r1

Chapter 6: Customizing WebClient

Gained Focus Lost Focus Changed Updated Select Menu Query Close Modified See Also /(!Event)

Property modifier
A property modifier is an optional parameter which may be placed after the property name parameter in a /(!Property) command. The following property modifiers are available: x for a property value which is a coordinate in the format x y, expands to x. y for a property value which is a coordinate in the format x y, expands to y. hexcolor for a property value which is a color in the format r g b, expands to the color in HTML #rrggbb notation. htmlaccel for a property value which uses the & character to indicate that the next character is to be underlined, converts this notation to HTML using the <u> tag. htmlbr for a property value which uses the ^ character to indicate a line break, converts this notation to HTML using the <br> tag. nbspifempty if the property value is blank or consists only of spaces, expands to &nbsp; instead. Otherwise, leaves the value as is. html marks that the value is to be treated as HTML source. js marks that the value is to be treated as JavaScript source.

Root template

Page 87

WebClient v1.4r1

Chapter 6: Customizing WebClient

The root template is first template that is expanded during the template generation process. The default root template is called WebShell-root.wcli. It expands to the basic HTML and Javascript templates where all other template data is placed, via page templates and control templates. See Also: Template generation

Source
Text that is expanded into the template can be of two types, source or data. By default, any text that is placed into a template at run-time is considered data. When text is considered data, it cannot contain markup commands such as HTML tags or Javascript expressions. If the data contains any special characters that would have meaning to the HTML or Javascript parser, such as angle brackets, ampersands, or quote markers, they will be automatically escaped appropriately for those parsers. Specifically, if text is handled as data, and the output path is set to an HTML fragment, the characters less-than, greater-than, and ampersand are escaped with entity references. For example, <foo> is encoded as &lt;foo&gt; If text is handled as data, and the output path is a Javascript fragment, the text is encoded as a valid Javascript string literal constant. This includes all quotation marks automatically. For example, abc"def is encoded as "abc\"def". If you have some text that is to be expanded at run-time and interpreted as an actual HTML tag or Javascript expression, with escaping, you must inform WebClient to handle it as source. This can be accomplished with a property modifier parameter on the property command.

Template generation
When generating a template for a panel, WebClient first attempts to locate a root template. The root template is a template available in the classpath such that the following two conditions are met: The name of the file consists of the implementation name of a function followed by -root.wcli. That function is in the inheritance path of the panel function being generated. When there are two or more such functions in the inheritance path, the lowest (closest to the generated function) one takes precedence. If no root templates are available, template generation aborts with an error. WebClient loads the root template, then it searches for page templates which may occur in the inheritance path between the generated function and the root template function. The following must be true for a valid page template: The name of the template file consists of the implementation name of a function followed by -page.wcli. That function is in the inheritance path of the panel function being generated, and is lower than the root template that is in use. The page templates are applied in order starting from the page template closest to the root template, and ending with the template closest to the panel function. Page templates are optional.

Page 88

WebClient v1.4r1

Chapter 6: Customizing WebClient

Finally, WebClient automatically generates a template for the panel function itself. This file does not need to be supplied by the user and is named by taking the implementation name of the panel function and appending -panelgen.wcli. This file is obtained by automatically expanding all of the control templates in the panel. The following figure illustrates the process:

FUNC1-root.wcli

FUNC2-page.wcli

FUNC3-page.wcli

FUNC4-page.wcli

LEAF-panelgen.wcli

Page 89

WebClient v1.4r1

Chapter 7: Troubleshooting

Chapter 7: Troubleshooting
What do I do if I get ''[PLEX0040] Location definition for WXPCOURSE55 is not complete. Attempting local function call.''
This message is caused by a missing Plex system definition. The error can be resolved as follows: Open ob550client.properties. Add the following settings under #Remote Function Calls.

WXPCOURSE55.System=*THIS WXPCOURSE55.Port= WXPCOURSE55.Environment= WXPCOURSE55.AdditionalEncryption=None WXPCOURSE55.SecureConnection=No WXPCOURSE55.Protocol= WXPCOURSE55.EJBProxyJNDI=PlexEJBProxy WXPCOURSE55.INITIAL_CONTEXT_FACTORY= WXPCOURSE55.PROVIDER_URL=

Save ob550client.properties.

What do I do if I get the following error on Eclipse: Project PlexBuild is missing required library: 'C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant.jar'. The project cannot be build until build path error are resolved".
This error is called by the incorrect path to the jar file ant.jar. Right-click on PlexBuild project. Select Properties, and then click on the Libraries tab. Remove ant.jar C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant.jar. Click Add External JARs... Browse to your Eclipse installation folder, then into plugins\org.apache.ant. Select ant.jar.

What do I do if I get "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket"?


Open Enterprise Manager Expand Microsoft SQL Servers Expand SQL Server Group Right-click on the database Select Properties Open General tab Click Network Configuration... button

Page 90

WebClient v1.4r1

Chapter 7: Troubleshooting

Select TCP/IP Click Properties The default port is 1433 Click OK Click Apply Click OK.

Change the port number if you still have the error message.

What do I do if I get "[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt"?
This can be solved by enabling the Multiple Access Result Sets feature in SQL2005. To enable this you must use an ODBC source with a 'SQL Native Client' driver. You can set it up with same parameters as a SQL Server connection from ODBC Data Source Administrator. In your obXXXclient.properties file, locate the data source definition and add the string ";MARS_Connection=yes" to your DataSource, e.g.

Environment.Default.Driver=sun.jdbc.odbc.JdbcOdbcDriver Environment.Default.DataSource=jdbc:odbc:IPDUGnative;MARS_Connection=yes

What do I do if I get "Party: Error creating socket (java.net.ConnectException: Connection refused: connect)"?
This can be solved by restarting the Websydian Server.

Page 91

WebClient v1.4r1

Chapter 7: Troubleshooting

What if my WebPlexBuild plugin does not show up on Plugin details in Eclipse?


This can be solved by copying org.apache.jakarta_log4j to your Eclipse plugins folder.

What do I do if I get "javax.servlet.ServletException: m_bStreamHandlerSet" error?


Update AllFusion Plex v5.5 to the current PTF and the latest obrun.jar file. The date on obrun.jar should be 7/20/2007 or later.

Page 92

WebClient v1.4r1

Appendix A: Template Commands

Appendix A: Template Commands


-- comment
Synopsis Description /(!-- comment) This command is a server-side comment. It has no effect.

ALERTS
Synopsis /(ALERTS) ... /(ALERTS)

Description

The contents of the data inside the /(ALERTS) block is expanded once for every outstanding alert message associated with the panel. The details of each message can be retrieved within the block by using the /(AlertMsg), /(AlertType), and /(AlertFdbk) commands.

Action
Synopsis /(!Action:[[control action]]) ... /(!Action)

Description

Allows a template to handle control actions. The action must have been previously enabled with the /(!EnableAction) command. The data inside of the /(!Action) command is expanded for every action of that type which has been sent to the command. For an example, see the entry for /(!EnableAction).

ActionArg
Synopsis Description /(!ActionArg) The command is valid within the body of an /(!Action) command. When specified, it expands to the argument of the control action being processed, if any. The value of the argument depends on the type of action. For more information, see the documentation specific for the control action.

Page 93

WebClient v1.4r1

Appendix A: Template Commands

AttachPoint
Synopsis /(!AttachPoint:name=[[attach point]] [ :inlinetemplate ] [ :sep=separator] [ :args...]) [ ... inline template data ... /(!AttachPoint) ]

Description

Defines an attach point in the current template where future templates may populate. The attach point is identified by the given name. The /(!AttachPoint) command expands to an empty string; however, the position is marked and when future templates invoke the attach point, their output will be placed at that position. The attach point is invoked by using a command with the same name as the attach point. If the inlinetemplate flag is set, the AttachPoint command accepts a block, and this block is expanded as a template whenever the attach point is used. If the inlinetemplate flag is not present, the AttachPoint command must not have a block. If the sep parameter is specified, it specifies text that is used as a separator between invocations of the attach point. The separator text is placed in between every invocation. Any other parameters that are specified become default arguments for the templates attached to the attach point.

ButtonGroup
Synopsis Description /(!ButtonGroup) Expands to the control name of the current button group. The button group is the control name that is associated with the current group of radio buttons.

ButtonValue
Synopsis Description /(!ButtonValue) Expands to the button value of radio buttons.

CheckedValue
Synopsis Description /(!CheckedValue) Expands checked value of the check box field.

Page 94

WebClient v1.4r1

Appendix A: Template Commands

DataType
Synopsis Description /(!DataType) Expands to the data type of the field which is bound to the control. The value will be one of the following: Char FixedDec Long Date Time Object

DecLength
Synopsis Description /(!DecLength) Expands to the design decimal places of the field which is bound to the control.

Edit
Synopsis Description /(!Edit) Restrict: WebColumnHeadingData References the column's associated edit control. This is a control reference command.

EditNameID
Synopsis Description /(!EditNameID) Expands to the fully qualified name identifier of the edit control that is associated with the current control, which must be a Column Heading control.

EditProperty
Synopsis Description /(!EditProperty:[[property name]] [ :[[property modifier]] ] ) Works similarly to /(!Property), except the properties are retrieved from the edit control that is associated with the current control, which must be a Column Heading control.

Page 95

WebClient v1.4r1

Appendix A: Template Commands

Embed
Synopsis /(Embed:output type [:cdata] ) ... /(Embed)

Description

The contents of the Embed block are expanded and encoded with the specified output type. This is used when one output type is embedded in another; for example, JavaScript within HTML, or HTML within JavaScript. The output type can be: html Encodes the output as HTML. js Encodes the output as a Javascript expression. If the flag cdata is specified, and the current output type is HTML, then the current HTML element is assumed to be of type CDATA, and entity encoding is bypassed as is necessary for CDATA elements.

Example

The following illustrates retrieving the value of MyField into a Javascript variable, using a script embedded within an HTML page:
<script type="text/javascript"> /(Embed:js:cdata) var fld_value = /(MyField); ... /(Embed) </script>

The following illustrates generating a snippet of HTML from within a Javascript function:
function my_function() { var html = "<span class='myclass'>" + /(Embed:html)/(MyField)/(Embed) + "</span>"; ... }

Page 96

WebClient v1.4r1

Appendix A: Template Commands

EnableAction
Synopsis Description /(!EnableAction:[[control action]] [ ,[[control action]]... ]) When specified for a control, indicates that the template will handle the given control actions. Any number of actions may be specified, separated by commas. Once an action is enabled, the runtime will not automatically refresh the page when an action of that type is processed. Instead, it will enqueue the action to a list associated with the control. The template must then expand the action list by using the /(!Action) command. The following example shows how a read-only field can change its value without refreshing the screen.
/(!-- The field is mapped as an HTML SPAN element.) <span id="/(!NameID)"> /(!This) </span> /(!-- Indicate that when the SetValue control action is processed, we will handle it here.) /(!EnableAction:SetValue) /(!-- Place Javascript code inside of the JS attach point to perform the update.) /(!JS) /(!-- The code in the following block will be run as Javascript when the value of the control is changed.) /(!Action:SetValue) document.getElementById("/(!NameID)").innerText = /(!This); /(!Action) /(!JS)

Example

Page 97

WebClient v1.4r1

Appendix A: Template Commands

Event
Synopsis Description Example /(!Event:phys=[[physical event]]) If the given physical event is mapped on this control, expands to its mapped event number. Otherwise, expands to the empty string. The following template will expand differently depending on whether or not the Pressed event is mapped to the current control.
/(!If:/(!Event:phys=Pressed)) The pressed event is mapped /(!Else) The pressed event is not mapped /(!If)

FOCUS
Synopsis /(FOCUS) ... /(FOCUS)

Description

The contents of the data inside the /(FOCUS) block is expanded once for each control on the panel that has received initial focus. The block is expanded with a valid control context for each focused control.

FindControl
Synopsis Description /(!FindControl: [[control id]]) This control reference command yields the control of the panel that has the specified Plex control ID. The control ID is a numeric value that is assigned by the Plex panel generator. It is unstable (changes with every generation) and is included in certain control properties, which is why you may need this command.

GridEnd
Synopsis Description /(!GridEnd) Expands to Y if the Plex program has executed Set Grid End On for this grid. Otherwise, expands to nothing.

Page 98

WebClient v1.4r1

Appendix A: Template Commands

If
Synopsis /(!If:value) ... [ /(!Else) ] ... /(!If) /(!If:value1=value2) ... [ /(!Else) ] ... /(!If)

Description

This command performs a comparison. It has two forms. In the first form, the contents of the /(!If) block are expanded if value expands to a non-empty string. In the second form, the contents are expanded if value1 is equal to value2. In both forms, an optional /(!Else) clause may be specified. The /(!Else) block is terminated by the /(!If) command terminator; it does not have its own terminator.

IgnoreActions
Synopsis Description /(!IgnoreActions) When specified for a control, causes the control to ignore any control actions that are sent to it. This command always expands to the empty string. This is useful for a template which does not respond to actions, to prevent the screen from refreshing.

ImplName
Synopsis Description /(!ImplName) Expands to the implementation name of the field which is bound to the control.

Length
Synopsis Description /(!Length) Expands to the design length of the field which is bound to the control.

Page 99

WebClient v1.4r1

Appendix A: Template Commands

NameID
Synopsis Description /(!NameID) Expands to the fully qualified name identifier of the current control. The NameID is unique even when child panels are used. (The control name itself in such a situation need not be unique.)

OptSelected
Synopsis Description /(!OptSelected:[[option]]) Expands to Y if the option selected is the one indicated.

OptText
Synopsis Description /(!OptText) Returns the text of the current option of a combobox. This command is valid within the /(!This) command block of a combobox control.

OutTo
Synopsis /(OutTo:[[output path]]) .... /(OutTo)

Description

The contents of the OutTo block are placed into the response stream at the specified output path. The OutTo command itself expands to nothing; all data is placed in the path.

Owner
Synopsis Description /(!Owner) Returns the owning panel.

Owner
Synopsis /(!Owner)

Page 100

WebClient v1.4r1

Appendix A: Template Commands

Description

References the panel that owns the current control. This is a control reference command.

Panel
Synopsis Description /(!Panel) This control reference command refers to the panel control. This is the root element of the control hierarchy.

Param
Synopsis Description /(!Param:[[parameter name]]) Expands to the value of the given parameter in the current template. If the current template is a control template, the parameter may be a control name parameter. If the current template is an inline template, the parameter may be a parameter specified in the inline template invocation.

Parent
Synopsis Description /(!Parent) References the parent of the control in the control hierarchy. This is a control reference command.

Property
Synopsis Description /(!Property:[[property name]] [ :[[property modifier]] ] ) Expands to the value of the specified property of the current control. If the property is not defined, expands to the empty string. An optional property modifier may be specified.

Render
Synopsis Description /(!Render:[[output path]] [ :args... ] ) Performs rendering of the current panel, and sends the result of rendering the panel to the specified output path. If any optional arguments are specified, they are carried over as request parameters and may be retrieved with the /(!Req) command.

Page 101

WebClient v1.4r1

Appendix A: Template Commands

Site
Synopsis Description /(!Site) Expands to the panel object that is loaded in the current site control.

State
Synopsis Description /(!State) Expands to the current control's state value, as an integer.

This
Synopsis Description /(!This) ... /(!This) Expands to the contents of the block, repeated once for every option in the combo box control.

This
Synopsis Description /(!This) ... /(!This) Expands the contents of the command block once for every grid row in the grid.

This
Synopsis Description /(!This) Expands to the value of the current control. This command also works as a control reference, referring to the current control. The behavior of this command depends on which type of control is being used. See the control-specific documentation for details.

Title
Synopsis Description /(!Title) Expands to the title of the current panel.

Page 102

WebClient v1.4r1

Appendix A: Template Commands

Type
Synopsis Description /(!Type) Returns the type of the current control. This is the value from the Type property in the panelresource file.

UncheckedValue
Synopsis Description /(!UncheckedValue) Expands unchecked value of the check box field.

Visible
Synopsis Description /(!Visible) Expands to Y if the current panel is visible. Otherwise, expands to nothing.

WsRes
Synopsis Description /(!WsRes) At runtime, expands to the web resources path that associated with the web library id of the current template. The web library id is defined by the project containing the template; that id is then mapped to a URL resource path by a runtime-specific configuration mechanism. The following HTML image element refers to an image which is located in the images directory under the current project's web resources path:
<img src="/(!WsRes)/images/myimage.png"></img>

Example

getVar(String var)
Synopsis Description getVar(String var) Retrieves the value of the specified bean variable in the current control.

Page 103

WebClient v1.4r1

Appendix A: Template Commands

jsonColVis
Synopsis Description /(!jsonColVis) Returns a list of the visibilities of each column on the grid, as a Javascript array. Each element is either true if the column is visible, or false if it is not.

jsonCols
Synopsis Description /(!jsonCols) Returns a list of the names of the columns of the grid, as a Javascript array.

jsonImplNames
Synopsis Description /(!jsonImplNames) Returns a list of the implementation names of the column fields of the grid, as a Javascript Array.

jsonOptions
Synopsis Description /(!jsonOptions) Returns a list of the names of the options in the combo box, as a Javascript list.

jsonRows
Synopsis Description /(!jsonRows) Returns the contents of the grid as a two dimensional array. The outer dimension is rows, the inner dimensions is columns.

jsonSelected
Synopsis Description /(!jsonSelected) Returns a list of row numbers in the grid that are selected. The rows are numbered started from zero.

Page 104

WebClient v1.4r1

Appendix A: Template Commands

jsonValues
Synopsis Description /(!jsonValues) Returns a list of the values of the options in the combo box control, as a Javascript list.

processAction(String actionName [, Object arg] )


Synopsis Description processAction(String actionName [, Object arg] ) Sends a control action with the specified name to the control. The action name can be matched the with /(!Action) control command. If the action argument arg is specified, it may be retrieved with the /(!ActionArg) control command.

setVar(String var, Object val)


Synopsis Description setVar(String var, Object val) Sets the value of the specified bean variable in the current control to val.

value
Synopsis Description /(!value) Expands to the text value of the option that is currently selected.

Page 105

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Appendix B: JDBC Driver Configuration


Configuring and Using SQL Server 2000

Download SQL Server 2000 JDBC driver at [http://www.microsoft.com/downloads/details.aspx?familyid=86212D54-8488-481D-B46B-AF29BB18E

http://www.microsoft.com/downloads/details.aspx?familyid=86212D54-8488-481D-B46B-AF29BB18E Refer to Microsoft website for installation instruction.

Creating an ODBC Connection for SQL Server 2000


Go to Control Panel Administrative Tools Data Sources (ODBC) Open User DSN tab Click Add... Select SQL Server driver Click Finish. Enter data source information Click Next >

Select "With Windows NT authentication using the network login ID."

Page 106

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Change the default database to your database name Click Next >

Click Finish Click Test Data Source... It should display TESTS COMPLETED SUCCESSFULLY

Click OK to complete the setup.

Page 107

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Configuring the SQL Server 2000 JDBC Driver in Eclipse


Open ob550client.properties and edit the following parameters. Enter the username and password to connect to the database.

Environment.Default.Driver=com.microsoft.jdbc.sqlserver.SQLServerDriver Environment.Default.DataSource=jdbc:microsoft:sqlserver://localhost:portnumber;database Environment.Default.User=username Environment.Default.Password=password

Add the JDBC driver on the Java Project. Right-click on the java project Select Properties Open Java Build Path Click Add External JARs... Add msutil.jar, msbase.jar, and mssqlserver.jar Click Apply Click OK.

Add the JDBC driver in on the Dynamic Web Project. Right-click on the dynamic web project Select Properties Open J2EE Module Dependencies Click Add External JARs... Add msutil.jar, msbase.jar, and mssqlserver.jar Click Apply Click OK.

Page 108

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Page 109

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Configuring and Using SQL Server 2005

Download SQL Server 2005 JDBC driver at [http://www.microsoft.com/downloads/details.aspx?familyid=C47053EB-3B64-4794-950D-81E1EC91C

http://www.microsoft.com/downloads/details.aspx?familyid=C47053EB-3B64-4794-950D-81E1EC91C Refer to Microsoft website for installation instruction.

Creating an ODBC Connection for SQL Server 2005


Go to Control Panel Administrative Tools Data Sources (ODBC) Open User DSN tab Click Add... Select SQL Native Client driver Click Finish. Enter data source information Click Next >

Select "With Integrated Windows authentication."

Change the default database to your database name Click Next >

Page 110

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Click Finish Click Test Data Source... It should display TESTS COMPLETED SUCCESSFULLY

Click OK to complete the setup.

Configuring the SQL Server 2005 JDBC Driver in Eclipse


Open ob550client.properties and edit the following parameters. Enter the username and password to connect to the database.

Environment.Default.Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver Environment.Default.DataSource=jdbc:sqlserver://localhost:portnumber;databasename=yourd Environment.Default.User=username Environment.Default.Password=password

Add the JDBC driver on the Java Project. Right-click on the java project Select Properties Open Java Build Path Click Add External JARs... Add sqljdbc.jar Click Apply Click OK.

Page 111

WebClient v1.4r1

Appendix B: JDBC Driver Configuration

Add the JDBC driver in on the Dynamic Web Project. Right-click on the dynamic web project Select Properties Open J2EE Module Dependencies Click Add External JARs... Add sqljdbc.jar Click Apply Click OK.

Page 112

S-ar putea să vă placă și