news_edit2.jsp

来自「此小软件实现了小型超市的进销存系统,它展示了小型超市的进货和销售,还有库存的各种」· JSP 代码 · 共 26 行

JSP
26
字号
<%@ page contentType="text/html; charset=gb2312"  %>

<jsp:useBean id="DBConn" scope="page" class="jspeshop.DBConn"/>
<%@ page import="java.sql.*" %>
<%
if (session.getAttribute("name") == null) {
    response.sendRedirect("index.jsp");
  }else {
  request.setCharacterEncoding("GB2312");
  String newsid =request.getParameter("newsid");
  String title=request.getParameter("title");
  String body=request.getParameter("body1");
  Connection con=DBConn.GetConn();

  Statement st=con.createStatement();
  String sql="Update  News  set NEWS_TITLE='"+title+"',NEWS_BODY='"+body+"' where NEWS_ID="+newsid+"";
  System.out.println(sql);
 
 int i= st.executeUpdate(sql);
if (i>0){
response.sendRedirect("newschk.jsp");
}

  }
 %>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?