当前位置: 代码迷 >> Java Web开发 >> 异常:The method getParemeter(String) is undefined for the type HttpServletRequest
  详细解决方案

异常:The method getParemeter(String) is undefined for the type HttpServletRequest

热度:1405   发布时间:2016-04-17 11:11:51.0
错误:The method getParemeter(String) is undefined for the type HttpServletRequest
(1)功能:采用JSP + Servlet 实现网络磁盘
(2)Servlet、JSP调用关系:
  DiskServlet.java 显示跟磁盘目录
  DirServlet.java 显示该目录下得文件以及文件夹
  ReadServlet.java 读取文件中的内容
   
  create.jsp 创建新文件/文件夹 输入页面
  WriteServlet.java 创建新的文件/文件夹
(3)问题:
在DirServlet.java中有创建文件的链接:
  out.println("[<a href='create.jsp?path=" + file.getAbsolutePath() + "'>" + "创建文件/文件夹</a>]");
  //file.getAbsolutePath()为取得当前的目录
在create.jsp中读取传入的path参数

  <%
  request.setCharacterEncoding("utf-8");
  String path = request.getParemeter("path");
  %>

在MyEclipse8.5、Tomcat_6.0.35部署好之后访问“创建文件的链接”(即create.jsp) 报错:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /create.jsp
The method getParemeter(String) is undefined for the type HttpServletRequest
2: 
3: <%
4: request.setCharacterEncoding("utf-8");
5: String path = request.getParemeter("path");
6: %>
7: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8: <html>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


request对象的getParameter(String)方法没有定义呢?该如何解决呢?


------解决方案--------------------
Java code
String path = request.getParemeter("path");
代码迷推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.daimami.com/search?q=2308
  相关解决方案