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-projects-issues opened this issue Sep 29, 2006 · 6 comments
Closed
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues 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:

12 votes, 12 watchers

@spring-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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 !

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import status: duplicate A duplicate of another issue in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant