• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

running IBM tutorial on my machine

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am following instructions given in the following website and built the message center. (I downloaded RSA 6.0 trial and working on it)
https://www6.software.ibm.com/dw/education/r/rdynwebsites/

In my JSP page where I am retrieving the messages I have a fo loop and I am getting error below for the JSP TAG with FOR loop

<c:forEach var="aMessage" items="${user.messages}">

Error was

JSP Translate: Custom tag attribute items cannot be runtime expression
Value : [${user.messages}]


Can someone shed some light please?

Thanks
Mei
 
author & internet detective
Posts: 42200
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mei,
That site is password protected. Can you post a code snippet of the surrounding code?

I suspect that you are trying to use expression language within a tag attribute, which is not allowed. But I don't see how that would find its way into a tutorial.
 
Me Fdo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Here's the code snippet, I have bolded the line I am getting the error "Custome tag attribute cannot be an expression"

(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</TITLE><br /> </HEAD><br /> <BODY><br /> <P><jsp:useBean id="user" type="com.ibm.tutorials.rational.User" scope="session"><br /> </jsp:useBean><br /> <BR><br /> Welcome<br /> <jsp:getProperty name="user" property="name" /> <BR><br /> <BR><br /> Your message as follows<br /> <BR><br /> </P><br /> <br /> <TABLE border="1"><br /> <TBODY><br /> <TR><br /> <TD width="112" bgcolor="silver">From</TD><br /> <TD width="421" bgcolor="silver">Text</TD><br /> </TR><br /> <c:forEach var="aMessage" items="${user.messages}"><br /> <TR><br /> <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>

[ April 18, 2005: Message edited by: Me Fdo ]
[ April 18, 2005: Message edited by: Me Fdo ]
 
Me Fdo
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the user.java class which has the message attribute defined as private , instead of user.message I used user.getMessage in the FOR EACH loop in the jsp page still I am getting the same error.


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;
}

} :roll:
 
Let's get him boys! We'll make him read this tiny ad!
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic