SSM重新开发计科院网站

SSM重新开发计科院网站

 

复制代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


  
    
    
    西南石油大学-计算机科学学院
    
    
     
    
  
  




welcome
Copyright© 2018 All Rights Reserved. 西南石油大学计算机科学学院
index.jsp
复制代码





登录








请使用工作账号进行登陆
登录名:

登录密码:忘记登录密码?










新闻后台    厦门石脉科技


2015 Stonechat.com版权所有ICP证:鹭B2-22000000





login.html

login.html

复制代码




登录





请使用工作账号进行登陆 登录名: 登录密码:忘记登录密码?

新闻后台    厦门石脉科技

2015 Stonechat.com版权所有ICP证:鹭B2-22000000

login.html
复制代码

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>





新闻管理





新闻管理






































ID 新闻名 操作
${sessionScope.Imagenews0ID} ${sessionScope.Imagenews0Name}





${sessionScope.Imagenews1ID} ${sessionScope.Imagenews1Name}





${sessionScope.Imagenews2ID} ${sessionScope.Imagenews2Name}





${sessionScope.Imagenews3ID} ${sessionScope.Imagenews3Name}





${sessionScope.Imagenews4ID} ${sessionScope.Imagenews4Name}





${sessionScope.Imagenews5ID} ${sessionScope.Imagenews5Name}








MyJsp.jsp

MyJsp.jsp

复制代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>





新闻管理



  

新闻管理


ID 新闻名 操作
${sessionScope.Imagenews0ID} ${sessionScope.Imagenews0Name}
${sessionScope.Imagenews1ID} ${sessionScope.Imagenews1Name}
${sessionScope.Imagenews2ID} ${sessionScope.Imagenews2Name}
${sessionScope.Imagenews3ID} ${sessionScope.Imagenews3Name}
${sessionScope.Imagenews4ID} ${sessionScope.Imagenews4Name}
${sessionScope.Imagenews5ID} ${sessionScope.Imagenews5Name}
MyJsp.jsp
复制代码

package com.b;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.a.DBHelper;
import com.a.NewsInfo;

@WebServlet("/Select")
public class Select extends HttpServlet {

/**
* The doGet method of the servlet.

*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//设置请求和响应的字符集编码
response.setContentType("text/html; charset=UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter(); //获得输出流

/*
//数据库连接
DBHelper dbhelper=new DBHelper();
dbhelper.connect();
//执行6次查询
String[] newstime=new String[]{"imagenews","academicexchange","newsnow","partyactive","notice","spetiallist"};
for(int time=0;time String sql="select * from "+newstime[time];
dbhelper.select(sql);
List newsall=dbhelper.myselect();

for(int i=0;i NewsInfo Imagenews = newsall.get(i);
request.getSession().setAttribute(newstime[time]+i+"ID", Imagenews.getId());
request.getSession().setAttribute(newstime[time]+i+"Name", Imagenews.getName());
}
}
*/

for(int q=0;q<6;q++){
if(null!=request.getSession().getAttribute("Imagenews"+q+"ID")){
request.getSession().removeAttribute("Imagenews"+q+"ID");
request.getSession().removeAttribute("Imagenews"+q+"Name");
}
}


DBHelper dbhelper=new DBHelper();
dbhelper.connect();
String sql="select * from imagenews";
dbhelper.select(sql);

List newsall=dbhelper.myselect();
for(int i=0;i NewsInfo Imagenews = newsall.get(i);
request.getSession().setAttribute("Imagenews"+i+"ID", Imagenews.getId());
request.getSession().setAttribute("Imagenews"+i+"Name", Imagenews.getName());
}

dbhelper.close();

response.sendRedirect("index.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}

}

Select.java
Select.java

复制代码
package com.b;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.a.DBHelper;
import com.a.NewsInfo;

@WebServlet("/Select")
public class Select extends HttpServlet {

    /**
         * The doGet method of the servlet. 
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //设置请求和响应的字符集编码 response.setContentType("text/html; charset=UTF-8"); request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); //获得输出流 /* //数据库连接 DBHelper dbhelper=new DBHelper(); dbhelper.connect(); //执行6次查询 String[] newstime=new String[]{"imagenews","academicexchange","newsnow","partyactive","notice","spetiallist"}; for(int time=0;time newsall=dbhelper.myselect(); for(int i=0;i newsall=dbhelper.myselect(); for(int i=0;i
复制代码

 

 
 
 

你可能感兴趣的:(SSM重新开发计科院网站)