This is to demonstrate the steps involved to introduce a new JSP in WCS
1)Create a new JSP at \workspace\Stores\WebContent\ConsumerDirect\MyNewPage.jsp folder
The output of this page is just a simple text : This is my new page
jsp code:
<?xmlversion="1.0" encoding="UTF-8"?>
<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%@page
language="java"contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<%@page isELIgnored="true"%>
<%@taglib uri="http://java.sun.com/jstl/fmt"prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jstl/core"prefix="c"%>
<%@taglib uri="http://commerce.ibm.com/base"prefix="wcbase"%>
<%@taglib uri="flow.tld"prefix="flow" %>
<%@include file="include/JSTLEnvironmentSetup.jspf"%>
<head>
<title>My New Page</title>
<link rel="stylesheet"href='<c:out value="${jspStoreImgDir}${vfileStylesheet}"/>'
type="text/css"/>
<metahttp-equiv="Content-Type" content="text/html; charset=UTF-8" />
<metaname="GENERATOR"
content="Rational® Application Developer™for WebSphere® Software" />
</head>
<body>
<%@include file="include/LayoutContainerTop.jspf"%>
<p>This is my new page</p>
<%@include file="include/LayoutContainerBottom.jspf"%>
</body>
</html>
2) We need to provide access policies to this view, create an xml file as below at \xml\policies\xml folder, i have created as : MyNewPage.xml
and run the below command:
acpload wcdev db2admin db2admin MyNewPage.xml db2admin
Actual syntax : acpload <database> <username> <password> <xml file name> <schema>
Open idres file and go to end of the file, we should see as below:
<import>
<acaction
ACACTION_ID="13401"
ACTION="MyNewPage"
/>
<acactactgp
ACACTGRP_ID="10196"
ACACTION_ID="13401"
/>
</import>
This indicates policies are set properly.
3) Change struts-config-ext.xml file at \workspace\Stores\WebContent\WEB-INF\struts-config-ext.xml
<forward name="MyNewPage/10051" path="/MyNewPage.jsp" className="com.ibm.commerce.struts.ECActionForward">
</forward>
</global-forwards>
and
<action path="/MyNewPage" type="com.ibm.commerce.struts.BaseAction">
</action>
</action-mappings>
4) We need to restart the server to reflect the access policies and struts config changes.
If we just change struts config file, refresh the Registry in Admin console is sufficient - no need to restart the server - as shown below:
5) To display this page we have already introduced a link in Home page of Consumer Direct in my previous topic: http://wcs-websphere-ecommerce.blogspot.in/2013/02/customize-storefront-pages-existing.html
5) To display this page we have already introduced a link in Home page of Consumer Direct in my previous topic: http://wcs-websphere-ecommerce.blogspot.in/2013/02/customize-storefront-pages-existing.html
On click of "My New Page" we can see the output in new page.
Top AWS Online Training Institute In Ameerpet, Hyderabad IntelliQ IT Offers Best Amazon Web Services AWS Classroom and Online Training Course With Real-Time Project.
ReplyDelete