「home.jsp」という名前のJSPページがあります。 そして私は "getRunHomeDisplay"という名前のメソッドを持っています。ページロード時にメソッドを実行するjsp
最初は私がhome.jspにボタンを持っています。そのボタンをクリックすると、家の中のすべてのアイテムが表示されます。
これは、ボタンの呼び出しです:
try {
log("Account selected: ");
(new action.ItemShowAction()).execute(getgetRunHomeDisplay());
} catch (Exception e) {
return "error";
}
return "success";
これが私の「home.jspを」ソースです:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%-- jsf:pagecode language="java" location="/src/pagecode/Itemtest2.java" --%> <%-- /jsf:pagecode --%><%@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://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<html>
<head>
<title>itemtest2</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" title="Style"
href="theme/stylesheet.css">
<script type="text/javascript">
</script></head>
<script type="text/javascript">
</script>
<f:view>
<body onload="#{pc_ItemClick.doButton1Action}">
<hx:scriptCollector id="scriptCollector1">
<h:form styleClass="form" id="form1">
<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"
action="#{pc_ItemClick.doButton1Action}"></hx:commandExButton>
<hx:dataTableEx id="item1" value="#{itemtest.item}" var="varitem"
styleClass="dataTableEx" headerClass="headerClass"
footerClass="footerClass" rowClasses="rowClass1, rowClass2"
columnClasses="columnClass1" border="0" cellpadding="2"
cellspacing="0">
<hx:columnEx id="item2column">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Item" id="item2text"></h:outputText>
</f:facet>
<h:outputText styleClass="outputText" id="item2" value="#{varitem}">
</h:outputText>
</hx:columnEx>
</hx:dataTableEx>```1
</h:form>
</hx:scriptCollector>
</body>
</f:view>
</html>
どのように私が代わりにクリックするのページのロード時に、この方法を実行するために呼び出す必要がありますボタン?
作成された管理対象のBeanは、managedbeanですか? –
そうだと思います。ちょっとしたテストをして、動作するかどうかを確認します:P –
OPはJSF 2.xを使用していないようです。 – BalusC