Application.jsp Sample
This topic inludes the source code for the Application.jsp Sample.
Sample Location
This sample is located in the following directory in your WebLogic Workshop installation:
BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/handlingData/databinding/application/
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 <title>
07 application.jsp
08 </title>
09 <link href="/WebApp/resources/css/style.css" type="text/css" rel="stylesheet"/>
10 </head>
11 <body>
12 <jsp:include page="/resources/jsp/header.jsp"/>
13 <h3>Databinding Samples: {application...} Context</h3>
14 <p>This sample uses the {application...} data binding context to store data in the
15 <code>javax.servlet.ServletContext</code> object, representing the application to
16 which this JSP belongs.
17 <blockquote>
18
19 <%--
20 Saves a parameter/value pair to the javax.servlet.ServletContext.
21 This pair will be readable using the {application...} data binding expression.
22 --%>
23 <%
24 ServletContext servletContext = getServletConfig().getServletContext();
25 servletContext.setAttribute("appParam", "appValue");
26 %>
27
28 <p>The following value was read from the {application...} data binding context.
29 <p><netui:label value="{application.appParam}" style="color:#ff3300;" />
30
31 </blockquote>
32 <hr>
33 <p><netui:anchor href="/WebApp/handlingData/databinding/databindingController.jpf">
34 Back to Databinding Samples</netui:anchor>
35 </body>
36 </netui:html>
|