You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Delamere <ho...@michael-delamere.de> on 2002/11/07 12:16:56 UTC

Problems with ActionMessages... (again)

Hi,

I´m just not getting anywhere with the ActionMessages.  I wrote to the
mailing list about a week ago and got no answer.  Unfortunately since
then, I still haven´t managed to solve the problem myself.
Aaahhhrrrgggg!

I´m trying to display a message in my jsp which I have defined in my
action as follows:

ActionMessages messages = new ActionMessages();
ActionMessage newMessage = new ActionMessage("regform.myMessage ");
messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
saveMessages(request, messages);


And in my jsp:
<html:messages id="message" message="true">
    <bean:write name="message"/>
</html:messages>

I´m getting exactly the same error as described in the thread below
(which also received no answer on this topic):

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html

If anyone knows how to solve this, please help!

Regards,

Michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Problems with ActionMessages... (again)

Posted by Xavier Combelle <xc...@kaptech.com>.
Sorry for my previous mail,
I forgot to remove something
that is what i wanted to say :


I am amazed that nobody answered you ...
so, I will do my best

maybe you should use Action.MESSAGE_KEY instead
ActionMessages.GLOBAL_MESSAGE

it seems it's what it is specified in

http://jakarta.apache.org/struts/userGuide/struts-html.html#messages

message : By default the tag will retrieve the request scope bean it will
iterate over from the Action.ERROR_KEY constant string, but if this
attribute is set to 'true' the request scope bean will be retrieved from the
Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value
assigned to the name attribute will be ignored. (RT EXPR)



Regards,
Xavier

> -----Message d'origine-----
> De : Michael Delamere [mailto:home@michael-delamere.de]
> Envoyé : jeudi 7 novembre 2002 12:17
> À : Struts Users Mailing List
> Objet : Problems with ActionMessages... (again)
>
>
> Hi,
>
> I´m just not getting anywhere with the ActionMessages.  I wrote to the
> mailing list about a week ago and got no answer.  Unfortunately since
> then, I still haven´t managed to solve the problem myself.
> Aaahhhrrrgggg!
>
> I´m trying to display a message in my jsp which I have defined in my
> action as follows:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
> messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
> saveMessages(request, messages);
>
>
> And in my jsp:
> <html:messages id="message" message="true">
>     <bean:write name="message"/>
> </html:messages>
>
> I´m getting exactly the same error as described in the thread below
> (which also received no answer on this topic):
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html
>
> If anyone knows how to solve this, please help!
>
> Regards,
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Did not found doc about Tokens

Posted by Xavier Combelle <xc...@kaptech.com>.
I post this message because I did not found any doc about the
createToken, isTokenValid, resetToken API.
So I will explain what I understood about it from the struts-exemple
if something is wrong, I would like that someone will say to me
and if there is some doc tell me where ...


The token API is created to avoid that the user
to submlit twice the same form.
It is used with one ActionForm and two Action:
- the SomethingForm which contain the user's input
- the EditSomethingAction which populate the SomethingForm from the DB or
  clear all the field if it is a create Case
- the SaveSomethingAction which save the SomethingForm in the DB

To avoid that the user call submit twice the SomethingForm and
save twice the same data in the DB,
the struts framework propse the xxxToken API.

It is used as following
in EditSomethingAction, make a call to createToken(request) and that all !

in SaveSomethingAction, make a call to isTokenValid(request) and
resetToken(request)
as in the following  algorithm
if ( ! isTokenValid(request) )
{
	/*
	 * return forward towards an error page
	 * saying to the user that he has submit twice
	 * or
	 * forward toward the succes page if we don't want the user see anithing
	 */
}
else
{
	/*
	 * process the save in the DB
	 */
	if ( allTheSaveHasSucceed )
	{
		resetToken(request) ;
	}
}

You much take care that there is only one token in the session
so that this process can't support nested transactions.
So you should keep simple use of it.


The same API can be used to avoid that the user click twice on
a link by setting the 'transaction' attribute at "true" of the <html:link>
tag
the Action called by the link should follow the same process than
SaveSomethingAction








--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Did not found doc about Tokens

Posted by Xavier Combelle <xc...@kaptech.com>.
I post this message because I did not found any doc about the
createToken, isTokenValid, resetToken API.
So I will explain what I understood about it from the struts-exemple
if something is wrong, I would like that someone will say to me
and if there is some doc tell me where ...


The token API is created to avoid that the user
to submlit twice the same form.
It is used with one ActionForm and two Action:
- the SomethingForm which contain the user's input
- the EditSomethingAction which populate the SomethingForm from the DB or
  clear all the field if it is a create Case
- the SaveSomethingAction which save the SomethingForm in the DB

To avoid that the user call submit twice the SomethingForm and
save twice the same data in the DB,
the struts framework propse the xxxToken API.

It is used as following
in EditSomethingAction, make a call to createToken(request) and that all !

in SaveSomethingAction, make a call to isTokenValid(request) and
resetToken(request)
as in the following  algorithm
if ( ! isTokenValid(request) )
{
	/*
	 * return forward towards an error page
	 * saying to the user that he has submit twice
	 * or
	 * forward toward the succes page if we don't want the user see anithing
	 */
}
else
{
	/*
	 * process the save in the DB
	 */
	if ( allTheSaveHasSucceed )
	{
		resetToken(request) ;
	}
}

You much take care that there is only one token in the session
so that this process can't support nested transactions.
So you should keep simple use of it.


The same API can be used to avoid that the user click twice on
a link by setting the 'transaction' attribute at "true" of the <html:link>
tag
the Action called by the link should follow the same process than
SaveSomethingAction







--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Problems with ActionMessages... (again)

Posted by Michael Delamere <ho...@michael-delamere.de>.
No, I just changed the text in my outlook window to make it easier to
understand... :-) !  So in my actual program it´s correct...

Thanks for your response though!

Regards,

Michael



-----Original Message-----
From: James Mitchell [mailto:jmitchtx@telocity.com] 
Sent: Donnerstag, 7. November 2002 17:31
To: Struts Users Mailing List
Subject: RE: Problems with ActionMessages... (again)

Have you tried removing the trailing space?

> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
                                                                 ^

Not sure if that is a fix, but its a start.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"Only two things are infinite, the universe and human stupidity, and I'm
not
sure about the former."
- Albert Einstein (1879-1955)


> -----Original Message-----
> From: Michael Delamere [mailto:home@michael-delamere.de]
> Sent: Thursday, November 07, 2002 6:17 AM
> To: Struts Users Mailing List
> Subject: Problems with ActionMessages... (again)
>
>
> Hi,
>
> I´m just not getting anywhere with the ActionMessages.  I wrote to the
> mailing list about a week ago and got no answer.  Unfortunately since
> then, I still haven´t managed to solve the problem myself.
> Aaahhhrrrgggg!
>
> I´m trying to display a message in my jsp which I have defined in my
> action as follows:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
> messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
> saveMessages(request, messages);
>
>
> And in my jsp:
> <html:messages id="message" message="true">
>     <bean:write name="message"/>
> </html:messages>
>
> I´m getting exactly the same error as described in the thread below
> (which also received no answer on this topic):
>
>
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html
>
> If anyone knows how to solve this, please help!
>
> Regards,
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Problems with ActionMessages... (again)

Posted by James Mitchell <jm...@telocity.com>.
Have you tried removing the trailing space?

> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
                                                                 ^

Not sure if that is a fix, but its a start.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former."
- Albert Einstein (1879-1955)


> -----Original Message-----
> From: Michael Delamere [mailto:home@michael-delamere.de]
> Sent: Thursday, November 07, 2002 6:17 AM
> To: Struts Users Mailing List
> Subject: Problems with ActionMessages... (again)
>
>
> Hi,
>
> I´m just not getting anywhere with the ActionMessages.  I wrote to the
> mailing list about a week ago and got no answer.  Unfortunately since
> then, I still haven´t managed to solve the problem myself.
> Aaahhhrrrgggg!
>
> I´m trying to display a message in my jsp which I have defined in my
> action as follows:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
> messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
> saveMessages(request, messages);
>
>
> And in my jsp:
> <html:messages id="message" message="true">
>     <bean:write name="message"/>
> </html:messages>
>
> I´m getting exactly the same error as described in the thread below
> (which also received no answer on this topic):
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html
>
> If anyone knows how to solve this, please help!
>
> Regards,
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Problems with ActionMessages... (again)

Posted by Michael Delamere <ho...@michael-delamere.de>.
Xavier,

Thank you very much for your response!

I will certainly give it a go and let you know if it worked!

Regards,

Michael



-----Original Message-----
From: Xavier Combelle [mailto:xcombelle@kaptech.com] 
Sent: Freitag, 8. November 2002 11:06
To: Struts Users Mailing List
Subject: RE: Problems with ActionMessages... (again)

I am amazing that nobody answer you, so i checked the struts exeemple
( file LinkSubscriptionTag )
it appears that you must'n directly call
ActionMessages messages = new ActionMessages();
but yous should use
MessageResources messages =
	MessageResources.getMessageResources
	("org.apache.struts.webapp.example.ApplicationResources");
I am amazed that nobody answered you ...
so, I will do my best

maybe you should use Action.MESSAGE_KEY instead
ActionMessages.GLOBAL_MESSAGE

it seems it's what it is specified in

http://jakarta.apache.org/struts/userGuide/struts-html.html#messages

message : By default the tag will retrieve the request scope bean it
will
iterate over from the Action.ERROR_KEY constant string, but if this
attribute is set to 'true' the request scope bean will be retrieved from
the
Action.MESSAGE_KEY constant string. Also if this is set to 'true', any
value
assigned to the name attribute will be ignored. (RT EXPR)



Regards,
Xavier

> -----Message d'origine-----
> De : Michael Delamere [mailto:home@michael-delamere.de]
> Envoyé : jeudi 7 novembre 2002 12:17
> À : Struts Users Mailing List
> Objet : Problems with ActionMessages... (again)
>
>
> Hi,
>
> I´m just not getting anywhere with the ActionMessages.  I wrote to the
> mailing list about a week ago and got no answer.  Unfortunately since
> then, I still haven´t managed to solve the problem myself.
> Aaahhhrrrgggg!
>
> I´m trying to display a message in my jsp which I have defined in my
> action as follows:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
> messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
> saveMessages(request, messages);
>
>
> And in my jsp:
> <html:messages id="message" message="true">
>     <bean:write name="message"/>
> </html:messages>
>
> I´m getting exactly the same error as described in the thread below
> (which also received no answer on this topic):
>
>
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html
>
> If anyone knows how to solve this, please help!
>
> Regards,
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Problems with ActionMessages... (again)

Posted by Xavier Combelle <xc...@kaptech.com>.
I am amazing that nobody answer you, so i checked the struts exeemple
( file LinkSubscriptionTag )
it appears that you must'n directly call
ActionMessages messages = new ActionMessages();
but yous should use
MessageResources messages =
	MessageResources.getMessageResources
	("org.apache.struts.webapp.example.ApplicationResources");
I am amazed that nobody answered you ...
so, I will do my best

maybe you should use Action.MESSAGE_KEY instead
ActionMessages.GLOBAL_MESSAGE

it seems it's what it is specified in

http://jakarta.apache.org/struts/userGuide/struts-html.html#messages

message : By default the tag will retrieve the request scope bean it will
iterate over from the Action.ERROR_KEY constant string, but if this
attribute is set to 'true' the request scope bean will be retrieved from the
Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value
assigned to the name attribute will be ignored. (RT EXPR)



Regards,
Xavier

> -----Message d'origine-----
> De : Michael Delamere [mailto:home@michael-delamere.de]
> Envoyé : jeudi 7 novembre 2002 12:17
> À : Struts Users Mailing List
> Objet : Problems with ActionMessages... (again)
>
>
> Hi,
>
> I´m just not getting anywhere with the ActionMessages.  I wrote to the
> mailing list about a week ago and got no answer.  Unfortunately since
> then, I still haven´t managed to solve the problem myself.
> Aaahhhrrrgggg!
>
> I´m trying to display a message in my jsp which I have defined in my
> action as follows:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new ActionMessage("regform.myMessage ");
> messages.add(ActionMessages.GLOBAL_MESSAGE, newMessage);
> saveMessages(request, messages);
>
>
> And in my jsp:
> <html:messages id="message" message="true">
>     <bean:write name="message"/>
> </html:messages>
>
> I´m getting exactly the same error as described in the thread below
> (which also received no answer on this topic):
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg34621.html
>
> If anyone knows how to solve this, please help!
>
> Regards,
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>