alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (showRoom.ftl)

This example Struts source code file (showRoom.ftl) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

available, available, chat, exit, in, in, initial, initial, message, messages, post, room, room, users

The Struts showRoom.ftl source code


<html>
	<head>
		<title>Showcase - Chat - Show Room 
		<@sx.head />
		<style type="text/css">
			div.box {
				border: 1px solid darkblue;
				margin: 5px;
			}
			
			div.box h3 {
				color: white;
				background: darkblue;
				margin: 3px;
				padding: 2px;
			}
			
			div.nobox {
				margin: 5px;
			}
			
			table.table {
				border: 1px solid darkblue;
				width: 98%;
				margin: 5px;
			}
			
			table.table tr.tableHeader {
				color: white;
				background: darkblue;
				margin: 3px;
				padding: 2px;
				font-size: medium; 
				font-weight: bold;
			}

			table.table td.tableSenderColumnOdd {
				background: gray;
				color: white;
				width: 20%
			}
			
			table.table td.tableDateColumnOdd {
				background: gray;
				color: white;
				width: 20%;
			}
			
			table.table td.tableMessageColumnOdd {
				background: gray;
				color: white;
				width: 60%;
			}
			
			table.table td.tableSenderColumnEven {
				background: white;
				color: gray;
				width: 20%
			}
			
			table.table td.tableDateColumnEven {
				background: white;
				color: gray;
				width: 20%;
			}
			
			table.table td.tableMessageColumnEven {
				background: white;
				color: gray;
				width: 60%;
			}
			
			div.container {
				margin-left: auto;
				margin-right: auto;
				width: 100%;
			}
			
			div.left {
				width: 20%;
				float: left;
			}
			
			div.right {
				width: 20%;
				float: left;
			}
			
			div.center {
				width: 60%;
				float: left;
			}
			
		</style>
	</head>
	<body>
		<div class="container">
		<div class="left">
		<div class="box">
			<h3>Operation
			<@s.url id="url" action="exitRoom" namespace="/chat">
				<@s.param name="roomName" value="%{roomName}" />
			</@s.url>
			<ul>
				<li><@s.a href="%{#url}">Exit Room
			</ul>
		</div>
		<div class="box">
		<h3>Users Available In Chat
        <@s.url id="usersAvailableUrl" action="usersAvailable" namespace="/chat/ajax" />
        <@sx.div id="usersAvailable" href="%{usersAvailableUrl}"
				 updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
			Initial Users Available ...
		</@sx.div>
		</div>
		</div>
		
		<div class="center">
		<div class="box">
		<h3>Messages Posted In Room [${roomName?default('')}]
		<@s.url id="url" value="/chat/ajax/messagesAvailableInRoom.action" includeContext="true">
			<@s.param name="roomName" value="%{roomName}" />
		</@s.url>
		<@sx.div id="messagesInRoom" href="%{#url}" includeContext="true"
				  updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" 
				  listenTopics="topicMessageSend">
			Initial Messages In Room ...
		</@sx.div>
		</div>
		
		<div class="box">
		<h3>Send Messages
		<@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST">
			<div id="sendMessageResult">
<@s.textarea label="Message"name="message" theme="xhtml" /> <@s.hidden name="roomName" value="%{roomName}" /> <@sx.submit id="submit" resultDivId="sendMessageResult" afterNotifyTopics="topicMessageSend" value="%{'Send'}" /> </@s.form> </div> </div> <div class="right"> <div class="box"> <h3>Users Available In Room [${roomName?default('')}] <@s.url id="url" value="/chat/ajax/usersAvailableInRoom.action" includeContext="true"> <@s.param name="roomName" value="%{roomName}" /> </@s.url> <@sx.div id="usersAvailableInRoom" href="%{#url}" includeContext="true" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"> Initial Users Available In Room ... </@sx.div> </div> </div> </div> </body> </html>

Other Struts examples (source code examples)

Here is a short list of links related to this Struts showRoom.ftl source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.