Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

According to TLD or attribute directive in tag file, attribute items does not accept any expressions [duplicate]

Tags:

java

jstl

I have a project where I need to display details of movies in an HTML page. I must strictly follow MVC although I am not using any framework like Spring or Struts. I am also not allowed to use scriptlets, but use JSTL and expression language. I usually retrieve data from database and then set it to a bean and then make a list of those bean and pass it to JSP and then print those details. But how would I achieve it if I am not allowed to use JSP. If I use servlet to retrieve those data and set it to a bean and then to a list and pass it through request dispatcher, how am I going to get each bean from the list in the HTML page?

I could not get this JSTL working. I am using Netbeans 7.0 and Apache Tomcat 7.

 <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>DVD Guru</title>         <link rel="stylesheet" type="text/css" href="style.css" media="screen" />     </head>     <body>         <div id="wrapper">              <c:set var="testing" value="blah"/>                 <c:out value="${testing}"/>         </div>           </body> </html> 

I get following error

According to TLD or attribute directive in tag file, attribute items does not accept any expressions

I have imported JSTL 1.1 library from project properties. Should anything else should be done?

like image 354
ntstha Avatar asked Nov 17 '12 07:11

ntstha


1 Answers

You must use JSP, JSTL - is just set of custom tags and can not be used separately. As well as Expression Language. If you are not using any MVC frameworks, then you need to do some of their work by yourself. Please take a look (if you haven't yet) at following design patterns:

  1. Front Controller, Command for simple application
  2. Front Controller, View Helper for more complex application

UPD:

To resolve issue with EL, please try to correct JSTL uri in your JSP to:

 <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%> 
like image 51
udalmik Avatar answered Sep 27 '22 20:09

udalmik