📄 test.jsp
字号:
<%@ page import="com.sybase.powerbuilder.jspobject.*" %><%!
// psPage & global variable declaration
PSServerPageJSPClass psPage;
PSDocumentClass psDocument;
PSSessionClass psSession;
PSServerClass psServer;
// jsp implict objects
PageContext pageContext;
HttpSession session;
ServletContext application;
ServletConfig config;
JspWriter out;
Object page;
HttpServletRequest request;
HttpServletResponse response;
// Throwable exception;
// variable declarations
// parameters
public String colname;
// page variables
// jaguar objects
public DataWindow.HTMLGenerator80 HTMLGenerator80;
// controls
PSButtonClass cb_add;
PSButtonClass cb_del;
PSButtonClass cb_update;
PSWebDataWindowClass dw_1;
// parameters
// jaguar objects
class HTMLGenerator80Class extends PSJaguarObjectClass {
public HTMLGenerator80Class(IPageHost host) {
super (host, "HTMLGenerator80", "fang:9000", "DataWindow/HTMLGenerator80", LIFETIME.PAGE, "");
}
public String evaluateUserId() {
return "jagadmin";
}
public String evaluatePassword() {
return "";
}
public void setVarValue(Object newValue) {
HTMLGenerator80 = DataWindow.HTMLGenerator80Helper.narrow((org.omg.CORBA.Object) newValue);
}
public Object getVarValue() {
return HTMLGenerator80;
}
} // end of HTMLGenerator80Class
// controls
class cb_add_class extends PSButtonClass {
public cb_add_class(IPageHost host, String name, String initialValue) {
super(host, name, initialValue);
}
public void ServerAction() { // {{ EVENT("cb_add","ServerAction")
dw_1.InsertRow(0);
} // }}
} // end of cb_add_Class
class cb_del_class extends PSButtonClass {
public cb_del_class(IPageHost host, String name, String initialValue) {
super(host, name, initialValue);
}
public void ServerAction() { // {{ EVENT("cb_del","ServerAction")
dw_1.DeleteRow(0);
} // }}
} // end of cb_del_Class
class cb_update_class extends PSButtonClass {
public cb_update_class(IPageHost host, String name, String initialValue) {
super(host, name, initialValue);
}
public void ServerAction() { // {{ EVENT("cb_update","ServerAction")
dw_1.Update();
} // }}
} // end of cb_update_Class
// PSServerPage Version 9.0
class PSServerPageJSPClass extends PSServerPage {
public PSServerPageJSPClass(PageContext context, String pageName, boolean doTrace) {
super(context, pageName, doTrace);
}
public void __CreateObjectModel() {
showErrorsInAlert = false;
showErrorsOnPage = false;
// parameters
_parameters = new IPageGeneration[1];
_parameters[0] = new PSPageParameterClass(this, "colname", "");
// variables
// jaguar objects
_jaguarObjects = new IPageGeneration[1];
_jaguarObjects[0] = new HTMLGenerator80Class(this);
// controls
_controls = new IControl[4];
_controls[0] = new cb_add_class(this, "cb_add", "增加");
_controls[1] = new cb_del_class(this, "cb_del", "删除");
_controls[2] = new cb_update_class(this, "cb_update", "更新");
_controls[3] = dw_1__Create("dw_1");
}
public void __InitializeVariables() {
// parameters
colname = ((PSPageParameterClass)_parameters[0]).initialize(this); // colname
// variables
// jaguar objects
_jaguarObjects[0].initialize();
// controls
cb_add = (cb_add_class)_controls[0]; // cb_add
cb_del = (cb_del_class)_controls[1]; // cb_del
cb_update = (cb_update_class)_controls[2]; // cb_update
dw_1 = ((PSWebDataWindowClass)_controls[3]).initialize(this); // dw_1
}
public void __SaveVariables() {
// parameters
// variables
// jaguar objects
_jaguarObjects[0].save();
// controls
}
public void __UpdateParameters(){
// parameters
((PSPageParameterClass)_parameters[0]).setValue(colname); // colname
}
public void __UpdateVariables(){
// variables
}
// create web datawindow
public PSWebDataWindowClass dw_1__Create(String name){
PSJaguarConnection jagConn = new PSJaguarConnection("fang:9000", "jagadmin", "", "DataWindow/HTMLGenerator90", false);
PSDataWindowSourceClass dwSource = new PSDataWindowSourceClass("", "", "dw_grid.srd");
PSConnectionParmsClass dbConn = new PSConnectionParmsClass("ConnectString='DSN=web;UID=dba;PWD=sql',ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'" );
PSWebDataWindowClass webDW = new PSWebDataWindowClass(this, name, false, jagConn, dwSource, dbConn, 0);
webDW.bAutomaticRetrieve = true;
return webDW;
} // create dw_1
// create 4GL link
} // end of PSServerPageJSPClass
class PSServerPageJSPFactory implements IServerPageFactory {
public PSServerPage newPage(PageContext context, String pageName, boolean doTrace) {
return new PSServerPageJSPClass (context, pageName, doTrace);
}
} // end of PSServerPageJSPFactory
%><%
// dbcs issue
try
{
request.setCharacterEncoding(response.getCharacterEncoding());
}
catch (Exception e){}
// global instance for the page
this.out = out;
this.request = request;
this.response = response;
this.pageContext = pageContext;
this.session = session;
this.application = application;
this.config = config;
this.page = page;
// this.exception = exception;
psDocument = new PSDocumentClass(request, response, out, application);
psSession = new PSSessionClass(session);
psServer = new PSServerClass(psDocument);
PSServerPageJSPFactory psPageFactory = new PSServerPageJSPFactory();
psPage = (PSServerPageJSPClass)PSServerPageJSPClass.getPage(pageContext, psPageFactory, "test.jsp", false);
if (!psPage.runServerEventModel()) return;
%><%@ page contentType="text/html; charset=GB2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="PowerSiteData" NAME="SERVERLANGUAGE" CONTENT="Java">
<TITLE>test</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META content="PB9.0.0.5507" name="GENERATOR">
</HEAD>
<BODY bgColor="white" PSERRORSONPAGE="NONE" OnLoad="psPage.OnLoad();"><% psPage.generateBodyPrologue(out); %>
<P>
<% if (dw_1.visible) { %>
<%
dw_1.Generate();
%>
<% } /* endif */ %>
</P>
<% if (cb_add.visible) { %><INPUT language="JavaScript" id="INPUT1" type="button" value="<%= cb_add.getValueAsString() %>" name="cb_add" <%= cb_add.getDisabledAttribute() %> OnClick="
psPage.ButtonPress(this.name);"><% } /* endif */ %>
<% if (cb_del.visible) { %><INPUT language="JavaScript" id="INPUT2" type="button" value="<%= cb_del.getValueAsString() %>" name="cb_del" <%= cb_del.getDisabledAttribute() %> OnClick="
psPage.ButtonPress(this.name);"><% } /* endif */ %>
<% if (cb_update.visible) { %><INPUT language="JavaScript" id="INPUT3" type="button" value="<%= cb_update.getValueAsString() %>" name="cb_update" <%= cb_update.getDisabledAttribute() %> OnClick="
psPage.ButtonPress(this.name);"><% } /* endif */ %>
<% psPage.generateBodyEpilogue(out); %></BODY>
</HTML><% psPage.endOfPage(); %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -