common.jsp
内容如下:<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
   String appPath = request.getContextPath();
%>
为什么会提示 错误:
         Multiple annotations found at this line:
- String cannot be resolved to a type
- The method getContextPath() from the type HttpServletRequest refers to the missing type String

解决方案 »

  1.   

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    中加入
    <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      

  2.   

    to:1楼,加入import="java.util.*"  和楼主的问题应该没有关系吧,util不是常用类吗?
      

  3.   

    查查你jsp的jdk是不是配置正确
      

  4.   

    谢谢  5楼 真的是jdk 没配好 结贴 给分 呵呵 
      

  5.   

    tring appPath = (String)request.getContextPath(); 
    娃阿 没转换的哦
      

  6.   

    是配置的jdk版本不对,重新配置一下你的jdk或是jre版本
      

  7.   

    (1)右击工程->Build Path->Configure Build Path->Libraries,双击JRE System Library,如果出现红叉,表示没有选择JRE,这是需要选中对应的JDK,里面包括JRE。这样就OK了。 
    (2)如果在jsp页面仍然报错,则需要检查:window->preferences->java->Installed JREs,选择与(1)相同的jdk。另外window->java->compiler的jdk也要保持一致。详见:http://liugang-ok.iteye.com/admin/blogs/1397478
      

  8.   

    根据一楼的加了个contentType="text/html; charset=UTF-8"就好了
      

  9.   

    我的JDK配置是正确的,不过还是报错