前提
プログラミング初心者です。
Eclipsecの練習で簡易的なオンラインショッピングが出来るなシステムを作っています。
ログインしているユーザーの購入情報の一覧を表示する機能を実装中に以下のエラーメッセージが発生しました。
実現したいこと
ここに実現したいことを箇条書きで書いてください。
ログインしているユーザーの購入情報の一覧機能を動作するようにする
発生している問題・エラーメッセージ
重大: サーブレット [jsp] のServlet.service()が例外を投げました [木 1 19 15:56:48 JST 2023]
org.apache.jasper.JasperException: [/WEB-INF/jsp/userdata.jsp] の処理中に行番号 [68] で例外が発生しました
該当のソースコード
usredata.jsp <th style="width: 10%"></th> <th class="center">購入日時</th> <th class="center">配送方法</th> <th class="center">購入金額</th> </tr> </thead> <tbody> <tr> <td class="center"><a href="UserBuyHistoryDetail?buy_id=1" class="btn-floating btn waves-effect waves-light "> <i class="material-icons">details</i></a></td> <td class="center">**${buyBDBList. buyDate}**</td> <td class="center">**${buyBDBList.delivertMethodId}**</td> <td class="center">**${buyBDBList.totalPrice}円**</td> </tr> <tr> <td class="center"><a href="UserBuyHistoryDetail?buy_id=2" class="btn-floating btn waves-effect waves-light "> <i class="material-icons">details</i></a></td> <td class="center">${buyBDBList.buyDate}</td> <td class="center">${buyBDBList.delivertMethodId}</td> <td class="center">${buyBDBList.totalPrice}円</td> </tr> UserData.java public class UserData extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // セッション開始 HttpSession session = request.getSession(); try { 中略~ ArrayList<BuyDataBeans> buyBDBList = BuyDAO.getBuyDataBeans(userId); request.setAttribute("buyBDBList", buyBDBList); request.getRequestDispatcher(EcHelper.USER_DATA_PAGE).forward(request,response); 中略~ BuyDAO.java public class BuyDAO { public static ArrayList<BuyDataBeans>getBuyDataBeans(int userId) throws SQLException { Connection con = null; PreparedStatement st = null; try { con = DBManager.getConnection(); st = con.prepareStatement("SELECT * FROM t_buy WHERE user_id = ?"); st.setInt(1, userId); ResultSet rs = st.executeQuery(); ArrayList<BuyDataBeans> buyDetailList = new ArrayList<BuyDataBeans>(); while (rs.next()) { BuyDataBeans bdd = new BuyDataBeans(); bdd.setBuyDate(rs.getTimestamp("create_date")); bdd.setDelivertMethodId(rs.getInt("delivery_method_id")); bdd.setTotalPrice(rs.getInt("total_price")); } return buyDetailList; } catch (SQLException e) { System.out.println(e.getMessage()); throw new SQLException(e); } finally { if (con != null) { con.close(); }
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
あなたの回答
tips
プレビュー