[英]My textbox message is not being uploaded into database?
我正在创建一个框,我在其中发布job title
以及job description
,它将上传到数据库中,但是我不知道我要去哪里哪里.....
当我提交时说:
HTTP Status 500 - An exception occurred processing JSP page /submit_job_forum.jsp at line 11
这是我的forum.jsp
<div id="forum2">
<h1 style="text-align: center;">Want to post on going walking,<br>Post your job description here.</h1>
<form id="forum2_form" method="post" action="submit_job_forum.jsp">
<p>
<label>Job title:</label>
<input type="text" class="" placeholder="e.g XXX Referral program for freshers." name="job_title"/>
</p>
<p>
<label>Description:</label>
<textarea class="question_ask_style" rows="3" cols="40" placeholder="Type description here.." name="job_description"></textarea>
</p>
<div id="submit_btn">
<input type="submit" value="Submit Question" />
</div>
</form>
</div>
这是我的submit_job_forum.jsp
<%@ page import="java.sql.*" %>
<%
String job_title=request.getParameter("job_title");
String job_description=request.getParameter("job_description");
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:8888/login", "root", "1234");
Statement st=con.createStatement();
ResultSet rs;
rs=st.executeQuery("insert into job_post('id', 'job_title', 'job_description') VALUES (' ', '"+job_title+"', '"+job_description+"')");
response.sendRedirect("forum.jsp");
%>
在这里,我将此表创建到数据库:
create table `job_post`(
`id` int(100) unsigned NOT NULL auto_increment,
`job_title` varchar(100) NOT NULL,
`job_description` varchar(1000) NOT NULL,
PRIMARY KEY(`id`)
)ENGINE= InnoDB default charset=latin1;
请帮忙 :(
注意列名前后的撇号,您应使用此字符(`)或将其省略(只要避免使用保留字)。 对于值,这很好。
rs=st.executeQuery("insert into job_post(`id`, `job_title`, `job_description`)
VALUES (' ', '"+job_title+"', '"+job_description+"')");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.