[Logo]
Forums Register Login
custom tag attribute items cannot be runtime expression
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 ]
In your tld, did you mark rtexprvalue to "true"?

What version of JSP and JSTL are you using? From your JSTL URI I am aasuming JSP 1.x and JSTL 1.0?
jsp version is 1.1

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

Should it be any where else?
rtexprvalue> is in .tld file. But I cannot find the tld file in my workspace.

I am on Rational software architect 6.0.
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.
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.

This thread has been viewed 5730 times.

All times above are in ranch (not your local) time.
The current ranch time is
Nov 16, 2018 21:23:23.