Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

custom tag attribute items cannot be runtime expression  RSS feed

 
Me Fdo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting following error message, for the "For Each" statement:

custom tag attribute items cannot be runtime expression (value : ${user.getMessages})



(since html tags are not allowable I have replaced them w/< and >, Hopefully you can get an idea of the code)

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<HTML>
<HEAD>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>messageCenter.jsp</HEAD>
<BODY>
<P><jsp:useBean id="user" type="com.ibm.tutorials.rational.User" scope="session">
</jsp:useBean>
<BR>
Welcome
<jsp:getProperty name="user" property="name" /> <BR>
<BR>
Your message as follows
<BR>
</P>

<TABLE border="1">
<TBODY>
<TR>
<TD width="112" bgcolor="silver">From</TD>
<TD width="421" bgcolor="silver">Text</TD>
</TR>
<c:forEach var="aMessage" items="${user.messages}">
<TR>
<TD width="112"><c ut value="${aMessage.senderName}"></c ut></TD>
<TD width="421"><c ut value="${aMessage.text}"></c ut></TD>
</TR>
</c:forEach>
</TBODY>

Here's my "User.java" class FYI

package com.ibm.tutorials.rational;
import java.util.Vector;

public class User {
private String name;
private Vector messages;

// Simple implementation of a set of users -
// only for illustration purposes. Normally users
// would have to be maintained and managed in a database
private static User[] hardCodedUsers = {
new User("Joe"),
new User("Jane"),
new User("Tony"),
new User("Tina") };

public static User[] getHardCodedUsers() {
return User.hardCodedUsers;
}

public User(String name) {
this.name = name;
messages = new Vector();
}

public String getName() {
return this.name;
}

public Vector getMessages() {
return messages;
}

public void addMessage(Message message) {
messages.addElement(message);
}

// Return a User object based on user name or a null if a user
// by that name does not exist

public static User getUser(String username) {
User[] allUsers = User.getHardCodedUsers();
for (int i = 0 ; i < allUsers.length ; i++)
if (allUsers[i].getName().compareTo(username) == 0)
return hardCodedUsers[i];
return null;
}

}
[ April 29, 2005: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your tld, did you mark rtexprvalue to "true"?

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of JSP and JSTL are you using? From your JSTL URI I am aasuming JSP 1.x and JSTL 1.0?
 
Me Fdo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jsp version is 1.1

I do not see <rtexprvalue> in my web.xml ?

Should it be any where else?
 
Me Fdo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rtexprvalue> is in .tld file. But I cannot find the tld file in my workspace.

I am on Rational software architect 6.0.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tld in question is probably embedded in your JSTL implementation. You may want to try the 'rt' version of the URI. If I recall correctly, this syntax is:



but you should look it up in the docs (or the embedded tld) that came with your JSTL implementation to be sure.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should have read your code.
I saw "custom tag" in your subject and assumed you were writing custom tags.
I didn't notice the JSTL tags in your code.

Disregard my previous post.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!