• Post Reply Bookmark Topic Watch Topic
  • New Topic

running IBM tutorial on my machine  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 38019
604
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!