パラメータを別のページに送信する JSP があります。しかし、他のページはパラメーターを受け入れています。理由はわかりません。
URLからJSPに値を取得する方法は?
URLは -
/ColdStorage/ajaxservlet?occid%20=%203
そして、パラメーターを受け入れる必要がある JSP は -
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, ClassNotFoundException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String sql = "";
PreparedStatement prest ;
ResultSet rs;
HttpSession session = null;
try {
/* TODO output your page here. You may use following sample code. */
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/ColdStorage?zeroDateTimeBehavior=convertToNull", "root", "root");
System.out.println("entering ajaxservlet");
String occid = (String) request.getParameter("occid");
System.out.println("occid = "+occid);
String resid = (String) request.getParameter("resid");
System.out.println("resid = "+resid);
String agrnoid = (String) request.getAttribute("agrno");
System.out.println("agrnoid = "+agrnoid);
List<AcceptBean> list1 = new ArrayList<AcceptBean>();
// List<AcceptBean> list3 = new ArrayList<AcceptBean>();
sql = "select om.OccId,om.FirstName,om.LastName,om.Village,om.SonOf,om.District, rd.ResId,rd.`Date`,"
+ "rd.Weight,rd.Bags,rd.Rate,rd.Amount,rd.advamount,am.agrno,am.lotno,am.`agreeDate`,am.reservid,"
+ "am.weight,am.bags,am.rate,am.amt,am.advamt from OccupantMaster om left outer join user_resdet ud on "
+ "om.OccId = ud.occ_det left outer join ReservationDetails rd on ud.res_det = rd.ResId left outer join "
+ "AgreementMaster am on rd.ResId = am.reservid where occid = ? ";
System.out.println("sql = "+sql);
prest = conn.prepareStatement(sql);
prest.setString(1, occid);
rs = prest.executeQuery();
String agreereservid = "";
String Date = "";
String Weight = "";
String Rate = "";
String Bags = "";
String Amount = "";
String Advance = "";
String regisamount = "";
String regisadvance = "";
String Lotno = "";