public abstract class AbstractMvcView extends Object implements View
RENDER_FRAGMENTS_ATTRIBUTE, USER_EVENT_STATE_ATTRIBUTE
Constructor and Description |
---|
AbstractMvcView(org.springframework.web.servlet.View view,
RequestContext requestContext)
Creates a new MVC view.
|
Modifier and Type | Method and Description |
---|---|
Event |
getFlowEvent()
Get the flow event the current state should handle.
|
Serializable |
getUserEventState()
A memento holding the results of processing a user event.
|
boolean |
hasFlowEvent()
True if a call to
View.processUserEvent() raised a flow event the current state should handle. |
void |
processUserEvent()
Process the queued user event.
|
void |
render()
Render this view's content.
|
void |
saveState()
Saves any state associated with this view out to view scope.
|
void |
setBinderConfiguration(BinderConfiguration binderConfiguration)
Sets the configuration describing how this view should bind to its model to access data for rendering.
|
void |
setConversionService(ConversionService conversionService)
Sets the service to use to expose formatters for field values.
|
void |
setEventIdParameterName(String eventIdParameterName)
Sets the name of the request parameter to use to lookup user events signaled by this view.
|
void |
setExpressionParser(ExpressionParser expressionParser)
Sets the expression parser to use to parse model expressions.
|
void |
setFieldMarkerPrefix(String fieldMarkerPrefix)
Specify a prefix that can be used for parameters that mark potentially empty fields, having "prefix + field" as
name.
|
void |
setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
Set the message codes resolver to use to resolve bind and validation failure message codes.
|
String |
toString() |
boolean |
userEventQueued()
True if there is a user event queued this view should process.
|
public AbstractMvcView(org.springframework.web.servlet.View view, RequestContext requestContext)
view
- the Spring MVC view to renderrequestContext
- the current flow request contextpublic void setExpressionParser(ExpressionParser expressionParser)
expressionParser
- the expression parserpublic void setConversionService(ConversionService conversionService)
conversionService
- the conversion servicepublic void setBinderConfiguration(BinderConfiguration binderConfiguration)
binderConfiguration
- the model binder configurationpublic void setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
messageCodesResolver
- the binding error message code resolver to usepublic void setFieldMarkerPrefix(String fieldMarkerPrefix)
Default is "_", for "_FIELD" parameters (e.g. "_subscribeToNewsletter"). Set this to null if you want to turn off the empty field check completely.
HTML checkboxes only send a value when they're checked, so it is not possible to detect that a formerly checked box has just been unchecked, at least not with standard HTML means.
This auto-reset mechanism addresses this deficiency, provided that a marker parameter is sent for each checkbox field, like "_subscribeToNewsletter" for a "subscribeToNewsletter" field. As the marker parameter is sent in any case, the data binder can detect an empty field and automatically reset its value.
public void setEventIdParameterName(String eventIdParameterName)
_eventId
eventIdParameterName
- the event id parameter namepublic void render() throws IOException
View
render
in interface View
IOException
- if an IO Exception occured rendering the viewpublic boolean userEventQueued()
View
userEventQueued
in interface View
public void processUserEvent()
View
View.userEventQueued()
returns true. After calling
this method, a flow event may be raised that should be handled in the Web Flow system.processUserEvent
in interface View
View.hasFlowEvent()
public Serializable getUserEventState()
View
getUserEventState
in interface View
View.processUserEvent()
public boolean hasFlowEvent()
View
View.processUserEvent()
raised a flow event the current state should handle. Call
View.getFlowEvent()
to access the Event.hasFlowEvent
in interface View
public Event getFlowEvent()
View
View.hasFlowEvent()
returns
true. Returns null
otherwise.getFlowEvent
in interface View
null
if there is no event for the flow system to handlepublic void saveState()
View
ViewState
to allow for
any changes applied after postback processing to be captured and reflected when going back. Can be a no-op for
views that store no view state.