RedirectView
|
ForwardView
|
When
redirection happens from a command, the View or JSP will run in a new
transaction
|
When
we are forwarding from a command to a View/JSP, the command and the JSP will
run in the same transaction
|
Exception
in the JSP won't roll back whatever is done in the command
|
Exception
in the JSP will rollback whatever happened in the command
|
Redirection
hapens via URL, so objects cannot be passed back to view in the response. To
be simple, name value pairs can be passed back
|
Objects
can be passed back to the view
|
The
URL in the browser changes in case of redirection. Hence there is a browser
URL length limitation with IE browser
|
The
URL in the browser does not change
|
If
user refreshes the page only the view will be loaded again
|
If
user presses refresh button or F5 the command will be executed again
|
Sample Code
TypedProperty
response = new TypedProperty();
response.put(ECConstants.EC_URL,"SampleView");
response.put(ECConstants.EC_VIEWTASKNAME,ShoppingConstants.REDIRECT_VIEW));
|
Sample Code
TypedProperty
response = new TypedProperty();
response.put(ECConstants.EC_VIEWTASKNAME,
"SampleView");
|
Note for RedirectView:
Handling the length limitation
- Overriding the getViewInputProperties method in the controller command and return only the required sets of parameters in the redirect response. The below new method removes the unwanted parameters and send only required parameters to the view.
E.g.,
public
TypedProperty getViewInputProperties() {
TypedProperty tempProp =
viewReqProperties;
tempProp.remove(prop2);
tempProp.remove(prop3);
return tempProp;
}
- Using a specified special character in the URL parameters, indicating that these parameters can be removed from the input parameter string.
E.g.,
URL="TestViewName?prop2*="
Here, prop2*=
means remove all parameters which has names starting with prop2 should be
removed
Thank you for sharing such a usefull information
ReplyDeleteWebsite Development services in Bangalore | website development company Bangalore | Ecommerce website development Bangalore | ecommerce development Bangalore
This comment has been removed by the author.
ReplyDeleteGreat Post. Thanks for sharing this with us. Your blog posts are really very interesting and useful. Hopefully this may also help your readers to do affordable online shopping. Crocs Footwear
ReplyDelete