<%@ page import="java.text.*" %>
<%@ taglib uri="ejbtags" prefix="ejb" %>

<ejb:useHome id="home" type="com.evermind.ejb.NewsItemHome" location="java:comp/env/ejb/NewsItem" />
<ejb:useBean id="news" type="com.evermind.ejb.NewsItem" value="<%=home.findByPrimaryKey(Integer.parseInt(request.getParameter("id")))%>" />
<% DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG, request.getLocale()); %>

<html>
	<head>
		<title>News</title>
	</head>
	<body bgcolor="e0d0c0">
		<font size="5" face="Arial"><b>Useless news HQ - Edit news</b></font><br>

		<form action="editnews_done.jsp" method="POST">
		<input type="hidden" name="id" value="<%=request.getParameter("id")%>">
			<table>
				<tr>
					<td>
						<b>Subject: </b><br>
						<input name="subject" type="text" value="<jsp:getProperty name="news" property="subject">" size="40"><br>
					</td>
				</tr>
				<tr>
					<td>
						<b>Date: </b><br>
						<input name="date" type="text" value="<%=dateFormat.format(news.getDate())%>" size="40"><br>
					</td>
				</tr>
				<tr>
					<td>
						<b>Content: </b><br>
						<textarea name="text" cols="34" rows="5"><jsp:getProperty name="news" property="text"></textarea><br>
					</td>
				</tr>
				<tr>
					<td>
						<input type="submit" value="Update">
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>