为了账号安全,请及时绑定邮箱和手机立即绑定

跪求大神幫解多個下拉選單傳值給mysql的使用錯誤的request.getParameter

跪求大神幫解多個下拉選單傳值給mysql的使用錯誤的request.getParameter

qq_詁詁木_0 2019-04-05 18:22:10
想把下拉选单传送给mysql但是一值报错请大神帮忙解决====================================String Channel = request.getParameter(“Channel”);String WEEkDate = request.getParameter(“WeekDate”);String [] hobby = request.getRequestDispatcher(Channel,WEEkDate);<<<这里错误=================================================想询问一下要怎样才能接收String Channel follow String WEEkDate让 hobby接收下面是  jsp 上的代碼  ======================================<form method="post" action="vfvf.jsp"> <table width=500 align=center> <tr><td align = center>商家:<select name =“Channel”><option value =“上海商家”>上海商家<option value =“京东网店”>京东网店<td align = center>周: <select name="WeekDate"> <option value="0304">0304 <option value="0305">0305 <option value="0401">0401 <option value="0403">0403 </select> <input type="submit" value="ok"> </table> </form> <hr> <% request.setCharacterEncoding("utf-8"); String   Channel  = request.getParameter("Channel") ; String   WEEkDate = request.getParameter("WeekDate") ; String[] hobby = request.getRequestDispatcher(Channel,WEEkDate);     <<<这里错误 ResultSet rs = Songlist1.ktvChannelWeekDate(Channel ,WEEkDate);================================================ java接收内容 ========================== public static ResultSet ktvChannelWeekDate(String Channel,String WEEkDate) { String url="jdbc:mysql://localhost:3306/billboard?useUnicode=true&characterEncoding=utf-8"; String user="root"; String password="1234"; String sql="select * from ktvview where Channel='"+Channel+"'amd  WeekDate='"+WEEkDate+"'  order by id";ResultSet rs=null; try {   Class.forName("com.mysql.jdbc.Driver");     Connection conn=DriverManager.getConnection(url, user, password);       Statement st=conn.createStatement();rs=st.executeQuery(sql);   } catch (ClassNotFoundException ex) {     System.out.println("no driver");   }catch(SQLException e)   {      System.out.println("no connection");      }      return rs;      }
查看完整描述

1 回答

?
Abby_lrwei

TA贡献1条经验 获得超0个赞

第三行代码的标点符号是中文的,我复制到notepad看是这样的,不知道是您写错了还是复制过来慕课系统做了转换

查看完整回答
反对 回复 2019-04-06
  • 1 回答
  • 0 关注
  • 520 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信