how to check if error collections not empty

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to check if error collections not empty

Chris Cheshire
In my JSP page, how do I check if the errors for a field that are rendered by the stripes:errors tag is not empty?

In some places I need to display them under the field and use a line break before them, and in some places I need to display them next to the field without the line break. Due to this I can't use the "stripes.fieldErrors.X" properties because it affects everything.

What I need to do is conditionally insert the line breaks in the places where it is appropriate. I am assuming they are hidden as a request attribute, but what is the key for them? What about the collection that stripes:messages renders?

Thanks

Chris




------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: how to check if error collections not empty

Freddy D.
Hi Chris,

Perhaps use the hasErrors() JSP function from the Stripes taglib?

http://stripes.sourceforge.net/docs/current/taglib/stripes/hasErrors.fn.html

Hope that helps,
Freddy

On Tue, Jul 30, 2013, at 02:36 PM, Chris Cheshire wrote:

In my JSP page, how do I check if the errors for a field that are
rendered by the stripes:errors tag is not empty?

In some places I need to display them under the field and use a line
break before them, and in some places I need to display them next to
the field without the line break. Due to this I can't use the
"stripes.fieldErrors.X" properties because it affects everything.

What I need to do is conditionally insert the line breaks in the places
where it is appropriate. I am assuming they are hidden as a request
attribute, but what is the key for them? What about the collection that
stripes:messages renders?

Thanks
Chris

-----------------------------------------------------------------------
-------

Get your SQL database under version control now!

Version control is standard for application code, but databases havent

caught up. So what steps can you take to put your SQL databases under

version control? Why should you start doing it? Read more to find out.

[1]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg
.clktrk

_______________________________________________

Stripes-users mailing list

[2][hidden email]

[3]https://lists.sourceforge.net/lists/listinfo/stripes-users

References

1.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
2. mailto:[hidden email]
3. https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: how to check if error collections not empty

Chris Cheshire
*facepalm* I didn't even see that and I've had the JDoc open for the last couple of days.

What about for the messages collection? I don't see anything analogous to it there.

Chris


On Tue, Jul 30, 2013 at 2:41 PM, Freddy Daoud <[hidden email]> wrote:
Hi Chris,

Perhaps use the hasErrors() JSP function from the Stripes taglib?

http://stripes.sourceforge.net/docs/current/taglib/stripes/hasErrors.fn.html

Hope that helps,
Freddy

On Tue, Jul 30, 2013, at 02:36 PM, Chris Cheshire wrote:

In my JSP page, how do I check if the errors for a field that are
rendered by the stripes:errors tag is not empty?

In some places I need to display them under the field and use a line
break before them, and in some places I need to display them next to
the field without the line break. Due to this I can't use the
"stripes.fieldErrors.X" properties because it affects everything.

What I need to do is conditionally insert the line breaks in the places
where it is appropriate. I am assuming they are hidden as a request
attribute, but what is the key for them? What about the collection that
stripes:messages renders?

Thanks
Chris

-----------------------------------------------------------------------
-------

Get your SQL database under version control now!

Version control is standard for application code, but databases havent

caught up. So what steps can you take to put your SQL databases under

version control? Why should you start doing it? Read more to find out.

[1]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg
.clktrk

_______________________________________________

Stripes-users mailing list

[2][hidden email]

[3]https://lists.sourceforge.net/lists/listinfo/stripes-users

References

1.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
2. mailto:[hidden email]
3. https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: how to check if error collections not empty

Poitras Christian

Hi,

 

There is no such function for messages. But you can do that easily in EL.

 

For example, if you save your message like this:

LocalizableMessage message = new LocalizableMessage("some_message");

context.getMessages(“my_key”).add(message);

 

Then the EL will look like this:

${!empty request[‘my_key’]}

 

I think this will work even after a redirect since messages are saved in FlashScope.

 

Christian

 

De : Chris Cheshire [mailto:[hidden email]]
Envoyé : July-30-13 5:29 PM
À : Stripes Users List
Objet : Re: [Stripes-users] how to check if error collections not empty

 

*facepalm* I didn't even see that and I've had the JDoc open for the last couple of days.

What about for the messages collection? I don't see anything analogous to it there.

Chris

 

On Tue, Jul 30, 2013 at 2:41 PM, Freddy Daoud <[hidden email]> wrote:

Hi Chris,

Perhaps use the hasErrors() JSP function from the Stripes taglib?

http://stripes.sourceforge.net/docs/current/taglib/stripes/hasErrors.fn.html

Hope that helps,
Freddy


On Tue, Jul 30, 2013, at 02:36 PM, Chris Cheshire wrote:

In my JSP page, how do I check if the errors for a field that are
rendered by the stripes:errors tag is not empty?

In some places I need to display them under the field and use a line
break before them, and in some places I need to display them next to
the field without the line break. Due to this I can't use the
"stripes.fieldErrors.X" properties because it affects everything.

What I need to do is conditionally insert the line breaks in the places
where it is appropriate. I am assuming they are hidden as a request
attribute, but what is the key for them? What about the collection that
stripes:messages renders?

Thanks
Chris

-----------------------------------------------------------------------
-------

Get your SQL database under version control now!

Version control is standard for application code, but databases havent

caught up. So what steps can you take to put your SQL databases under

version control? Why should you start doing it? Read more to find out.

[1]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg
.clktrk

_______________________________________________

Stripes-users mailing list

[2][hidden email]

[3]https://lists.sourceforge.net/lists/listinfo/stripes-users

References

1.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
2. mailto:[hidden email]
3. https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users

 


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: how to check if error collections not empty

samaxes
Hi,

You can also check for errors using:
<c:if test="${not empty actionBean.context.validationErrors}">
    <s:errors />
</c:if>

Similarly using the following code may also work for messages (not tested):
<c:if test="${not empty actionBean.context.messages}">
    <s:messages />
</c:if>




On Wed, Jul 31, 2013 at 1:42 PM, Poitras Christian <[hidden email]> wrote:

Hi,

 

There is no such function for messages. But you can do that easily in EL.

 

For example, if you save your message like this:

LocalizableMessage message = new LocalizableMessage("some_message");

context.getMessages(“my_key”).add(message);

 

Then the EL will look like this:

${!empty request[‘my_key’]}

 

I think this will work even after a redirect since messages are saved in FlashScope.

 

Christian

 

De : Chris Cheshire [mailto:[hidden email]]
Envoyé : July-30-13 5:29 PM
À : Stripes Users List
Objet : Re: [Stripes-users] how to check if error collections not empty

 

*facepalm* I didn't even see that and I've had the JDoc open for the last couple of days.

What about for the messages collection? I don't see anything analogous to it there.

Chris

 

On Tue, Jul 30, 2013 at 2:41 PM, Freddy Daoud <[hidden email]> wrote:

Hi Chris,

Perhaps use the hasErrors() JSP function from the Stripes taglib?

http://stripes.sourceforge.net/docs/current/taglib/stripes/hasErrors.fn.html

Hope that helps,
Freddy


On Tue, Jul 30, 2013, at 02:36 PM, Chris Cheshire wrote:

In my JSP page, how do I check if the errors for a field that are
rendered by the stripes:errors tag is not empty?

In some places I need to display them under the field and use a line
break before them, and in some places I need to display them next to
the field without the line break. Due to this I can't use the
"stripes.fieldErrors.X" properties because it affects everything.

What I need to do is conditionally insert the line breaks in the places
where it is appropriate. I am assuming they are hidden as a request
attribute, but what is the key for them? What about the collection that
stripes:messages renders?

Thanks
Chris

-----------------------------------------------------------------------
-------

Get your SQL database under version control now!

Version control is standard for application code, but databases havent

caught up. So what steps can you take to put your SQL databases under

version control? Why should you start doing it? Read more to find out.

[1]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg
.clktrk

_______________________________________________

Stripes-users mailing list

[2][hidden email]

[3]https://lists.sourceforge.net/lists/listinfo/stripes-users

References

1.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
2. mailto:[hidden email]
3. https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users

 


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users