Okay, here is the information I know. My IDE is netbeans 5.5, I'm using JSP 2.0, I am using the derby database, with tomcat 5.5. This is long Here is my servlet:
***************************************************************************
public class run extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try{
archBean DB = new archBean();
ArrayList isbn = DB.getISBN();
ArrayList title = DB.getTITLE();
ArrayList author = DB.getAUTHOR();
ArrayList condition = DB.getCONDITION();
ArrayList price = DB.getPRICE();
isbn.trimToSize();
int i = isbn.size();
Object isbnArr[] = new Object[i];
isbnArr = isbn.toArray();
Object titleArr[] = new Object[i];
titleArr = title.toArray();
Object authorArr[] = new Object[i];
authorArr = author.toArray();
Object conditionArr[] = new Object[i];
conditionArr = condition.toArray();
Object priceArr[] = new Object[i];
priceArr = price.toArray();
String book[] = new String[i];
for(int j = 0; j <i; j++)
{
book[j] = isbnArr[j] +" , "+titleArr[j] +" , "+authorArr[j]+" , " +conditionArr[j] +" , "+priceArr[j]+"/n";
}
request.setAttribute("book", book);
RequestDispatcher view = request.getRequestDispatcher("archResults.jsp");
view.forward(request,response);
*************************************************************************
my jsp: this is where I have no clue how to get my variables in the textarea.
*************************************************************************
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<table width="100%" border="3" cellspacing="5" cellpadding="5" bordercolor="#0000FF"background-color:#FFFF99;>
<tr>
<td>
<a href="index.jsp" title="index">HOME</a></td>
<td><a href="buy.jsp" title="Buy books">BUY BOOKS</a></td>
<td><a href="Sell.jsp" title="sell books">SELL BOOKS</a></td>
<td>BROWSE BOOKS</td>
<td><a href="help.jsp" title="help">HELP</a></td>
<td><a href="logon.jsp" title="login">LOGIN</a></td>
<td><a href="http://www.pitt.edu" title="logout">LOGOUT</a></td>
</tr>
</table>
<center><h1>Results</h1></center>
<c:set var="j" value="0" scope="page"/>
<c:forEach items="book[j]" var="getBook"/>
<textarea name="res" rows="10" cols="255">
</textarea>
</body>
</html>
***************************************************************************
here is part of my bean I do this routine for each variable:
this part works I can get the variables from the database to the screen it is just not layed out the way I want it.
***************************************************************************
public ArrayList<String> getISBN() throws Exception{
Statement statement;
ResultSet isbn;
ArrayList<String> isbnList = new ArrayList<String>();
try{
statement = con.createStatement();
isbn = statement.executeQuery("select ISBN from BOOKS_BOOKS WHERE SUBJECT = 'Architechture'");
while(isbn.next()){
isbnList.add(isbn.getString("ISBN"));
}
}
catch(Exception excep){
throw new Exception(excep);
}//end catch