[studs-user] About html:messages behaviour
Status: Beta
Brought to you by:
mojavelinux
|
From: Juan C. R. A. <jc...@um...> - 2007-01-17 09:54:27
|
Hello I've been experiencing some problems html:message related. I would
like to show some
messages when an user's data are modified (yes, yes... I have read the
golflog example and
I have done the same...).
Here is my stuff. Likewise I'm missing something trivial.
struts-config.xml
=================
<action path="/EditUserSubmit"
type="action.EditUserSubmitAction"
name="UserForm"
scope="request"
validate="true"
input="editor">
<forward name="denied" path="/pages/user-login.psp"/>
<forward name="editor" path="/EditUser.do" />
<forward name="next" path="/ListUsers.do" redirect="true"/>
</action>
EditUserSubmitAction.php
========================
.
.
.
import('studs.action.ActionMessage');
import('studs.action.ActionMessages');
.
.
.
$messages =& new ActionMessages();
$messages->add(c('ActionMessages::GLOBAL_MESSAGE'),
new ActionMessage('user.edit.profile.success',
$user->getLogin()));
$this->saveMessages($request, $messages, true);
return $mapping->findForward('next');
ListUsersAction.php same as golflog, and don't do nothing special.
user-list.php
=============
<%@ page language="php" %>
<%@ taglib uri="/WEB-INF/tld/phase-core.tld" %>
<%@ taglib uri="/WEB-INF/tld/studs-html.tld" %>
<%@ taglib uri="/WEB-INF/tld/studs-template.tld"%>
<template:insert template="/pages/template.psp">
<template:put name="title" content="Agregar/Editar usuarios"
direct="true"/>
<template:put name="arriba" content="/pages/header.psp"/>
<template:put name="abajo" content="/pages/footer.psp"/>
<template:put name="centro" content="/pages/listado-usuarios.psp"/>
</template:insert>
and
listado-usuarios.psp
====================
<%@ page language="php" %>
<h1>Lista de Usuarios</h1>
<html:messages id="message" message="true" scope="session">
<div class="message"><c:out value="${message}"/></div>
</html:messages>
.
.
.
and here is the result
---------------------------------------------------------------
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server
Error) that prevented it from fulfilling this request.
exception
horizon.lang.RootException: Fatal error: Unknown(): The script tried to
execute a method or access a property of an incomplete object. Please
ensure that the class definition actionmessage of the object you are
trying to operate on was loaded _before_ the session was started in
/var/www/s/WEB-INF/lib/studs/taglib/html/HtmlMessagesTag.php on line 215
at [PHP].main(:)
Testing more and more... if I insert next line:
<%@ taglib uri="/WEB-INF/tld/studs-html.tld" %>
in top of listado-usuarios.psp, so it becomes:
========================================
<%@ page language="php" %>
<%@ taglib uri="/WEB-INF/tld/studs-html.tld" %>
<h1>Lista de Usuarios</h1>
<html:messages id="message" message="true" scope="session">
<div class="message"><c:out value="${message}"/></div>
</html:messages>
.
.
.
it works like a charm. It is supposed to be included at the beginning of
user-list.psp, isn't it?
Is this normal? a bug? something else?
Cheers.
|