Creating a controller JSP file to retrieve URL information for in-context preview
For in-context preview to function properly for your business object, ensure that the URL information is returned as part of the object. One way to retrieve URL information is to create a custom controller JSP file to work with a serialization JSP file to transform WebSphere Commerce services nouns into XML for display in the Management Center. The controller JSP sends the nouns from BOD responses to a serialization JSP file for XML formatting.
About this task
When a business user is working on an object and launches store preview, a call is made to retrieve the URL information of the object. To retrieve the in-context preview URL information, the URL information must be in the XML format that is required by Management Center. To transform this URL information to the XML format, a controller JSP and serialization JSP file are required. The controller JSP determines how to handle the transformation request and sends the content to the correct serialization JSP file. The serialization JSP file is used to receive object properties from Nouns, and transform this URL information for use in the Management Center store preview.
When the call to retrieve URL information occurs, the controller JSP invokes
the wcf:getData
tag library to retrieve the noun that is used for the Management Center object. In the wcf:getData
tag, the
expressionBuilder parameter defines the query template to run. The query
template is mapped to the SQL statement that retrieves the data. For more information, see Management Center Web application.
After you create the controller JSP file, the file must be registered for your object in the struts-extension.xml file for customization. When you register the controller JSP file and use this Struts configuration file for customization, this file takes priority over all other Struts configuration files. For more information about the Struts configuration file, see customizing the Web application configuration. For more information about how Struts are used in WebSphere Commerce, see WebSphere Commerce Struts framework.
Procedure
-
Create a controller JSP file.
- In the Enterprise explorer view, expand . Create the directory structure if it does not exist.
- Right-click the component_name directory; then select .
-
Register the controller JSP file in the struts-extension.xml configuration
file.