after I insert an article, the database is empthy.... I don't understand why it was working at until I decide to add another field.
I have 3 files which they are
submitart.jsp
Submit Article
<!--
body {
background-color: #FFFFFF;
}
.menu-text {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 17px;
}
.link-text {font-size: 13px}
.search-box {
border: 1px solid #333333;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
color: #333333;
background-color: #FFFFFF;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.style1 {color: #FFFFFF}
a:link {
color: #333333;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #333333;
}
a:hover {
text-decoration: none;
color: #333333;
}
a:active {
text-decoration: none;
color: #333333;
}
-->
<!-- ImageReady Slices (Untitled-1) -->
[Home] [Contact Us] [About Us] [RSS]
- My Account
- Modify
- Delete
- Forgot Password
- Logout
Article Title
Author Name
Article Description:
Article Text:
Select Category:
<%=cat%>
Design Created By
DansTuts.com
<!-- End ImageReady Slices -->
the next file is
submitaction.jsp
<%
//Get Category_Name
PreparedStatement statement;
//insert article when all the fields are fill it up
if (paramProd){
//insert the new article here
try{
statement = con.prepareStatement("insert into articles (Category_Name, article_title, article_desc, User_ID, Article_text,) values(?,?,?,?,?)");
statement.setString(1,Category_Name);
statement.setString(2,article_title);
statement.setString(3,article_desc);
statement.setString(4,User_ID);
statement.setString(5,Article_text);
statement.executeUpdate();
}catch(Exception e){
System.out.println("here i am");
e.printStackTrace();
}
/** Item Insert it **/
}
%>
Process Submit Article
<!--
body {
background-color: #FFFFFF;
}
.menu-text {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 17px;
}
.link-text {font-size: 13px}
.search-box {
border: 1px solid #333333;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
color: #333333;
background-color: #FFFFFF;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.style1 {color: #FFFFFF}
a:link {
color: #333333;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #333333;
}
a:hover {
text-decoration: none;
color: #333333;
}
a:active {
text-decoration: none;
color: #333333;
}
-->
<!-- ImageReady Slices (Untitled-1) -->
[Home] [Contact Us] [About Us] [RSS]
- My Account
- Modify
- Delete
- Forgot Password
- Logout
<!-- Display the last article inserted OK -->
The article was inserted in the database OK
Please try again
Design Created By
DansTuts.com
<!-- End ImageReady Slices -->
and the last one is validate.jsp
<%
int article_id = 0;
String Category_Name = null;
String article_title = null;
String article_desc = null;
String User_ID = null;
String Article_text = null;
try
{
article_id = 0;
Category_Name = request.getParameter("Category_Name");
article_title = request.getParameter("article_title");
article_desc = request.getParameter("article_desc");
User_ID = request.getParameter("User_ID");
Article_text = request.getParameter("Article_text");
System.out.println("lll here ==== "+Category_Name);
}
catch(Exception e)
{
e.printStackTrace();
}
// assume invalid
boolean paramProd = false;
if (article_title != null )
{
// setvalid
paramProd = true;
}
%>
can any one help me here pls..........