WAT编程方式简单的例子

前面介绍过了WAT的一些基础,今天来个简单的例子。
模仿着看看怎么用,并跳转到自己处理的页面,如何和SERVLET结合,基本上什么事情都能做了。

<%@ page import="filenet.vw.api.*"%>
<%@ page errorPage="/WcmError.jsp"
   import="com.filenet.wcm.apps.server.util.*,com.filenet.wcm.toolkit.server.base.*,com.filenet.wcm.toolkit.server.util.WcmServerCredentials,com.filenet.wcm.toolkit.server.util.WcmDataStore,java.util.*"%>
<jsp:useBean id="controller"
   class="com.filenet.wcm.apps.server.controller.WcmWorkplaceController"
   scope="request">
</jsp:useBean>

<%@page import="com.filenet.wcm.toolkit.util.WcmEncodingUtil"%>
<%@page import="java.net.URLEncoder"%>

<html>
<head>
<title>Form Region Sample Code</title>
<link rel="stylesheet" href="../css/main.css" type="text/css">
<link rel='stylesheet' href='../css/Wcm.css' type='text/css'>
<script language="JavaScript">
   function openPopup(url){
      window.open(url);
   }
</script>
<%
            controller.configurePage(application, request, WcmController.NO_WINDOW_ID);
            WcmDataStore dataStore = controller.getDataStore();
            WcmServerCredentials credentials = dataStore.getServerCredentials();
            String username = credentials.getUserId();
            String password = credentials.getPassword();
            VWSession vwSession = credentials.getVWSession();

            //We can't name this variable session because JSP's have a variable named session already.
            com.filenet.wcm.api.Session ceSession = credentials.getSession();
%>

</head>
<body>
<%
            // See http://localhost:9080/ecm_help/nav/dev_wp_start.htm?../developer_help/workplace/guide/aeuis_cmd_ref.htm#1420

            String baseUrl = controller.getWebappRootURL();
            String commandId = "1420";
            String responseUrl = URLEncoder.encode(baseUrl);
            String windowTitle = WcmEncodingUtil.encodeLabel("Sample Code");

            String objectStoreName = WcmEncodingUtil.encodeLabel("ObjectStoreName");
            String vsId = "{3DEC23E4-03C2-4728-809A-B77A38DA78C7}";
            String mimeType = WcmEncodingUtil.encodeURL("application/x-filenet-documentpolicy");
            String op = "add";
            String prefill = URLEncoder.encode("field1=1&field2=2&field3=3");
            String displayForm = "true";
            String showConfirm = "true";
            String mergeData = "true";
            String linkText = "Click here";

            String url= baseUrl + "/integrationWebBasedCommand"
            + "?_commandId=" + commandId
            + "&_responseURL=" + responseUrl
            + "&_windowTitle=" + windowTitle
            + "&objectStoreName=" + objectStoreName
            + "&vsId=" + vsId
            + "&mimeType=" + mimeType
            + "&op=" + op
            + "&" + prefill
            + "&showConfirm=" + showConfirm
            + "&mergeData=" + mergeData ;

%>

<a href="javascript:openPopup('<%=url%>');"><%=linkText%></a>

</body>

</html>

除非申明,文章均为一号门原创,转载请注明本文地址,谢谢!
[本日志由 轻舞肥羊 于 2009-10-20 07:57 PM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: wat java ibm
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.