相关疑难解决方法(0)

如何从Servlet 2.5中的ServletRequest获取Servlet上下文?

我正在使用使用Servlet 2.5的Tomcat 6.ServletRequestAPI 中的Servlet 3.0中提供了一种方法,该方法为ServletContext与之关联的对象提供了句柄ServletRequest.有没有办法ServletContextServletRequest使用Servlet 2.5 API 获取对象?

servlets

44
推荐指数
1
解决办法
7万
查看次数

jsp getServletContext()错误

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Murach's Java Servlets and JSP</title>
</head>

<body>
    <%-- import packages and classes needed by the scripts --%>
    <%@ page import="business.*, data.*" %>

    <%
        //get parameters from the request
        String firstName = request.getParameter("firstName");
        String lastName = request.getParameter("lastName");
        String emailAddress = request.getParameter("emailAddress");

        // get the real path for the EmailList.txt file
        ServletContext sc = this.getServletContext();
        String path = sc.getRealPath("/WEB-INF/EmailList.txt");

        // use regular Java objects
        User …
Run Code Online (Sandbox Code Playgroud)

jsp servlets weblogic

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

servlets ×2

jsp ×1

weblogic ×1