首页 > 其他分享 >后台servlet SideMenuSer

后台servlet SideMenuSer

时间:2023-04-26 15:32:32浏览次数:32  
标签:SideMenuSer javax request public 后台 import servlet response


package cn.service.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.entity.NeUser;
import cn.service.dao.NeUserDao;
import cn.service.dao.impl.NeUserDaoImpl;

public class SideMenuSer extends HttpServlet {
	public SideMenuSer() {
		super();
	}
	public void destroy() {
		super.destroy(); 
	}
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		//接收时设置的编码  
		request.setCharacterEncoding("utf-8");  
		//转发时设置的编码  
		response.setCharacterEncoding("utf-8");  
		//以 超文本格式 方式转发  
		response.setContentType("text/html");  
		//获取了一个输出流  
		PrintWriter out = response.getWriter(); 
		
		//权限,超级管理员和普通管理员的权限
		HttpSession session  = request.getSession();
		String adminName = session.getAttribute("adminName")!= null ?session.getAttribute("adminName").toString():null;
		NeUserDao neUserDao = new NeUserDaoImpl();
		NeUser uList =null;
		if(adminName!=null){
			uList = neUserDao.select(adminName);
		}
		request.setAttribute("uList",uList);
		request.getRequestDispatcher("admin/sideMenu.jsp").forward(request, response);
		
		out.flush();
		out.close();
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}
	public void init() throws ServletException {
	}

}

 

标签:SideMenuSer,javax,request,public,后台,import,servlet,response
From: https://blog.51cto.com/u_16089934/6228048

相关文章

  • Springboot 在linux后台运行的方法
    1、后台运行程序nohupjava-jar自己的springboot项目.jar>日志文件名.log2>&1&命令详解:nohup:不挂断地运行命令,退出帐户之后继续运行相应的进程。>日志文件名.log:是nohup把command的输出重定向到当前目录的指定的“日志文件名.log”文件中,即输出内容不打印到屏幕上,而......
  • Servlet添加自定义的过滤器没有效果?
    在学习HttpServlet的时候有个自定义过滤器的定义类,我们想让特定url走过滤器。publicclassMyFilterimplementsFilter{privateFilterConfigconfig;publicvoidinit(FilterConfigconfig)throwsServletException{this.config=config;}publi......
  • React、Ant Design 5.0 构建通用后台管理系统 - 接口服务环境搭建
    目录项目初始化项目结构package.jsontsconfig.jsonnodemon.jsonindex.tssrc/server.ts运行项目初始化mkdirgeneral-admin-system-servercdgeneral-admin-system-servernpminit-ynpminstalltypescriptts-node@types/nodenodemon@swc/core@swc/helpersregenerator-......
  • 2种方法将exe注册为windows服务,直接从后台运行
    方法1sc命令行创建命令行创建这个方法我遇到了下面的问题,按照网上的方式没有解决,有解决的朋友@一下方法2使用instsrv+srvany什么是instsrv+srvanyinstsrv.exe.exe和srvany.exe是MicrosoftWindowsResourceKits工具集中的两个实用工具,这两个工具配合使用可以将任何的ex......
  • React、Ant Design 5.0 构建通用后台管理系统 - 登录页面
    目录安装依赖main.tsxsrc/styles/global.cssApp.tsxsrc/pages/user/Login/index.tsxsrc/pages/user/Login/style.module.css安装依赖npminstallantd@ant-design/icons@ant-design/pro-componentsAntDesign组件库@ant-design/pro-components封装一些好用的常用组件库mai......
  • 预防数据后台管理的开发
    预防数据后台管理页面在若依自带的组件中是没有上传的组件,我到element中找了对应的组件 通过将其中的代码复制到vue相应的位置,页面中就也显示出这个模型,其中那些中文字,我们可以进行修改。接口的调用就是比较的简单了,直接将上传视频的接口复制到action中去就可以成功的运行起......
  • request getContextPath() getServletPath()[转的]
    项目名zhangyulonghttp://localhost:8080/zhangyulong/main/index.jsprequest.getContextPath()得到:/zhangyulongrequest.getServletPath()得到:/main/index.jsprequest.getRequestURI()得到:/zhangyulong/main/index.jsprequest.getRealPath("/")得到:F:......
  • Servlet技术
    Servlet(ServerApplet)是Java Servlet的简称,称为小服务程序或服务连接器,用Java编写的服务器端程序,具有独立于平台和协议的特性,主要功能在于交互式地浏览和生成数据,生成动态Web内容。Servlet的生命周期Servlet生命周期可被定义为从创建直到毁灭的整个过程。三个步骤即:初始化---......
  • Servlet3无web.xml的原理
    在最新的SpringMVC中,一个web项目中无需传统的web.xml文件,这是怎么实现的呢?其实这并不是SpringMVC的功劳,而是servlet3规范以及web容器对这个规范的支持。简单使用配置引入依赖:.......<!--指定servlet版本为3.0--><dependency><groupId>javax.serv......
  • 2 第一个servlet程序
    在上一篇文章中,我已经创建了一个javaweb的项目,下面,我们来创建第一个servlet程序1第一种方法我们先创建一个包,命名为com.test01(命名不唯一,甚至不创建也没事)在这个包内创建一个类,我这里命名为HelloServlet输入以下代码,会默认生成一些代码,我们在init函数中增加一个输出,方便我......