<%@ page import="com.apz.pirisale.*" %> <%! private static String convertPrice(int pPrice) { return String.valueOf(pPrice / 100); } private static String getRating(int rating) { String ratingLeft, ratingRight; ratingLeft = ""; ratingRight = ""; if (rating == 1) ratingLeft = "*"; if (rating == 2) ratingLeft = "**"; if (rating == 3) ratingLeft = "***"; if (rating == 4) ratingLeft = "****"; if (rating == 5) ratingLeft = "*****"; if (rating == 0) ratingRight = "*****"; if (rating == 1) ratingRight = "****"; if (rating == 2) ratingRight = "***"; if (rating == 3) ratingRight = "**"; if (rating == 4) ratingRight = "*"; return "" + ratingLeft + "" + ratingRight + ""; } %> <% int mPrice = 0; int mNumInStock = 0; long mCatID = 0; String mItemName = ""; String mImagePath = ""; String mDescription = ""; String mSzItemID = request.getParameter("itemID"); Review[] mReview; boolean mActive = (session.getAttribute("active") != null); if (mSzItemID != null) { try { long mItemID = Long.parseLong(mSzItemID); try { Item currentItem = piriSale.getItems().getItem(mItemID); if (currentItem != null) { mItemName = currentItem.getItemName(); mPrice = currentItem.getPrice(); mNumInStock = currentItem.getNumInStock(); mImagePath = currentItem.getImagePath(); mDescription = currentItem.getDescription(); try { mReview = piriSale.getReviews().getReviews(mItemID); } catch(Exception e) { response.sendRedirect("error.jsp?errorText=" + e.toString()); return; } } else { response.sendRedirect("error.jsp?errorText=Cannot find item"); return; } } catch(Exception e) { response.sendRedirect("error.jsp?errorText=" + e.toString()); return; } } catch(NumberFormatException e) { response.sendRedirect("error.jsp?errorText=Item ID is not numeric"); return; } } else { response.sendRedirect("error.jsp?errorText=Parameter not initialsed"); return; } %> <%= mItemName %>
<% for(int i=0; i\r\n"); out.write("\r\n"); } catch(Exception e) { response.sendRedirect("error.jsp?errorText=" + e.toString()); return; } } %>
<%= mItemName %>

Price: £<%= convertPrice(mPrice) %> Num in Stock: <%= mNumInStock %>
Quantity:   
Description
<%= mDescription %>
 
Customers Reviews
 
\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("
Review by " + customerName + "
Rating:" + getRating(mReview[i].getRating()) + "Review:" + mReview[i].getReview() + "
 
Options


Write a review...
More Options...