Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2008, 06:14 PM
Member
 
Join Date: Mar 2008
Posts: 2
koushika is on a distinguished road
have to make the bookisbn column values as hyperlink to a page name bookinfo.jsp whi
i have a table displayed with bookisbn , booktitle and bookauthor etc..in which i have to make the bookisbn column values as hyperlink to a page name bookinfo.jsp which will diplay all copies of the book under the clicked isbn number .
i am attaching the code below:

*{code viewbooksforsale.info which displays all books in database and has values of isbn column as hyperlinks}*
<?xml version="1.0" encoding ="UTF-8"?>
<%-- file location of the jsp --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Books For Sale</title>
</head>
<body>
<%--debugging code--%>
<%@ include file="debug.jsp" %>
<p><h1 align="center"> ONLINE BOOK TRADING SYSTEM </h1></p>
<p>
<h4 align="center"><c:url var="HmePgeURL" value="/cw/router/home" scope="page"/>
<a href="${HmePgeURL}">Home</a>&nbsp;&nbsp;<c:url var="BSPgeURL" value="/cw/router/login" scope="page"/>
<a href="${BSPgeURL}">Buy or Sell</a>&nbsp;&nbsp;<c:url var="UregPgeURL" value="/cw/router/userregistration" scope="page"/>
<a href="${UregPgeURL}">User Registration</a></h4>
</p>
<%-- check for database Error --%>
<c:if test="${!empty requestScope.reqQueryErrorMessage}" var="pgeDatabaseError" scope="page"> Database Error </c:if>
<%-- check for empty item table --%>
<c:if test="${not pgeDatabaseError}">
<c:if test="${booksFromQuery.rowCount == 0}" var= "pgeEmptyTable" scope="page" >
There Are No Items In The Table
</c:if>
</c:if>
<p align="center" ><strong>Books For Sale !</strong></p><div align="center">
<%-- Display Books --%>
<c:if test="${not pgeDatabaseError and not pgeEmptyTable}">
<table border="1" align="center" cellpadding="2" cellspacing="0" width ="984">
<tr bgcolor="#66CCFF">
<td width="15"><div align="center" >
<div align="center"><strong>ISBN</strong></div>
</div></td>
<td width="268"><div align="center" >
<div align="center"><strong>Title</strong></div>
</div></td>
<td width="198"><div align="center" >
<div align="center"><strong>Author</strong></div>
</div></td>
<td width="10"><div align="center" >
<div align="center"><strong>Price</strong></div>
</div></td>
<td width="15"><div align="center" >
<div align="center"><strong>Condition</strong></div>
</div></td>
<td width="15"><div align="center" >
<div align="center"><strong>Status</strong></div>
</div></td>
</tr>
<c:forEach items="${booksFromQuery.rows}" var="myRow">
<tr><c:url var="BookInfoPgeURL" value="/cw/router/viewbookinfo" scope="page"/>
<td width="15"><div align="center" ><a href= "$BookInfoPgeURL" onclick="afadf">${myRow.dbItemISBN}</a></div></td>
<c:set var="ISBNselected" value="${myRow.dbItemISBN}" scope="request" />
<td width="268"><div align="center">${myRow.dbItemTitle}</div></td>
<td width="198"><div align="center">${myRow.dbItemAuthor}</div></td>
<td width="10"><div align="center">${myRow.dbItemPrice}</div></td>
<td width="15"><div align="center">${myRow.dbItemCondition}</div></td>
<td width="15"><div align="center">${myRow.dbItemStatus}</div></td>
</tr>
</c:forEach>
</table>
</c:if>
</div>
<%-- debugging code --%>
<%-- for local page-scoped objects --%>
<c:if test="${sessDebug == 'true'}">
<table border="1">
<c:forEach var="item" items="${pageScope}">
<tr>
<td>pageScope object</td>
<td>${item.key}</td>
<td>${item.value}</td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
*{code}*


*{code viewbookinfo.jsp generated view once a user selects an isbn number in viewbookforsales.jsp } *
<?xml version="1.0" encoding ="UTF-8"?>
<%-- file location of the jsp --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BOOK INFO</title>
</head>

<body>
<div align="center"><c:url var="HmePgeURL" value="/cw/router/home" scope="page"/><a href="${HmePgeURL}">Home</a>&nbsp;&nbsp;<c:url var="BSPgeURL" value="/cw/router/login" scope="page"/>
<a href="${BSPgeURL}">Buy or Sell</a>&nbsp;&nbsp;<c:url var="UregPgeURL" value="/cw/router/userregistration" scope="page"/>
<c:url var='pgeviewbooksURL' value='/cw/router/viewbooksforsale' scope='page'/><a href="${pgeviewbooksURL}">Online Book Sale</a>
</div>
<%-- check for database Error --%>
<c:if test="${!empty requestScope.reqQueryErrorMessage}" var="pgeDatabaseError" scope="page"> Database Error </c:if>
<%-- check for empty item table --%>
<c:if test="${not pgeDatabaseError}">
<c:if test="${booksinfoFromQuery.rowCount == 0}" var= "pgeEmptyTable" scope="page" >
There Are No Items In The Table
</c:if>
</c:if>
<%-- display book info --%>
<c:if test= "${not pgeDatabaseError and not pgeEmptyTable}">
<p align="center">&nbsp;</p>
<div align="center">
<table width="359" cellpadding="5">
<tr>
<td width="187"><label>COPIES AVAILABLE</label>&nbsp;</td>
<td width="144"><input name="textfield" type="text" value="${fn:length(items}" /></td>
</tr>
</table>
</div>
<c:forEach items="${booksinfoFromQuery.rows}" var="myRow">
<p align="center">&nbsp;</p>
<div align="center">
<table width="671" cellpadding="5">
<tr>
<td>ITEM ID </td>
<td><input type="text" name="textfield" value="${myRow.dbItemId}"/></td>
</tr>
<tr>
<td width="209"><label>ISBN</label>&nbsp;</td>
<td width="434"><input type="text" name="textfield" value="${myRow.dbItemISBN} "/></td>
</tr>
<tr>
<td><label>TITLE</label>&nbsp;</td>
<td><input name="text" type="text" value="${myRow.dbItemTitle}" /></td>
</tr>
<tr>
<td><label>AUTHOR</label>&nbsp;</td>
<td><input name="textarea" type="text" value="${myRow.dbItemAuthor}" /></td>
</tr>
<tr>
<td><label>BOOK INFO </label>&nbsp;</td>
<td><input name="textarea" type="text" value="${myRow.dbItemInfo}" /></td>
</tr>
<tr>
<td><label>CONDITION</label>&nbsp;</td>
<td><input type="text" name="textfield" value="${myRow.dbItemCondition} " /></td>
</tr>
<tr>
<td><label>STATUS</label>&nbsp;</td>
<td><input type="text" name="textfield" value="${myRow.dbItemStatus}"/></td>
</tr>
<tr>
<td><label>PRICE</label>&nbsp;</td>
<td><input type="text" name="textfield" value="${myRow.dbItemPrice}"/></td>
</tr>
<hr />
</table>
</div>
</c:forEach>
</c:if>
*{code}*

*{code probookinfo.jsp -- process jsp file for viewbookinfo.jsp}*
<?xml version="1.0" encoding ="UTF-8"?>
<%-- \WEB-INF\jsp\cwjsps\probookinfo.jsp --%>
<%-- Probookinfo --%>
<%-- file location of the jsp --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%-- execute the query --%>
<c:catch var="pgeQueryError">
<sql:query var="booksinfoFromQuery" scope="request">
SELECT dbItemId,dbItemInfo,dbItemISBN,dbItemTitle,dbItemA uthor,dbItemPrice,dbItemCondition,dbItemStatus FROM item WHERE dbItemISBN ="${ISBNselected}"
</sql:query>
</c:catch>

<%-- check query error --%>
<c:choose>
<c:when test="${not empty pgeQueryError}">
<%-- Database Error --%>
<c:set var="reqOutcome" scope="session" value="failure" />
<c:set var="reqQueryErrorMessage" scope="request" value="${pgeQueryError.message}" />
<jsp:forward page="/WEB-INF/jsp/cwjsps/test.jsp"/>
</c:when>
<ctherwise>
<c:set var="reqOutcome" scope="session" value="success" />
</ctherwise>
</c:choose>
<jsp:forward page="/WEB-INF/jsp/cwjsps/viewbookinfo.jsp"/> <%-- display book info --%>
<%-- display trader own page after login --%>


*{code}*
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to update MYSQL with values from jsp page koushika JavaServer Pages (JSP) and JSTL 0 03-27-2008 03:35 AM
How to make a hashmap to allow duplicate values? Preethi New To Java 0 02-08-2008 02:35 PM
passing values from main page to pop up window vicky JavaServer Pages (JSP) and JSTL 2 01-18-2008 01:24 PM
insert row and column and delete row and column daredavil82 New To Java 7 11-30-2007 12:32 PM
Hide hyperlink address on status bar simon JavaServer Pages (JSP) and JSTL 2 07-24-2007 12:34 PM


All times are GMT +3. The time now is 04:57 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org