Loading...
Corporate Training
Forward view
ibm
IBM WCS
IBM WebSphere
IBM Websphere Commerce Server
Online Training
Redirect view
virtualnuggets
websphere
https://ibmwcsonlinetrainings.blogspot.com/2016/05/forward-view-and-redirect-view-in-wcs.html
Redirect View
In the case of redirect view when redirects from a command the View or JSP will run in a new transaction Hence if an exception occurs in the JSP what is saved in the command won't roll back.Redirect is done via URL and hence it can't pass objects back to View.It can only pass name value pairs.Redirect has a browser URL length limitation with IE browser.
There are two approaches for handling a limited length redirect URL:
1.Override the getViewInputProperties method in the controller command to return only the sets of parameters that are required to be passed to the redirect response.
2.Use a specified special character in the URL parameters to indicate which parameters can be removed from the input parameter string.
For E.g.: While redirecting to TestViewName we need to remove certain parameters due to URL length limitation. In this case property2, property3 has to be removed.
URL="TestViewName";
Property1=" PropertyValue1";
Property2=" PropertyValue2";
Property3=" PropertyValue3";
Using Approach 1 (Override the getViewInputProperties method)
If you are overriding the getViewInputProperties method, the new method can be written so that only the following parameters are passed to the view command:
Property1="PropertyValue1";
public TypedProperty getViewInputProperties() {
TypedProperty tp = viewReqProperties;
tp.remove(Property2);
tp.remove(Property3);
return tp;
}
Using the second approach(Use special character to indicate which parameters can be removed), consider this URL=”TestViewName?Property2*=&Property3*="
This URL parameter instructs the Web Sphere Commerce runtime framework of the following:
The Property2*= specification means that all parameters whose names start with Property2 should be removed.
The Property3*= specification means that all parameters whose names start with Property3 should be removed.
TypedProperty rspProp = new TypedProperty();
rspProp.put(ECConstants.EC_URL, "TestViewName");
rspProp.put(ECConstants.EC_VIEWTASKNAME, ECConstants.EC_GENERIC_REDIRECTVIEW);
ForwardView
In the case of forward view when we are forwarding from a command to a View or a JSP the command and the JSP will run in the same transaction.Hence if an exception in JSP will cause what is saved in command to roll back.Forward View method can pass objects back to the view.
TypedProperty rspProp = new TypedProperty();
rspProp.put(ECConstants.EC_VIEWTASKNAME, "TestViewName");
Note: If you use forward view while passing control from a command to a view then if user presses refresh button or F5 the command will be executed again as the URL will remain the same command URL for e.g. While passing control from OrderItemAddCmd to a view. Then when user presses F5 button one more item might be added to cart. But in the case of redirect since the URL is changed to the view URL even if user presses F5 button only the view will be loaded again.
Corporate Training,
Forward view,
ibm,
IBM WCS,
IBM WebSphere,
IBM Websphere Commerce Server,
Online Training,
Redirect view,
virtualnuggets,
websphere
websphere
3275205112596891915
Post a Comment
Home
item
Blog Archive
Popular Posts
-
com.ibm.commerce.foundation.dataimport.util.DataImportHelper printException INFO: Data import process was unsuccessful. An unrecoverab...
-
What is the difference between Controller and Task Command? Controller Command is the command that gets called upon a request, just ...
-
Different between product and item? A product is nothing but a group of items that are caused for the exhibition the same attributes. Fo...
-
Promotions offers the ability to attract the customers to procure the items from the site and make them visit once again once the promotio...
-
Redirect View In the case of redirect view when redirects from a command the View or JSP will run in a new transaction Hence if an e...
-
How to find the Installed Product in IBM WebSphere Commerce Server | WCS? If it is windows follow as mentioned below: <WCS_INST...
-
Creating IBM WCS Database Schema For creating a new IBM WebSphere Commerce Server Database schema using developer machine the followin...
-
IBM WebSphere Commerce Server | WCS is a platform framework for e-commerce, including marketing, sales, customer and other functionality i...
-
IBM WebSphere Commerce Server | WCS data cache can be configured for using DistributedMap object caches, by defining specially named...