问题描述
首先,我的JSTl代码在我的服务器上运行,因为我在tomcat7的Lib文件夹中有正确的Jar文件。这真的是一个IDEA问题。我的问题归结为我将相同的jar文件放在IntelliJ中的文件目录中。
First of all my JSTl code works on my server because i have the proper Jar file in the Lib folder in tomcat7. This is just really an IDEA problem. My questions comes down to where i put the same jar file in my file directory within IntelliJ.
我在IntelliJ和JSTL中遇到错误。
I have ran into a error in IntelliJ and JSTL.
我的问题是,当我使用
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
导致无法用uri解析taglib。我尝试了不同的Jar文件,我知道我必须更正我的servlet版本。
It results in Cannot resolve taglib with uri. I have tried different Jar files and I do know that i have to correct version for my servlet.
我在Ubuntu Server 15.04和IntelliJ 14.1.3上运行tomcat7。
Im running tomcat7 on Ubuntu Server 15.04, and IntelliJ 14.1.3.
我试过导入jar通过项目结构提交文件,并将其包含在各个地方,但在重新构建项目后关闭并重新打开IDEA仍然存在相同的错误。
I have tried importing the jar file though the Project Structure, and including it in various places but still the same error after re-building the project, and closing down and reopening the IDEA.
此示例代码在部署到tomcat时运行,但IntelliJ不断给出错误。
This sample code runs when deployed to tomcat but IntelliJ keeps giving errors.
<table border="1">
<c:forEach var="a" items="${data}">
<tr>
<td>${a}</td>
</tr>
</c:forEach>
</table>
<c:forEach begin="0" end="255" var="i">
<span style='color:rgb(
<c:out value="${i}"/>,
<c:out value="${i}"/>,
<c:out value="${i}"/>);'>
<c:out value="${i}"/></span> <br />
</c:forEach>
我想知道如何阻止IntelliJ在我的语法上出错,即使代码有效。
I would like to know how to stop IntelliJ from giving errors on my Syntax even though the code works.
我已阅读
和
仍然没有运气。
推荐答案
首先将此添加到.jsp文件的顶部:
First add this to the top of your ".jsp" file:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
它仍然会出现语法错误,但你可以通过添加javax.servlet:jstl:1.2来修复它(不带引号)作为模块依赖项。为此,请按以下步骤操作:
It will still give syntax error but you can fix that by adding "javax.servlet:jstl:1.2" (without quotes) as a module dependency. To do that, follow these steps:
- 点击您的项目名称并按F4以显示模块设置对话框。
- 然后转到modules部分的dependencies选项卡。
- 点击绿色的+图标 - >库 - >来自Maven。
- 在搜索栏中搜索
javax.servlet:jstl:1.2
,然后按确定将下载并添加上述库作为模块。 - 现在你不应该有任何语法错误。
- Click your project name and press "F4" to bring up the module settings dialog.
- Then go to the "dependencies" tab in the "modules" section.
- Click the green "+" icon --> library --> From Maven.
- Search for
javax.servlet:jstl:1.2
in the search bar and press OK and it will download and add the above mentioned library as a module. - Now you should not have any kind of syntax error.
这篇关于IntelliJ和JSP / JSTL无法在tomcat7中解析JSTL的taglib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!