Servlet及Jsp
来源:互联网 发布:sql注入攻击方式 编辑:程序博客网 时间:2024/05/22 11:56
public class LoginServlet extends HttpServlet{
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
commonDo(req, resp);
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
commonDo(req, resp);
}
public void commonDo(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {HttpSession session = request.getSession();
String url = (String) request.getParameter("url");
session.setAttribute("url", url);
response.sendRedirect("showServletContext.jsp");
}
图片显示
<img border="0" src="<%=session.getAttribute("url") %>" width="200" height="250">
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>xiayu.servlet.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
访问
http://localhost:7001/xyServlet/login?url=F:\\nm2.jpg
- Servlet及Jsp
- Servlet及JSP配置详解
- Servlet及JSP配置详解
- jsp及Servlet面试题
- jsp及Servlet面试题
- jsp/servlet及相关技术
- JSP/Servlet 及相关笔记
- servlet及jsp面试题
- Servlet及JSP中的多线程同步问题
- Servlet及JSP中的多线程同步问题
- J2EE/Servlet/JSP问题及相关知识
- Servlet及JSP中的多线程同步问题
- Servlet及JSP中的多线程同步问题
- Servlet及JSP中的多线程同步问题
- Servlet及JSP中的多线程同步问题
- servlet及jsp中多线程同步
- Servlet及JSP中的多线程同步问题
- Servlet及JSP中的多线程同步问题
- ios7 状态栏
- cv::Mat与iplimage类型如何进行互相转换
- C++ AMP: 基于代码的 C++ AMP 简介
- C#对ini文件的读写操作
- 批处理读取文件
- Servlet及Jsp
- java.lang.NoClassDefFoundError:org/bouncycastle/jce/provider/BouncyCastleProvider
- 字符串消除
- 2013年9月——《被污染的标准》
- 【润乾V5】数据预警
- C语言基础之宏定义##连接符和#符
- 堆排序 C++实现
- 表单的写法
- java语句