📄 scriptcollector.jsp
字号:
<%-- tpl:insert page="/template/jsfTemplate.jtpl" --%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
<LINK href="../theme/new.css" rel="stylesheet">
<LINK rel="stylesheet" type="text/css" href="../theme/stylesheet.css" title="Style">
<%-- tpl:put name="headarea" --%>
<title>scriptCollector.jsp</title>
<%-- /tpl:put --%>
<LINK rel="stylesheet" type="text/css" href="/JSFandSDO/theme/stylesheet.css" title="Style">
</HEAD>
<f:view>
<BODY>
<TABLE class="title" cellpadding="0">
<TBODY>
<TR>
<TD class="noBorder" background="../images/gradient.jpg"
align="CENTER"><IMG border="0" src="../images/title.jpg"></TD>
</TR>
<TR>
<TD class="noBorder" align="RIGHT"><A href="/JSFandSDO">Return to Main Menu</A></TD>
</TR>
</TBODY>
</TABLE>
<%-- tpl:put name="bodyarea" --%>
<hx:scriptCollector id="scriptCollector1"
preRender="#{pc_ScriptCollector.onPageLoadBegin1}"
decode="#{pc_ScriptCollector.onPagePost}">
<h:form styleClass="form" id="form1">
<H2>Using Script Collector Events</H2>
This sample demonstrates how the script collector can be used to run a method before a page is rendered and when a page post action takes place.<BR>
<BR>A "Page Load Begin" event was used to initialize the contents of the first input field and checkbox. When "Page Load Begin" event is not used to initialize fields, they show up blank when the page loads.<BR>
<BR>
<TABLE border="1">
<TBODY>
<TR>
<TD class="border"><h:outputText styleClass="outputText"
id="text7" value='With "Page Load Begin"'></h:outputText></TD>
<TD class="border"><h:outputText styleClass="outputText"
id="text8" value='Without "Page Load Begin"'></h:outputText></TD>
</TR>
<TR>
<TD class="border"><h:inputText styleClass="inputText"
id="text1" value="#{requestScope.name}"></h:inputText></TD>
<TD class="border"><h:inputText styleClass="inputText"
id="text9" value="#{requestScope.nameWithOut}"></h:inputText></TD>
</TR>
<TR>
<TD class="border"><B>Output:</B> <h:outputText
styleClass="outputText" id="text10"
value="#{requestScope.name}"></h:outputText></TD>
<TD class="border"><B>Output:</B> <h:outputText
styleClass="outputText" id="text11"
value="#{requestScope.nameWithOut}"></h:outputText></TD>
</TR>
<TR>
<TD class="border">Check: <h:selectBooleanCheckbox
styleClass="selectBooleanCheckbox" id="checkbox1"
value="#{requestScope.yesno}"></h:selectBooleanCheckbox></TD>
<TD class="border">Check: <h:selectBooleanCheckbox
styleClass="selectBooleanCheckbox" id="checkbox2"
value="#{requestScope.yesnoWithOut}"></h:selectBooleanCheckbox></TD>
</TR>
<TR>
<TD class="border"><B>Output:</B> <h:outputText
styleClass="outputText" id="text12"
value="#{requestScope.yesno}"></h:outputText></TD>
<TD class="border"><B>Output:</B> <h:outputText
styleClass="outputText" id="text13"
value="#{requestScope.yesnoWithOut}"></h:outputText></TD>
</TR>
</TBODY>
</TABLE>
<B><BR>
Output set by a "Page Post" event when the submit button
is clicked:</B>
<h:outputText styleClass="outputText" id="text6"
value="#{requestScope.updown}"></h:outputText>
<P><hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"></hx:commandExButton><B></B>
</P>
<H4>How it works:</H4>
The script collector provides bindings to three methods in the page code file.
<BR>
<BR>
The "Page Load Begin" event runs before the page is rendered and is bound to the preRender attribute.<BR>The "Page Load End" event runs after the page is rendered and is bound to the postRender attribute.<BR>The "Page Post" event runs when a page is submitted and is bound to the decode attribute.<BR>
<BLOCKQUOTE>
<P class="code">Example:<BR>
<hx:scriptCollector id="scriptCollector1"
preRender="#{pc_ScriptCollector.onPageLoadBegin1}"
decode="#{pc_ScriptCollector.onPagePost}"></P>
</BLOCKQUOTE>
<P>To access these methods:<BR>
1. Click anywhere in a JSF page.<BR>
2. Open the Properties view, then click the <span class="tag">scriptCollector</span>
tag.<BR>
3. Click the Quick Edit tab. The three methods are displayed. .</P>
<H4>Files of Interest:</H4>
<UL>
<LI><B>WebContent/scriptCollector/scriptCollector.jsp</B> -
(This Page) Here you will find the script collector tag in the JSF
file.</LI>
<LI><B>src/pagecode.scriptCollector.ScriptCollector.java</B>
- Here you will find the code for the three script collector
methods.</LI>
</UL>
</h:form>
</hx:scriptCollector>
<%-- /tpl:put --%>
<TABLE class="title" cellpadding="0">
<TBODY>
<TR>
<TD class="noBorder" align="RIGHT"><A href="/JSFandSDO">Return to Main Menu</A></TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</f:view>
</HTML><%-- /tpl:insert --%>
<%-- jsf:pagecode language="java" location="/src/pagecode/scriptCollector/ScriptCollector.java" --%><%-- /jsf:pagecode --%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -