You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by setecastronomy <fi...@virgilio.it> on 2007/06/15 15:49:07 UTC

Best practices with struts 2.0

I'm new to Struts 2.0 and I have to difficulties in finding good tutorials.
 
I have many doubts on the best way to perform some actions.
For example I have the following line inside one jsp page:

<s:property value="montlyDeltaMinutes"/>

It accesses a property in the action of integer type. They are minutes but I
wuold like to represent them as XX:YY where XX are the hours. Surely I can
code the function "getMontlyDeltaMinutesAs_XX_YY_String"
in the action but I would mix model and presentation. I think it is better
to use a special tag for formatting but I have no idea on how to do it.

The OGNL stack is somewhat misterious to me so I'm looking for a code
snippet to display everything on it.
I was quite surprised jsp variables such as  

<%! String aName = "Filippo";%> 

are not known to struts tags. Is there a way to use them, for example,
inside an <s:if > tag ?

Thanks for any help


-- 
View this message in context: http://www.nabble.com/Best-practices-with-struts-2.0-tf3928006.html#a11139897
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Best practices with struts 2.0

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

About your value stack question:
I think you can use <s:push /> 
(http://struts.apache.org/2.x/docs/push.html) to add values to the 
stack, so they can be used by other struts tags afterwards.

Gert

setecastronomy wrote:
> I'm new to Struts 2.0 and I have to difficulties in finding good tutorials.
>  
> I have many doubts on the best way to perform some actions.
> For example I have the following line inside one jsp page:
>
> <s:property value="montlyDeltaMinutes"/>
>
> It accesses a property in the action of integer type. They are minutes but I
> wuold like to represent them as XX:YY where XX are the hours. Surely I can
> code the function "getMontlyDeltaMinutesAs_XX_YY_String"
> in the action but I would mix model and presentation. I think it is better
> to use a special tag for formatting but I have no idea on how to do it.
>
> The OGNL stack is somewhat misterious to me so I'm looking for a code
> snippet to display everything on it.
> I was quite surprised jsp variables such as  
>
> <%! String aName = "Filippo";%> 
>
> are not known to struts tags. Is there a way to use them, for example,
> inside an <s:if > tag ?
>
> Thanks for any help
>
>
>   


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