You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Carvalho <vi...@auge.com.br> on 2004/10/25 21:59:29 UTC

ActionMessages question (simple)

I'm kinda lost with this. I set a message like below :


ActionMessages msgs = new ActionMessages();
msgs.add("removido", new 
ActionMessage("br.com.auge.bancoprojetos.registroRemovido"));
saveMessages(request,msgs);


Than I want to display it:

<logic:messagesPresent>
<html:messages="removido">
</html:messages>
</logic:messagesPresent>

That's not working anyway....


I'm kinda lost with id and name as well, which one is which??

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: help : how to redirect to a global-forward ?

Posted by Antony Paul <an...@gmail.com>.
Why are you using action inside global-forward. Use a forward element.
You can reference it from action like

mapping.findForward("toLogin");

rgds
Antony Paul


On Wed, 3 Nov 2004 10:27:49 +0530, sachin <sa...@paradyne.co.in> wrote:
> hi all,
> 
> i have a global forward defined as
> 
> <global-forwards>
> <action path="/toLogin" forward="/master/login.jsp" redirect="true" />
> </global-forwards>
> 
> now in my Action class i want to forward this to global forward "toLogin"
> if the session is not valid ..
> 
> how can achieve this ?
> this is going to be common for all Action classes , so i can not mapp them in
> each action-mapping defination ..
> 
> please tell me some way by which i can redirect to this page
> 
> thanks in advance
> 
> Regards,
> Sachin Hegde
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


help : how to redirect to a global-forward ?

Posted by sachin <sa...@paradyne.co.in>.
hi all, 

i have a global forward defined as 

<global-forwards>
<action path="/toLogin" forward="/master/login.jsp" redirect="true" />	  
</global-forwards>

now in my Action class i want to forward this to global forward "toLogin"
if the session is not valid ..

how can achieve this ? 
this is going to be common for all Action classes , so i can not mapp them in 
each action-mapping defination ..

please tell me some way by which i can redirect to this page

thanks in advance

Regards,
Sachin Hegde

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ActionMessages question (simple)

Posted by Vinicius Carvalho <vi...@auge.com.br>.
Thompson Marzagão wrote:

> Caro Vinicius,
>
> Your java code is fine. But you got confused on the struts tags.
>
> If you want to display ALL the messages you have, (that's probably 
> what you need) one under the other, separated by <br>'s, you would use:
>
> <html:messages id="message" message="true">
> <bean:write name="message"/><br>
> </html:messages>
>
> But if you only want to display that "removido" message when it 
> exists, you can use:
>
> <html:messages id="message" message="true" property="removido">
> <bean:write name="message"/>
> </html:messages>
>
> The html:messages tag loops over all of the items in your 
> ActionMessages object.
> The "id" is the label of the "current message instance" in the loop.
> The "name" in the bean:write tag in this case corresponds to the label 
> you gave to "current message instance".
>
> Um abraco,
> Thompson
>
>
> Vinicius Carvalho wrote:
>
>> I'm kinda lost with this. I set a message like below :
>>
>>
>> ActionMessages msgs = new ActionMessages();
>> msgs.add("removido", new 
>> ActionMessage("br.com.auge.bancoprojetos.registroRemovido"));
>> saveMessages(request,msgs);
>>
>>
>> Than I want to display it:
>>
>> <logic:messagesPresent>
>> <html:messages="removido">
>> </html:messages>
>> </logic:messagesPresent>
>>
>> That's not working anyway....
>>
>>
>> I'm kinda lost with id and name as well, which one is which??
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
First, I apoligize for posting wrong lines of code, that 
<html:messages="removido"> wasnt at my code. Now I have this:

<html:messages message="true" id="message">
    <bean:write name="message"/><br>
</html:messages>

And it says that can not find bean message in any scope, which makes 
sense once I don't recall myselft setting the messages name to message.
Anyway, what does this do?
ActionMessages msgs = new ActionMessages();
msgs.add("removido", new 
ActionMessage("br.com.auge.bancoprojetos.registroRemovido"));
saveMessages(request,msgs);

cuz, anywhere I set a name for my messages....


Thanks

Vinicius


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts img tag usage

Posted by Mark Lowe <ma...@boxstuff.it>.
URLrewrite has similar functionality to mod_write if you're in a pure  
java environment or deploy to some grot like IIS.

http://tuckey.org/urlrewrite

Mark

On 26 Oct 2004, at 19:55, Matt Bathje wrote:

> e-denton Java Programmer wrote:
>> Hi!
>> I have been using the Struts img tag instead of the HTML img tag just  
>> cause
>> I was trying to use and learn the Struts tags, e.g. <html:img
>> page="/grafx/logo.jpg" width="150" height="140" alt="" />. But, now  
>> that I
>> have tried deploying, I find it doesn't work for me. Apparently, it  
>> adds the
>> jessionid onto the url
>> (http://www.xxx.com/grafx/logo.jpg; 
>> jsessionid=49A25B81DEBD4EF7281DA6FA542BE7
>> 96) which somehow interferes with fetching the image. (It works on  
>> the first
>> load, but on subsequent ones, the cached copy fails.) I have read  
>> about the
>> tag online and in books, but the descriptions were terse with no  
>> examples.
>> So, I find I do not know the purpose or usage of the img (and, I  
>> suppose,
>> similar tags like link) tag.
>> 1. Why does the url with the appended jsessionid fail?
>> 2. When would you want the jsessionid appended?
>> 2. How and when should one use Struts img? Examples please.
>> Thanks!
>
> Are you deploying to a server that has httpd in front of Tomcat (using  
> mod_jk or jk2 I would imagine)?
>
> I had this problem on my sites after deployment, and it was because of  
> the apache/tomcat link. I had to upgrade to mod_jk2, then add the  
> following to my host setup in httpd.conf:
> <Location "/images/*;jsessionid=*">
>   JkUriSet worker ajp13:localhost:8009
> </Location>
>
> The upgrade to mod_jk2 was necessary because mod_jk wasn't able to do  
> more than one wildcard match
>
> The problem never surfaced on my dev machine, because it uses  
> standalone tomcat. The test/live sites use httpd->jk2->tomcat.
>
>
>
> Matt
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts img tag usage

Posted by Matt Bathje <mp...@ntsource.com>.
e-denton Java Programmer wrote:
> Hi!
> 
> I have been using the Struts img tag instead of the HTML img tag just cause
> I was trying to use and learn the Struts tags, e.g. <html:img
> page="/grafx/logo.jpg" width="150" height="140" alt="" />. But, now that I
> have tried deploying, I find it doesn't work for me. Apparently, it adds the
> jessionid onto the url
> (http://www.xxx.com/grafx/logo.jpg;jsessionid=49A25B81DEBD4EF7281DA6FA542BE7
> 96) which somehow interferes with fetching the image. (It works on the first
> load, but on subsequent ones, the cached copy fails.) I have read about the
> tag online and in books, but the descriptions were terse with no examples.
> So, I find I do not know the purpose or usage of the img (and, I suppose,
> similar tags like link) tag.
> 
> 1. Why does the url with the appended jsessionid fail?
> 2. When would you want the jsessionid appended?
> 2. How and when should one use Struts img? Examples please.
> 
> Thanks!
> 

Are you deploying to a server that has httpd in front of Tomcat (using 
mod_jk or jk2 I would imagine)?

I had this problem on my sites after deployment, and it was because of 
the apache/tomcat link. I had to upgrade to mod_jk2, then add the 
following to my host setup in httpd.conf:
<Location "/images/*;jsessionid=*">
   JkUriSet worker ajp13:localhost:8009
</Location>

The upgrade to mod_jk2 was necessary because mod_jk wasn't able to do 
more than one wildcard match

The problem never surfaced on my dev machine, because it uses standalone 
tomcat. The test/live sites use httpd->jk2->tomcat.



Matt



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Struts img tag usage

Posted by e-denton Java Programmer <ja...@e-denton.com>.
Hi!

I have been using the Struts img tag instead of the HTML img tag just cause
I was trying to use and learn the Struts tags, e.g. <html:img
page="/grafx/logo.jpg" width="150" height="140" alt="" />. But, now that I
have tried deploying, I find it doesn't work for me. Apparently, it adds the
jessionid onto the url
(http://www.xxx.com/grafx/logo.jpg;jsessionid=49A25B81DEBD4EF7281DA6FA542BE7
96) which somehow interferes with fetching the image. (It works on the first
load, but on subsequent ones, the cached copy fails.) I have read about the
tag online and in books, but the descriptions were terse with no examples.
So, I find I do not know the purpose or usage of the img (and, I suppose,
similar tags like link) tag.

1. Why does the url with the appended jsessionid fail?
2. When would you want the jsessionid appended?
2. How and when should one use Struts img? Examples please.

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ActionMessages question (simple)

Posted by Thompson Marzagão <th...@nettheory.com>.
Caro Vinicius,

Your java code is fine. But you got confused on the struts tags.

If you want to display ALL the messages you have, (that's probably what 
you need) one under the other, separated by <br>'s, you would use:

<html:messages id="message" message="true">
<bean:write name="message"/><br>
</html:messages>

But if you only want to display that "removido" message when it exists, 
you can use:

<html:messages id="message" message="true" property="removido">
<bean:write name="message"/>
</html:messages>

The html:messages tag loops over all of the items in your ActionMessages object.
The "id" is the label of the "current message instance" in the loop.
The "name" in the bean:write tag in this case corresponds to the label you gave to "current message instance".

Um abraco,
Thompson


Vinicius Carvalho wrote:

> I'm kinda lost with this. I set a message like below :
>
>
> ActionMessages msgs = new ActionMessages();
> msgs.add("removido", new 
> ActionMessage("br.com.auge.bancoprojetos.registroRemovido"));
> saveMessages(request,msgs);
>
>
> Than I want to display it:
>
> <logic:messagesPresent>
> <html:messages="removido">
> </html:messages>
> </logic:messagesPresent>
>
> That's not working anyway....
>
>
> I'm kinda lost with id and name as well, which one is which??
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org