We can test ControllerCommand using simple junit test case. But we will test this by using JSP/Action (struts-config-ext.xml).
According to our requirement edit the jsp which is already developed in previous session Create a new JSP for WCS use
Below is the JSP code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html 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"%>
<html xmlns="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" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="GENERATOR"
content="Rational® Application Developer™for WebSphere® Software" />
</head>
<body>
<%@ include file="include/LayoutContainerTop.jspf"%>
<p>This is my new page</p>
<script language="Javascript1.2">
function placeCatalogOrder(form)
{
form.submit();
}
</script>
<form method="post" action="MyCatalogPage" name="MyCatalogPage_Form" id="MyCatalogPage_Form">
<input type="hidden" name="storeId" value="<c:out value="${WCParam.storeId}" />"
id="MyCatalogPage_FormInput_storeId" />
<input type="hidden" name="langId" value="<c:out value="${WCParam.langId}" />"
id="MyCatalogPage_FormInput_langId" />
<input type="hidden" name="catalogId" value="<c:out value="${WCParam.catalogId}" />"
id="MyCatalogPage_FormInput_catalogId" />
</form>
<a href="javascript:placeCatalogOrder(document.MyCatalogPage_Form)"
class="button" id="OrderPaperCatalogForm_Button">
<fmt:message key="ORDER_CATALOG" bundle="${storeText}" />
</a>
<p>
<c:out value="${taskShippingMessage}" />
<c:out value="${taskShippingAddressee}" />
</p>
<%@ include file="include/LayoutContainerBottom.jspf"%>
</body>
</html>
Output:
Onclick on My New Page link we get below page:
Onclick of Place Order button we get below output:
According to our requirement edit the jsp which is already developed in previous session Create a new JSP for WCS use
Below is the JSP code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html 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"%>
<html xmlns="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" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="GENERATOR"
content="Rational® Application Developer™for WebSphere® Software" />
</head>
<body>
<%@ include file="include/LayoutContainerTop.jspf"%>
<p>This is my new page</p>
<script language="Javascript1.2">
function placeCatalogOrder(form)
{
form.submit();
}
</script>
<form method="post" action="MyCatalogPage" name="MyCatalogPage_Form" id="MyCatalogPage_Form">
<input type="hidden" name="storeId" value="<c:out value="${WCParam.storeId}" />"
id="MyCatalogPage_FormInput_storeId" />
<input type="hidden" name="langId" value="<c:out value="${WCParam.langId}" />"
id="MyCatalogPage_FormInput_langId" />
<input type="hidden" name="catalogId" value="<c:out value="${WCParam.catalogId}" />"
id="MyCatalogPage_FormInput_catalogId" />
</form>
<a href="javascript:placeCatalogOrder(document.MyCatalogPage_Form)"
class="button" id="OrderPaperCatalogForm_Button">
<fmt:message key="ORDER_CATALOG" bundle="${storeText}" />
</a>
<p>
<c:out value="${taskShippingMessage}" />
<c:out value="${taskShippingAddressee}" />
</p>
<%@ include file="include/LayoutContainerBottom.jspf"%>
</body>
</html>
Output:
Onclick on My New Page link we get below page:
Onclick of Place Order button we get below output:
No comments:
Post a Comment