source: extensions/net.sf.basedb.examples/tags/1.0/resources/hello_world.jsp

Last change on this file was 656, checked in by Nicklas Nordborg, 15 years ago

References #103: Create example extensions

Adding a servlet example

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 1.3 KB
Line 
1<%@ page session="false"
2  import="net.sf.basedb.core.SessionControl"
3  import="net.sf.basedb.core.DbControl"
4  import="net.sf.basedb.core.User"
5  import="net.sf.basedb.clients.web.Base"
6  import="net.sf.basedb.clients.web.util.HTML"
7%>
8<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
9<%
10final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
11final String ID = sc.getId();
12final DbControl dc = sc.newDbControl();
13
14try
15{
16  User current = User.getById(dc, sc.getLoggedInUserId());
17  %>
18  <base:page type="popup" title="Hello JSP world">
19  <base:head />
20  <base:body>
21    <h3 class="docked">Hello <%=HTML.encodeTags(current.getName())%></h3>
22    <div class="boxedbottom">
23      Here are your settings:
24      <table class="form" border="0" cellspacing="1" cellpadding="2">
25      <tr>
26        <td class="prompt">Session ID</td>
27        <td><%=ID%></td>
28      </tr>
29      <tr>
30        <td class="prompt">Login</td>
31        <td><%=HTML.encodeTags(current.getLogin())%></td>
32      </tr>
33      <tr>
34        <td class="prompt">Email</td>
35        <td><%=HTML.niceFormat(current.getEmail())%></td>
36      </tr>
37      </table>
38    </div>
39    <br>
40    <table align="center">
41    <tr>
42      <td><base:button onclick="window.close()" title="Close" /></td>
43    </tr>
44    </table>
45    </form>
46  </base:body>
47  </base:page>
48  <%
49}
50finally
51{
52  if (dc != null) dc.close();
53}
54%>
Note: See TracBrowser for help on using the repository browser.