Hello I have couple of
servlets doing different actions. I also use session to setAttribute/getAttribute between
jsp and servlets.
The logic is like this:
login.jsp calls Login servlet - if ok redirect to accountInfo.jsp
accountInfo.jsp allow user to deposit amount (a double) if it is 0
accountInfo.jsp calls Deposit servlet - if ok redirect to accountInfo.jsp showing the updated amount
I got the login.jsp -> Login servlet -> accountInfo.jsp working. In accountInfo.jsp I don't seem to get the updated amount to setAttribute to the session.
The logic of Deposit servlet is like this:
1) getSession()
2) update db value
3) rs the new updated value
4) session.setAttribute the rs.getDouble() -> this is the problem
5) redirect to accountInfo.jsp
Deposit servlet
accountInfo.jsp
java.sql.SQLException at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:815) at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5528) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448) at com.mysql.jdbc.ResultSetImpl.getDoubleInternal(ResultSetImpl.java:2382) at com.mysql.jdbc.ResultSetImpl.getDouble(ResultSetImpl.java:2343) at com.mysql.jdbc.ResultSetImpl.getDouble(ResultSetImpl.java:2361) at trade.Deposit.doPost(Deposit.java:60) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at ...
What am I doing wrong? Thanks.