webevaluator
Posts: 4
|
Posted: 10/19/2006, 9:03 AM |
|
Hi Folks,
I've downloaded Online Bookstore Application (JSP with templates) from gotocode.com(http://gotocode.com/apps.asp?app_id=3&). As mentioned in the Readme-JSP.txt file (which is in the zip file), I am trying to configure my ODBC connection. But, i guess, i made some mistake somewhere. The application is not working properly.
Whenever, i try to add books to the shopping cart, (by clicking 'Add to Shopping Cart' button), I am getting a page cannot be displayed message after which i am not even able to browse through other pages. I've to stop the tomcat server and restart it again to view the pages. But, after that page can't be displayed message and restart of the Tomcat server (Version 5.5.9), the book would be available in the shopping cart. (So, it looks like, it is adding to the shopping cart(database), but showing an error message).
Also, if i try to edit the Member information (Administration --> Members --> [Click on the Member Name] --> [You would be taken to the Member Infomation page] -- again click, the member name --> Now, if you click 'Cancel' or 'Update' , you are getting 'the page cannot be displayed error message'.
Please help me in fixing this problem, since i'm depending a lot on this web application. It means a lot to me.
Some of my other questions are...
1. Should i create a ODBC connection in 'User DSN' or 'System DSN' tab ?
2. I could see couple of driver names. One is 'Driver do Microsoft Access (*.mdb) and the other one is 'Microsoft Access driver (*.mdb)'. Which is the driver i should use?
Please let me know if I'm missing some procedure. I've to get this project up and running. Any help is greatly appreciated from the bottom of my heart. Sorry for making a larger post.
Thanks,
Web Evaluator
|
|
|
peterr
Posts: 5971
|
Posted: 10/19/2006, 11:12 AM |
|
You would need to crate a System DSN, while the driver shouldn't matter. I'd try 'Microsoft Access driver (*.mdb)' .
However, that Bookstore Application is outdated and it may be easier for you to download CodeCharge Studio ( http://www.yessoftware.com/products/product_detail.php?product_id=1 ), which includes a similar Bookstore Application. You'd also be able to select one of several database types, and modify and extend the application because currently it doesn't include integration with a payment system.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
webevaluator
Posts: 4
|
Posted: 10/19/2006, 1:23 PM |
|
Hi Peter,
Thanks a lot for your quick response. I'm really excited to see a reply to my post immediately. Yes, as you said, I'm using System DSN and Microsoft Access Driver. But, still that application is not working properly. Why am i not able to add books to the shopping cart? (It actually adds, but throwing an exception). If i stop and start the server, i would be able to see the book in the shopping cart.
Also, thanks for your suggestion about the latest product. I would try that one too.... But, i am more interested in making this to work as i've committed myself in doing this. I am even ready to buy this application if this error cannot be fixed / if it's available for purchase.
Your time and support are truly appreciated.
Following is the error message that I'm getting.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: For input string: ""
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:489)
java.lang.Integer.parseInt(Integer.java:518)
org.apache.jsp.Bookstore.BookDetail_jsp.Rating_Show(org.apache.jsp.Bookstore.BookDetail_jsp:1205)
org.apache.jsp.Bookstore.BookDetail_jsp._jspService(org.apache.jsp.Bookstore.BookDetail_jsp:1405)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
|
|
|
matheus
Posts: 386
|
Posted: 10/19/2006, 1:27 PM |
|
Have some int value equals "" and then give NumberFormat exception.
Quote :
java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:489)
java.lang.Integer.parseInt(Integer.java:518)
org.apache.jsp.Bookstore.BookDetail_jsp.Rating_Show(org.apache.jsp.Bookstore.BookDetail_jsp:1205)
Look at Bookstore.BookDetail. method Rating Show.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
webevaluator
Posts: 4
|
Posted: 10/19/2006, 2:00 PM |
|
Hi Matheus,
Thanks for the help. I should have mentioned this before. It was my fault. I'm not a computer programmer. I am just started to learn now. Though i looked in to the code as you suggested, don't know where the mistake is. Would you please help me in that ?
Here's the part of the code in that file....
void Rating_Show( javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpSession session, javax.servlet.jsp.JspWriter out, String sForm, String sAction, java.sql.Connection conn, java.sql.Statement stat, TextTemplate oTpl) throws java.io.IOException {
sAction = getParam(request, "FormAction", Text_TYPE);
sForm = getParam(request, "FormName", Text_TYPE);
java.util.Hashtable rsHash = new java.util.Hashtable();
String sWhere = "";
String transitParams = "";
String requiredParams = "";
String primaryKeyParams ="";
String pitem_id = "";
String flditem_id="";
String fldrating="";
String fldrating_count="";
String fldrating_view="";
String fldrating_count_view="";
boolean bPK = true;
if ( "".equals((String) session.getAttribute("sRatingErr"))) {
// Load primary key and form parameters
flditem_id = getParam( request, "item_id");
oTpl.setVar ("Trn_item_id", getParam( request, "item_id"));
pitem_id = getParam( request, "item_id");
oTpl.setVar ("RatingError", "");
}
else {
// Load primary key, form parameters and form fields
flditem_id = getParam(request,"item_id");
fldrating = getParam(request,"rating");
fldrating_count = getParam(request,"rating_count");
oTpl.setVar("Trn_item_id", getParam(request,"Trn_item_id"));
pitem_id = getParam(request,"PK_item_id");;;
oTpl.setVar ("sRatingErr", (String) session.getAttribute("sRatingErr"));
oTpl.parse ("RatingError", false);
}
if ( isEmpty(pitem_id) ) { bPK = false; }
sWhere = sWhere + "item_id=" + toSQL(pitem_id, Number_TYPE);
oTpl.setVar ("PK_item_id", pitem_id);
java.sql.ResultSet rs = null;
String sSQL = "select * from items where " + sWhere;
if (bPK && ! (sAction.equals("insert") && "Rating".equals(sForm) )) {
try {
// Open recordset
rs = openrs ( stat, sSQL);
rs.next();
String[] aFields = getFieldsName( rs );
getRecordToHash( rs, rsHash, aFields );
rs.close();
flditem_id = (String) rsHash.get("item_id");
fldrating_view = (String) rsHash.get("rating");
fldrating_count_view = (String) rsHash.get("rating_count");
fldrating_count = (String) rsHash.get("rating_count");
if ( "".equals((String) session.getAttribute("sRatingErr"))) {
// Load data from recordset when form displayed first time
fldrating = (String) rsHash.get("rating");
}
}
catch(java.sql.SQLException e){out.print("SQL :"+ sSQL+"<br>"+e);};
oTpl.setVar ("RatingDelete", "");
oTpl.setVar ("RatingInsert", "");
oTpl.parse ("RatingEdit", false);
}
else {
if ( "".equals((String) session.getAttribute("sRatingErr"))) {
flditem_id = toHTML(getParam( request, "item_id"));
}
oTpl.setVar ("RatingEdit", "");
oTpl.setVar ("RatingInsert", "");
}
oTpl.setVar ("RatingCancel", "");
if ("".equals(((String) session.getAttribute("sRatingErr")))){
if (fldrating_view.equals("0"))
{
fldrating_view = "Not rated yet";
fldrating_count_view = "";
}
else
{
fldrating_view = "<img src=\"images/" + java.lang.Math.round(java.lang.Integer.parseInt(fldrating)/java.lang.Integer.parseInt(fldrating_count)) + "stars.gif\">";
}
}
// Show form field
oTpl.setVar ("item_id", toHTML(flditem_id));
oTpl.setVar ("rating_view", fldrating_view);
oTpl.setVar ("rating_count_view", toHTML(fldrating_count_view));getOptionsLOV("1;Deficient;2;Regular;3;Good;4;Very Good;5;Excellent",false,true,fldrating,"LBrating",oTpl);oTpl.setVar ("rating_count", toHTML(fldrating_count));
oTpl.parse ("FormRating", false);
}
Thanks a lot for your help!
|
|
|
|