1
我创建一个盒子,我张贴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;
请帮助:(
为什么你不在JSP中使用一些异常处理来检查可能的异常? – RE350 2014-11-05 08:22:33