Wednesday, September 21, 2011

Retrieving WCParam value from scriptlet



Using JSPHelper to retrieve WCParam values:

JSTL:
wcparam value AdddressId:<c:out value="${WCParam.addressId}"/>

 above example using JSP Scriptlet:
<%@ page import="com.ibm.commerce.server.JSPHelper" %>

<%
String addressId=(String)com.ibm.commerce.server.JSPHelper.getParameter(request, "addressId") ;
System.out.println("addressId: "+addressId);
 %>


<%
CommandContext jstlCommandContext = (CommandContext)request.getAttribute(ECConstants.EC_COMMANDCONTEXT );
System.out.println("JSTLEnvironmentSetup languageId: "+jstlCommandContext.getLanguageId());

 %>


Using PageContext to retrieve session values in a JSP page:

<c:set var="rsOrderId" value="${WCParam.orderId}"/>

System.out.println("RS OrderID: "+pageContext.getAttribute("rsOrderId"));


No comments:

Post a Comment