📄 ubbupdatearticle.java
字号:
package ntsky.admin.article;
import java.sql.*;
import javax.servlet.http.*;
import ntsky.database.*;
import ntsky.common.*;
public class UBBUpdateArticle{
private int articleid;
private int column;
private int kind;
private int radio;
private String title = null;
private String content = null;
private String connection = null;
private String author = null;
private String editor = null;
private String articlefrom = null;
private int top;
private int getcolumn;
//文章编号
public int getarticleid(HttpServletRequest request, String Sarticleid){
try{
articleid = Integer.parseInt(request.getParameter(Sarticleid).trim());
}
catch(Exception e){
System.out.println("delcolumn"+e.getMessage());
}
return articleid;
}
public int articleid(int articleid){
this.articleid = articleid;
return this.articleid;
}
//栏目
public int column(int column){
this.column = column;
return this.column;
}
//类别
public int kind(int kind){
this.kind = kind;
return this.kind;
}
//按扭
public int radio(int radio){
this.radio = radio;
return this.radio;
}
//标题
public String title(String title){
this.title = CodeFilter.toHtml(title);
return this.title;
}
//文章内容
public String content(String content){
this.content = CodeFilter.toHtml(content);
return this.content;
}
//相关文章
public String connection(String connection){
this.connection = CodeFilter.toHtml(connection);
return this.connection;
}
//作者
public String author(String author){
this.author = CodeFilter.toHtml(author);
return this.author;
}
//编辑
public String editor(String editor){
this.editor = CodeFilter.toHtml(editor);
return this.editor;
}
//出处
public String articlefrom(String articlefrom){
this.articlefrom = CodeFilter.toHtml(articlefrom);
return this.articlefrom;
}
//置顶
public int top(String strtop){
if(strtop == null){
strtop = "0";
top = Integer.parseInt(strtop);
return top;
}
else{
strtop = "1";
top = Integer.parseInt(strtop);
return top;
}
}
/**
*更新数据
*/
//类别匹配
public int getColumn() throws Exception{
String sql = "select classid from kind where id=?;";
DBConnect dbc = new DBConnect(sql);
dbc.setInt(1,kind);
ResultSet rs = dbc.executeQuery();
rs.next();
getcolumn = rs.getInt("classid");
rs.close();
rs = null;
return getcolumn;
}
public void insertArticle(){
String sql = "update article set classid=?,id=?,myorothers=?,title=?,content=?,connection=?,author=?,editor=?,articlefrom=?,top=? where articleid=?;";
try{
DBConnect dbc = new DBConnect(sql);
dbc.setInt(1,column);
dbc.setInt(2,kind);
dbc.setInt(3,radio);
dbc.setString(4,title);
dbc.setString(5,content);
dbc.setString(6,connection);
dbc.setString(7,author);
dbc.setString(8,editor);
dbc.setString(9,articlefrom);
dbc.setInt(10,top);
dbc.setInt(11,articleid);
dbc.executeUpdate();
}
catch(Exception e){
System.out.println("updateArticle" + e.getMessage());
}
}
//跳转
public void backarticle(HttpServletResponse response, String url){
try{
response.sendRedirect(url);
}
catch(Exception e){
System.out.println("delcolumn"+e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -