You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Altenhof, David Aron" <da...@iupui.edu> on 2010/10/10 06:28:31 UTC

Simple theme and field errors

Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the "simple" theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up:

<s:property value="fieldErrors.fname"/>

                ... where "fname" is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets:

[You must enter a first name]

Of course, one could write some nasty code to strip out the brackets, but there must be an easier way.

Thanks for any help,

David


RE: Simple theme and field errors

Posted by "Altenhof, David Aron" <da...@iupui.edu>.
Csszengarden might be nice, but pretty ambitious. I just think that, if as I suspect, lots of people are rolling their own theme (which one almost has to in many cases), then having a place to put them would be helpful. I suspect there's a lot of wheel reinvention going on. 

-David

-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Sunday, October 10, 2010 10:04 AM
To: Struts Users Mailing List
Subject: Re: Simple theme and field errors

Often times just printing the .class of an OGNL expression can be handy in diagnosing issues without bothering with real debugging (or using the <s:debug/> tag).

There's no theme gallery I'm aware of, nor, I believe, are there too many TOGU (Themes of General Usefulness). They're not really themes in the sense of skins, although it might be nice to have a cleaned-up CSS theme and a csszengarden gallery; is that what you're looking for?

Dave

On Sun, Oct 10, 2010 at 9:57 AM, Altenhof, David Aron <da...@iupui.edu>wrote:

> Jeez ... you'd think I'd be able to figure that out. Oh, well ... late 
> night :-)
>
> By the way, is there anything like a "theme gallery" for Struts2? 
> somewhere to post new themes and view others' work?
>
> -David
>
> -----Original Message-----
> From: Maurizio Cucchiara [mailto:maurizio.cucchiara@gmail.com]
> Sent: Sunday, October 10, 2010 3:27 AM
> To: Struts Users Mailing List
> Subject: Re: Simple theme and field errors
>
> try this
> <s:iterator value="fieldErrors.foo">
>    <s:property/> <br/>
> </s:iterator>
>
>
> 2010/10/10 Dave Newton <da...@gmail.com>:
> > There can be more than one error; it's a collection.
> >
> > Dave
> >
> > On Sunday, October 10, 2010, Altenhof, David Aron 
> > <da...@iupui.edu>
> wrote:
> >> Working on first Struts2 project, and quickly found out that 
> >> standard
> themes can produce some quirky output. (Hoping to write my own when I 
> get some time). I decided to simply use the "simple" theme to give me 
> the most control over HTML formatting. However, it doesn't display 
> field errors from validation. So I tried adding this to jsp where I 
> want the error message to pop up:
> >>
> >> <s:property value="fieldErrors.fname"/>
> >>
> >>                 ... where "fname" is the field that failed validation.
> This works, but the error message always gets rendered back wrapped in
> brackets:
> >>
> >> [You must enter a first name]
> >>
> >> Of course, one could write some nasty code to strip out the 
> >> brackets,
> but there must be an easier way.
> >>
> >> Thanks for any help,
> >>
> >> David
> >>
> >>
> >
> > --------------------------------------------------------------------
> > - 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
>
>
> ---------------------------------------------------------------------
> 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: Simple theme and field errors

Posted by Dave Newton <da...@gmail.com>.
Often times just printing the .class of an OGNL expression can be handy in
diagnosing issues without bothering with real debugging (or using the
<s:debug/> tag).

There's no theme gallery I'm aware of, nor, I believe, are there too many
TOGU (Themes of General Usefulness). They're not really themes in the sense
of skins, although it might be nice to have a cleaned-up CSS theme and a
csszengarden gallery; is that what you're looking for?

Dave

On Sun, Oct 10, 2010 at 9:57 AM, Altenhof, David Aron <da...@iupui.edu>wrote:

> Jeez ... you'd think I'd be able to figure that out. Oh, well ... late
> night :-)
>
> By the way, is there anything like a "theme gallery" for Struts2? somewhere
> to post new themes and view others' work?
>
> -David
>
> -----Original Message-----
> From: Maurizio Cucchiara [mailto:maurizio.cucchiara@gmail.com]
> Sent: Sunday, October 10, 2010 3:27 AM
> To: Struts Users Mailing List
> Subject: Re: Simple theme and field errors
>
> try this
> <s:iterator value="fieldErrors.foo">
>    <s:property/> <br/>
> </s:iterator>
>
>
> 2010/10/10 Dave Newton <da...@gmail.com>:
> > There can be more than one error; it's a collection.
> >
> > Dave
> >
> > On Sunday, October 10, 2010, Altenhof, David Aron <da...@iupui.edu>
> wrote:
> >> Working on first Struts2 project, and quickly found out that standard
> themes can produce some quirky output. (Hoping to write my own when I get
> some time). I decided to simply use the "simple" theme to give me the most
> control over HTML formatting. However, it doesn't display field errors from
> validation. So I tried adding this to jsp where I want the error message to
> pop up:
> >>
> >> <s:property value="fieldErrors.fname"/>
> >>
> >>                 ... where "fname" is the field that failed validation.
> This works, but the error message always gets rendered back wrapped in
> brackets:
> >>
> >> [You must enter a first name]
> >>
> >> Of course, one could write some nasty code to strip out the brackets,
> but there must be an easier way.
> >>
> >> Thanks for any help,
> >>
> >> David
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Simple theme and field errors

Posted by "Altenhof, David Aron" <da...@iupui.edu>.
Jeez ... you'd think I'd be able to figure that out. Oh, well ... late night :-)

By the way, is there anything like a "theme gallery" for Struts2? somewhere to post new themes and view others' work?

-David

-----Original Message-----
From: Maurizio Cucchiara [mailto:maurizio.cucchiara@gmail.com] 
Sent: Sunday, October 10, 2010 3:27 AM
To: Struts Users Mailing List
Subject: Re: Simple theme and field errors

try this
<s:iterator value="fieldErrors.foo">
    <s:property/> <br/>
</s:iterator>


2010/10/10 Dave Newton <da...@gmail.com>:
> There can be more than one error; it's a collection.
>
> Dave
>
> On Sunday, October 10, 2010, Altenhof, David Aron <da...@iupui.edu> wrote:
>> Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the "simple" theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up:
>>
>> <s:property value="fieldErrors.fname"/>
>>
>>                 ... where "fname" is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets:
>>
>> [You must enter a first name]
>>
>> Of course, one could write some nasty code to strip out the brackets, but there must be an easier way.
>>
>> Thanks for any help,
>>
>> David
>>
>>
>
> ---------------------------------------------------------------------
> 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


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


Re: Simple theme and field errors

Posted by Maurizio Cucchiara <ma...@gmail.com>.
try this
<s:iterator value="fieldErrors.foo">
    <s:property/> <br/>
</s:iterator>


2010/10/10 Dave Newton <da...@gmail.com>:
> There can be more than one error; it's a collection.
>
> Dave
>
> On Sunday, October 10, 2010, Altenhof, David Aron <da...@iupui.edu> wrote:
>> Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the "simple" theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up:
>>
>> <s:property value="fieldErrors.fname"/>
>>
>>                 ... where "fname" is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets:
>>
>> [You must enter a first name]
>>
>> Of course, one could write some nasty code to strip out the brackets, but there must be an easier way.
>>
>> Thanks for any help,
>>
>> David
>>
>>
>
> ---------------------------------------------------------------------
> 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: Simple theme and field errors

Posted by Dave Newton <da...@gmail.com>.
There can be more than one error; it's a collection.

Dave

On Sunday, October 10, 2010, Altenhof, David Aron <da...@iupui.edu> wrote:
> Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the "simple" theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up:
>
> <s:property value="fieldErrors.fname"/>
>
>                 ... where "fname" is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets:
>
> [You must enter a first name]
>
> Of course, one could write some nasty code to strip out the brackets, but there must be an easier way.
>
> Thanks for any help,
>
> David
>
>

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