# Index.jsp Sample

This topic inludes the source code for the Index.jsp Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/imageAnchor/

## Sample Source Code

`01 <%@ page language="java" contentType="text/html;charset=UTF-8"%> 02 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%> 03 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%> 04 <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%> 05 <netui:html> 06 <head> 07 <title> 08 index.jsp 09 </title> 10 </head> 11 <body> 12 <jsp:include page="/resources/jsp/header.jsp"/> <br/> 13 <h3>ImageAnchor Tag Sample</h3> 14 <p> 15 <b>Linking to a Page</b><br> 16 This netui:imageAnchor tag links to the page "linkPage.jsp":<br> 17 <netui:imageAnchor 18 href="linkPage.jsp" 19 src="../../../resources/images/go-button.gif" 20 rolloverImage="../../../resources/images/go-button-rollover.gif" 21 border="0">To linkPage.jsp</netui:imageAnchor> 22 23 <hr> 24 <b>Invoking an Action Method</b><br> 25 This netui:anchor tag invokes the action method "showCurrentTime".<br> 26 <netui:imageAnchor 27 action="showCurrentTime" 28 src="../../../resources/images/go-button.gif" 29 rolloverImage="../../../resources/images/go-button-rollover.gif" 30 border="0">Invoke showCurrentTime</netui:imageAnchor> 31 32 <hr> 33 <b>Submitting Form Data</b><br> 34 This netui:anchor tag submit data to the "formSubmit" action.<br> 35 <netui:form action="formSubmit"> 36 Firstname: 37 <netui:textBox dataSource="{actionForm.firstname}"/><br> 38 Lastname: 39 <netui:textBox dataSource="{actionForm.lastname}"/><br> 40 <netui:imageAnchor 41 formSubmit="true" 42 src="../../../resources/images/go-button.gif" 43 rolloverImage="../../../resources/images/go-button-rollover.gif" 44 border="0">Submit</netui:imageAnchor> 45 </netui:form> 46 47 <hr> 48 <b>Submitting Form Data with a Custom Java Script Function</b><br> 49 This netui:anchor tag invokes the custom JavaScript method "helloAlert" before submitting the data.<br> 50 <netui:form action="formSubmit"> 51 Firstname: 52 <netui:textBox dataSource="{actionForm.firstname}"/><br> 53 Lastname: 54 <netui:textBox dataSource="{actionForm.lastname}"/><br> 55 <netui:imageAnchor 56 formSubmit="true" 57 onClick="SubmitFromAnchor();return false;" 58 src="../../../resources/images/go-button.gif" 59 rolloverImage="../../../resources/images/go-button-rollover.gif" 60 border="0">Submit</netui:imageAnchor> 61 </netui:form> 62 <script language="JavaScript" type="text/JavaScript"> 63 function SubmitFromAnchor() 64 { 65 // Place custom logic here... 66 alert("Hello, " + document.forms[1].elements[0].value + " " + document.forms[1].elements[1].value + "!"); 67 68 for(var i=0; i<document.forms.length; i++) 69 { 70 // submit to the action formSubmit 71 if (document.forms[i].action == "/WebApp/tagSamples/netui/imageAnchor/formSubmit.do") 72 { 73 document.forms[i].method="POST"; 74 document.forms[i].action="/WebApp/tagSamples/netui/imageAnchor/formSubmit.do"; 75 document.forms[i].submit(); 76 } 77 } 78 } 79 </script> 80 81 </p> 82 <hr> 83 <netui:anchor href="/WebApp/tagSamples/tagSamplesController.jpf">Return to Tag Samples</netui:anchor> 84 </body> 85 </netui:html>`