You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/11/25 23:29:11 UTC
svn commit: r1039207 - in
/myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp:
home.jsp outputClientId.jsp
Author: lu4242
Date: Thu Nov 25 22:29:11 2010
New Revision: 1039207
URL: http://svn.apache.org/viewvc?rev=1039207&view=rev
Log:
add add outputClientId example
Added:
myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/outputClientId.jsp
Modified:
myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/home.jsp
Modified: myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/home.jsp?rev=1039207&r1=1039206&r2=1039207&view=diff
==============================================================================
--- myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/home.jsp (original)
+++ myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/home.jsp Thu Nov 25 22:29:11 2010
@@ -55,6 +55,7 @@
<h:outputLink value="validateDateRestriction.jsf" ><f:verbatim>mcv:validateDateRestriction</f:verbatim></h:outputLink>
<h:outputLink value="exporter.jsf" ><f:verbatim>Exporter - Export datatable contents as an excel file or as a pdf file</f:verbatim></h:outputLink>
<h:outputLink value="renderOne.jsf" ><f:verbatim>mc:renderOne - render the first child component by order or by index</f:verbatim></h:outputLink>
+ <h:outputLink value="outputClientId.jsf" ><f:verbatim>mc:outputClientId</f:verbatim></h:outputLink>
</h:panelGrid>
</h:form>
Added: myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/outputClientId.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/outputClientId.jsp?rev=1039207&view=auto
==============================================================================
--- myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/outputClientId.jsp (added)
+++ myfaces/commons/trunk/examples/myfaces-commons-examples/src/main/webapp/outputClientId.jsp Thu Nov 25 22:29:11 2010
@@ -0,0 +1,70 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/converters"
+ prefix="mcc"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/components"
+ prefix="mc"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/validators"
+ prefix="mcv"%>
+
+<html>
+<f:view>
+
+<%@include file="inc/head.inc"%>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//-->
+
+<body>
+<div id="container">
+ <f:loadBundle
+ basename="org.apache.myfaces.examples.resource.example_messages"
+ var="example_messages" />
+
+ <h1><h:outputText value="#{example_messages['title']}"/></h1>
+ <br/>
+
+ <h:messages showDetail="true" showSummary="false"/>
+
+ <p>
+ <a href="javascript:void" onclick="testJavascript(event);return false;">Test link</a>
+
+ <script type="text/javascript">
+ function testJavascript(event) {
+ var element = document.getElementById('<mc:outputClientId for="myContainer" />');
+ }
+ </script>
+ </p>
+
+ <h:form id="myContainer">
+ mc:outputClientId is useful when a component id is needed as reference within an inline javascript.
+ <ul>
+ <li>ClientId of containing container is <code><mc:outputClientId for="myContainer"/></code></li>
+ <li>ClientId of current parent is <code><mc:outputClientId /></code></li>
+ </ul>
+ </h:form>
+<%@include file="inc/page_footer.jsp"%>
+</div>
+</body>
+
+</f:view>
+</html>
\ No newline at end of file