Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to display success message(s). [SPR-2657] #7346

Closed
spring-issuemaster opened this issue Sep 29, 2006 · 6 comments

Comments

@spring-issuemaster
Copy link
Collaborator

commented Sep 29, 2006

Daigo Kobayashi opened SPR-2657 and commented

There is no way to display success message(s) like struts' ActionMessage. Spring should provide Messages inteface in a similar way of Errors and related tag libraries.


Issue Links:

  • #11130 Flash Scope for Spring MVC (Without Spring Web Flow) ("duplicates")

12 votes, 12 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 29, 2006

Rick Evans commented

Hi Daigo

I'm not quite sure what you mean with this issue; can you please explain a little more, perhaps supplying a use case?

If you want to display data upon sucess, you can put the data that you want displayed in the ModelAndView.

Cheers
Rick

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 29, 2006

Daigo Kobayashi commented

Hi Rick

Actually I can set message to ModelAndView. However, I can't handle following issue cleverly.

  1. I can't use LocaleResolver like Errors.
  2. I want to use same way as spring:hasBindErrors to handle message, so I need spring:hasBindMessages.

Sample code:

<spring:hasBindMessages name="command">
<c:forEach var="msg" items="${errors.globalMessages}">
<span class="message"><c:out value="${msg}"/></span>
</c:forEach>
</spring:hasBindMessages>

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 17, 2006

Akram BEN AISSI commented

I would be also interrested with this evolution for a secondary purpose:
I want to display warning messages on validation:

In fact, I want to warn (or inform) users about some validation problems (that are not critical, not errors in facts). if the user submit the form again with no changes, I want to perform the submit.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 12, 2007

Gunnar Hillert commented

Hi,

This is one area where Struts is superior IMO and I wish Spring MVC would offer functionality similar to Struts' ActionMessage. (In my opinion good success messages are just as important as good error messages :-)
Besides providing a common infrastructure for handling error AND success messages in a standard way, it would also be great if those messages would survive redirects. Right now I am using the approach that is implemented in Matt Raible's Equinox. (Using a custom filter --> org.appfuse.web.MessageFilter).

Also, on a side note - would it be wise to have messages support for spring core? In quite a few cases my service layer methods need to pass back messages and I wonder if that is something to 'standardize' instead of rolling your own approach?

See also: http://forum.springframework.org/archive/index.php/t-29411.html

Thanks!

Regards -

Gunnar

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 10, 2011

Andrew Wong commented

It will be very useful to have some comment framework for messaging besides just errors. Are there any plans for this issue?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 30, 2011

adrian commented

I also need this feature. In the meanwhile I think we'll be developing (or borrowing) a custom one.

SWF appears to have this feature : http://static.springsource.org/spring-webflow/docs/2.3.x/reference/htmlsingle/spring-webflow-reference.html#view-messages.
Would be interesting to 'downgrade' it to Spring MVC ?

JSF has a similar feature (http://wiki.apache.org/myfaces/Displaying_Errors/Infos/Warnings_in_JSF_Pages).

<h:messages globalOnly="true" errorClass="errorMessage" infoClass="infoMessage"/>

Here's the API to add an info message to the queue :

getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, summary, null));

Seam 2 (works on top of JSF) has a simple API for info messages, and a less simple for ERROR/WARN messages (http://docs.jboss.org/seam/2.2.2.Final/reference/en-US/html/framework.html#d0e8463)

addFacesMessage("User #{user.username} already exists");

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.