我在jsp页面中看到以下错误 -
javax.servlet.jsp.PageContext cannot be resolved to a type
javax.servlet.jsp.JspException cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)
我看过一篇关于此的帖子,并尝试了一些建议的事情.BalusC提供了很好的输入 - JSTL1.2和Standard.jar不能一起使用.我做了这个,它解决了一段时间的问题 - 但它再次出现.我不确定我是否还有罐头碰撞.我已经将所有jar定义为Maven中的依赖项.以下是我指定pom.xml的依赖项 -
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.38</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId> …Run Code Online (Sandbox Code Playgroud) 我想在我的jsp中包含js和css文件,但我无法这样做.我是Spring MVC概念的新手.很长一段时间,我一直在研究同一个话题.我的索引页面是这样的
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/LoginPageScrip.js">
</script>
<style type="text/css">
body {
background-image: url("LoginPageBackgroundImage.jpg");
}
</style>
</head>
<body >
<h6>Please login in google Chrome</h6>
<h1 align="center">Welcome to my Twitter Clone</h1>
<div class="m" style="margin-left: 401px; margin-top: 70px;">
<form method="post" action="LoginForExistingUser" onsubmit="return Validate(this);">
<fieldset>
<legend align="center">Login</legend>
<div class="a">
<div class="l">User Name</div>
<div class="r">
<INPUT type="text" name="userName">
</div>
</div>
<div class="a">
<div class="l">Password</div>
<div class="r">
<INPUT type="password" name="password">
</div>
</div>
<div class="a">
<div class="r">
<INPUT class="button" type="submit" …Run Code Online (Sandbox Code Playgroud) 我在工作中得到了一些旧的JSP Web项目,我试图导入到eclipse中.我对java和eclipse的经验远非如此.
在其中一个jsp文件中我遇到错误:
导入javax.servlet.jsp.JspWriter无法解析
代码:
<%@ page import="org.apache.axiom.om.OMAbstractFactory,
org.apache.axiom.om.OMElement,
org.apache.axiom.om.OMFactory,
org.apache.axiom.om.OMNamespace,
org.apache.axis2.AxisFault,
org.apache.axis2.Constants,
org.apache.axis2.addressing.EndpointReference,
org.apache.axis2.client.Options,
org.apache.axis2.client.ServiceClient,
org.apache.axis2.context.ConfigurationContext,
org.apache.axis2.context.ConfigurationContextFactory,
javax.servlet.ServletContext,
javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse,
javax.servlet.jsp.JspWriter, <- Problem is HERE
javax.xml.parsers.SAXParser,
javax.xml.parsers.SAXParserFactory"
session="false" %>
Run Code Online (Sandbox Code Playgroud)
当然,在我引用JspWriter的任何其他地方,我都会遇到同样的错误.
我查看了Java Build Path,我有以下内容:
1)servlet-api.jar - C:\ Program Files ...
2)Ear Libraries
3)JRE系统库(jdk1.6.0_25)
4)Web App Libraries
我曾经为Apache Tomcat 6.0库提供了一个未绑定的项目,所以我删除了它.我试图添加它但不能.当我单击添加库>服务器运行时我得到新窗口说:"选择要添加到类路径的运行时",但没有什么可以选择.
我已经安装了:用于Web开发人员的Eclipse Java EE IDE,安装了Apache Tomcat(6.0),最新版本的Ant和Windows 7 64位.
有任何想法吗?
谢谢.
我是春天的新手,我在Spring mvc应用程序中访问我的资源时遇到问题.我已经尝试了Google并使用堆栈溢出来找到答案(这些都没有帮助我解决方案1,或者可能的解决方案,可能的解决方案3,弹簧框架)但我发现没有任何一个解决了我的问题或者提高了我对问题(可能只是因为我不太明白提到的解决方案).
我已设法将我的css文件嵌入到网页中但使用代码:
<%@include file="css/style.css" %>
Run Code Online (Sandbox Code Playgroud)
但由于显而易见的原因,我无法使用这种方式访问它.我也尝试在我的web.xml文件中使用以下内容但它没有任何效果,我承认我在这种情况下并不真正理解映射,因此可能是一个问题
<mvc:annotation-driven />
<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/css/**" location="/css/" />
Run Code Online (Sandbox Code Playgroud)
我也尝试分别使用以下各项:
<img src="<%=request.getContextPath()%>/images/logo.jpg"/>
<img src="<%=request.getContextPath()%>/src/main/resources/images/logo.jpg"/>
Run Code Online (Sandbox Code Playgroud)
这是我的项目布局:

这是我的web.xml:
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>MyProject Application</display-name>
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
这是我的myServlet-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- -->
<mvc:annotation-driven />
<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/css/**" location="/css/" />
<bean name="/index.html" …Run Code Online (Sandbox Code Playgroud)