|
What this is
Other links
The source code
/**
* GuestbookEntry.java
* Pete Willemsen
* CoolServlets.com
* February 3, 2000
* Version 1.0.3
*
* Any errors or feature requests can be reported on CoolServlets.com.
* We hope you enjoy this program!
*
* Copyright (C) 2000 Pete Willemsen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.coolservlets.guestbook;
import java.io.*;
import java.util.Date;
import java.text.SimpleDateFormat;
/**
* GuestbookEntry class
*
*/
public class GuestbookEntry implements Serializable {
public GuestbookEntry() {
_timestamp = new Date();
}
public Date timestamp() {
return _timestamp;
}
private String uriEmail() {
if (email.length() == 0)
return "";
else
return "<a href=\"mailto:" + email + "\">" + email + "";
}
private String uriUrl() {
if (url.length() == 0)
return "";
else
return "<a href=\"" + url + "\">" + url + "";
}
public void print( PrintWriter out, GuestbookStyle s, GuestbookFilter f ) {
SimpleDateFormat simple_date = new SimpleDateFormat();
simple_date.applyPattern("MMMM d, yyyy");
if ( s.type == GuestbookStyle.STYLE_1 ) {
out.println("<!-- Begin Entry Section: STYLE1 -->");
out.println("<B>" + simple_date.format( _timestamp ) + " | URL: | " + uriUrl() + " | "); if (comments.length() != 0) out.println("<tr>Comment: | " + f.filterBadwords( comments ) + " | "); out.println("</table>"); out.println("<hr NOSHADE width=65%>"); out.println("<!-- End Entry Section: STYLE4 -->"); } else if ( s.type == GuestbookStyle.STYLE_5 ) { out.println("<!-- Begin Entry Section: STYLE5 -->"); out.print("<b>"); if (name.length() != 0) out.print(name + " - "); out.print(simple_date.format( _timestamp )); if (email.length() != 0) out.print(" - " + uriEmail()); out.println("</b>
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.