开发者

How Eclipse can compile jsp fragments whose variables are declared in another file?

I want completion and compilation erros on eclipse for jsp fragments in eclipse. How can i have completion on test2.jnc for this files :

<%-- test1.jsp --%>
<%@ page language="java" %>
<%
String ma_variable = "";
%>
<%@ include file="test2.jnc" %>
<html>
 <body><h1><%=ma_variable%></h1></body>
</html>

And the interpreted included file that was on error in eclipse (ma_variable cannot be r开发者_Python百科esolved) :

<%-- test2.jnc --%>
ma_variable = "Hello World!";

If i launch that file in tomcat, all goes fine, but eclipse don't find ma_variable in the test2.jnc scope...

any idea? I "googled" but i did'nt find anything relevent...


The solution is not to use scriptlets. Use JSTL:

<c:set var="ma_variable" value="Hello World!" />

<h1>${ma_variable}</h1>


try adding .jnc extension to JSP editor of eclipse

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜