John Murphy
Posts: 1
Nickname: johnmurphy
Registered: Jun, 2004
JSP Problem
Posted: Jun 17, 2004 2:51 AM
Advertisement
OK pretty simple problem for you guys. My full JSP is below When I try and run the line String john = removeChar(shipping_charge,com); it does not work just does not show an error. I cannot use the String.replace because the version of my SDK is too old. Help!! here is jsp <!-- $Header: TOO/LBU ibeCScdShowCartSummary.jsp 115.25.11581.3 2003/01/18 00:26:15 pleelalu ship $ --> <!-- Display quote line details --> <%--=========================================================== | Copyright (c)2000 Oracle Corporation, Redwood Shores, CA | All rights reserved. +============================================================= | | FILE | ibeCScdShowCartSummary.jsp - Display quote line details | | DESCRIPTION | | PARAMETERS (SOURCE) | | OBJECTS REFERENCED | | APIs REFERENCED | | JSPs REFERENCED | | HISTORY | TOO 3/jun/03 Changed codeline for display of the tax rate (because rate format was not ending after 2 decimals, but a long string of numbers | TOO 12/jun/03 Added new message: XXIBE_SMALL_ORDER_CHARGE - Extra Order Charge for small orders | LBU 02/jul/2003 Merged cells for small order charge. Removed nowrap for better printing | | +=========================================================--%> <%@ include file="ibeCZzpRuntimeIncl.jsp" %> <%@page import="java.math.*" %> <%@page import="java.util.*" %> <%@page import="java.lang.StringBuffer" %> <%@page import="java.text.NumberFormat" %> <%@page import="oracle.apps.jtf.base.interfaces.MessageManagerInter" %> <%@page import="oracle.apps.jtf.base.resources.*" %> <%@page import="oracle.apps.jtf.util.*" %> <%@page import="oracle.apps.ibe.displaymanager.*" %> <%@page import="oracle.apps.ibe.shoppingcart.quote.*" %> <%@page import="oracle.apps.ibe.shoppingcart.util.*" %> <%! public static String removeChar(String s,char c){ StringBuffer sb = new StringBuffer(s); for(int i = sb.length() - 1;i >= 0;i--){ if(sb.charAt(i) == c){ sb.deleteCharAt(i); } } return sb.toString(); } %> <% IBEUtil.log("ibeCScdShowCartSummary.jsp", "begin"); ShoppingCart shopCart = (ShoppingCart) pageContext.getAttribute("shopCart", PageContext.REQUEST_SCOPE); String htmlTableClass = (String) pageContext.getAttribute("htmlTableClass", PageContext.REQUEST_SCOPE); htmlTableClass = ("false".equals(htmlTableClass))?"":"tableDataCell"; // added 1/28/02: more logic for the case where numOfCol is passed in int numOfCol = 0; try { String numOfColStr = (String) pageContext.getAttribute("numOfCol", PageContext.REQUEST_SCOPE); numOfCol = Integer.parseInt(numOfColStr); } catch(Exception e) { IBEUtil.log("ibeCScdShowCartSummary.jsp", "numOfCol's not passed in"); } String parentPageVL = (String) pageContext.getAttribute("parentPageVL", PageContext.REQUEST_SCOPE); parentPageVL=parentPageVL==null?"CART":parentPageVL; boolean isParentPageVLQUOTE = "CART".equals(parentPageVL); boolean isParentPageVLQUOTEDet = "CARTDET".equals(parentPageVL); boolean isParentPageVLORDREV = "ORDREV".equals(parentPageVL); boolean isParentPageVLORDSUMM = "ORDSUMM".equals(parentPageVL); boolean isParentPageVLQUOTEPRINT = "QUOTEPRINT".equals(parentPageVL); boolean isParentPageVLXPRESS = "XPRESS".equals(parentPageVL); if (numOfCol == 0) { if (isParentPageVLQUOTE) numOfCol = 7; else if (isParentPageVLQUOTEDet) numOfCol = 7; else if (isParentPageVLORDREV) numOfCol = 7; else if (isParentPageVLORDSUMM) numOfCol = 7; else if (isParentPageVLQUOTEPRINT) numOfCol = 6; } pageContext.setAttribute("numOfCol", String.valueOf(numOfCol), PageContext.REQUEST_SCOPE); IBEUtil.log("ibeCScdShowCartSummary.jsp", "numOfCol="+numOfCol); boolean removeFlag = false; if ("true".equals(pageContext.getAttribute("removeFlag", PageContext.REQUEST_SCOPE))) removeFlag =true; boolean checkSuppFlag = false; if ("true".equals(pageContext.getAttribute("checkSuppFlag", PageContext.REQUEST_SCOPE))) checkSuppFlag =true; boolean updateFlag = false; if ("true".equals(pageContext.getAttribute("updateFlag", PageContext.REQUEST_SCOPE))) updateFlag =true; MessageManagerInter mmi1 = Architecture.getMessageManagerInstance(); boolean isSalesRep = RequestCtx.userIsSalesRep(); %> <table class="<%=htmlTableClass%>" cellspacing="0" cellpadding="0" width= "100%" border="0"> <tr> <td nowrap width="90%"> <% if (removeFlag && (isParentPageVLQUOTE)) { %> <input type="button" name="Empty.x" value="<%= mmi1.getMessage("IBE_PRMT_SC_REMOVE_ALL") %>" onClick="otherTransactionSubmit('EMPTY');return true;"> <% } %> <% if (updateFlag && (isParentPageVLORDREV || isParentPageVLQUOTE || isParentPageVLXPRESS) ) { %> <input type="button" value="<%=mmi1.getMessage("IBE", "IBE_PRMT_UPDATE_G")%>" name="Update.x" onClick="checkNeedToUpdateQuantity ();return true;"> <% } // 9/20/01 - note: subtotal html class was: class="tableTotal" %> </td> <td nowrap align="right" width="9%"><%=mmi1.getMessage("IBE", "IBE_PRMT_SUBTOT_COL")%></td> <td nowrap align="right" width="1%"><%= shopCart.getSubTotalPrice() %></td> </tr> <tr> <td nowrap align="right" width="90%"> </td> <td nowrap align="right" width="9%"> <%=mmi1.getMessage("IBE", "IBE_PRMT_SHIP_HAND_COLON") %> </td> <td nowrap align="right" width="1%"> <%= shopCart.getShippingAndHandling() %></td> </tr> <% // added 9/25/01 if (isSalesRep) { %> <tr> <td nowrap align="right" width="90%"> </td> <td nowrap align="right" width="9%"> <%=mmi1.getMessage("IBE", "IBE_PRMT_TAX_COL") %></td> <td nowrap align="right" width="1%"> <%= shopCart.getTax() %></td> </tr> <% } else { // added 7/8/01: tax details //TaxInfo [] taxInfos = TaxInfo.getTaxInfo(shopCart.getCartId(), shopCart.getCurrencyCode()); TaxInfo [] taxInfos = shopCart.getTaxInfo(); if ((taxInfos != null) && (taxInfos.length != 0)) { int taxInfosSize = taxInfos.length; int currency_position = 1; double n_tax_rate = 0; double n_tax_amount = 0; String total_price = shopCart.getTotalPrice(); String tax_amount = shopCart.getTax(); String shipping_charge = shopCart.getShippingAndHandling(); if (shipping_charge.substring(0,1) == "S") { currency_position=2; } String currency_symbol = shipping_charge.substring(0,currency_position); shipping_charge = shipping_charge.substring(currency_position); char comp = ','; String john = removeChar(shipping_charge,com); for (int i=0; i < taxInfosSize; i++) { %> <tr> <td nowrap align="right" width="90%"> </td> <%-- TOO changed line below 3/jun/03: tax rate <td nowrap align="right" width="9%"> <%=taxInfos.getPrintedTaxName() %>(<%=mmi1.getMessage("IBE", "IBE_PRMT_SC_RATE_COLON") %> <%=taxInfos.getTaxRate()%>%):</td> --%> <td nowrap align="right" width="9%"> <%=taxInfos.getPrintedTaxName() %>:</td> <td nowrap align="right" width="1%"> <%=taxInfos.getTaxAmount() %></td> </tr> <% %> <tr> <td nowrap align="right" width="90%"> </td> <td nowrap align="right" width="9%"> John Test </td> <td nowrap align="right" width="1%"> <%= shipping_charge %></td> </tr> <% // 9/20/01 - note: total html class was: class="pageTotal" %> <tr> <td class="tableTotal" nowrap align="right" width="90%"> </td> <td class="tableTotal" nowrap align="right" width="9%"> </td> <td nowrap align="right" width="1%"> <hr> </td> </tr> <tr> <td nowrap align="right" width="90%"> </td> <td nowrap align="right" width="9%"><b><%=mmi1.getMessage("IBE", "IBE_PRMT_SC_TOTAL2") %></b></td> <td nowrap align="right" width="1%"><b><%= shopCart.getTotalPrice() %></b></td> </tr> <% // TOO added - new message: XXIBE_SMALL_ORDER_CHARGE - Extra Order Charge for small orders } } } %> <tr> <td align="left" colspan="3"><font size="-6"><%=mmi1.getMessage("IBE", "XXIBE_SMALL_ORDER_CHARGE") %></font></td> </tr> <% //String newMessage = mmi1.getMessage("IBE", "IBE_PRMT_CRT_CSTM_MSG1"); try { String newMessage =DisplayManager.getTextMedia("IBE_PRMT_CRT_CSTM_MSG1"); %> <tr> <td colspan=3> <%=newMessage%> </td> </tr> <% } catch (MediaException e) { } %> <% // cart level support boolean containSVA = shopCart.containsServiceableItems(); String supportLvl = shopCart.getSupportLevel(); boolean isNoneSetup = (ShoppingCartUtil.NONE_SETUP).equals(supportLvl); // System.out.println("ibeCScdShowCartSummary - supportLvl="+supportLvl); if (IBEUtil.useFeature("IBE_USE_SUPPORT") && IBEUtil.useFeature("IBE_USE_SUPPORT_CART_LEVEL") && containSVA && !isNoneSetup && !isParentPageVLORDREV && !isParentPageVLORDSUMM && !isParentPageVLQUOTEPRINT && !isParentPageVLQUOTEDet) { pageContext.setAttribute("onChangeAction","onChange=\"updateSupportSubmit ();return true;\"",PageContext.REQUEST_SCOPE); //? if ((ShoppingCartUtil.INVALID_SUPP).equals(supportLvl)) { pageContext.setAttribute("selMsg", AOLMessageManager.getMessageSt("IBE_PRMT_SC_SELECT"), PageContext.REQUEST_SCOPE); } pageContext.setAttribute("supportLevel", supportLvl, PageContext.REQUEST_SCOPE); %> <tr><td colspan="<%=numOfCol%> nowrap align="left" class="tableDataCell"><hr size="1" noshade></td></tr> <% String suppFile = DisplayManager.getTemplate("STORE_CART_SEL_SUPP").getFileName(); %> <tr> <td class="tableDataCell" valign="top" align="left" colspan="<%=numOfCol%>"> <B><%= AOLMessageManager.getMessageSt("IBE_PRMT_SC_SELSUPP_COL") %></B><BR> <jsp:include page="<%= suppFile %>" flush="true" /> <% if (updateFlag && (isParentPageVLORDREV || isParentPageVLQUOTE) ) { %> <input type="button" value="<%=mmi1.getMessage("IBE", "IBE_PRMT_UPDATE_G")%>" name="Update.x" onClick="checkNeedToUpdateQuantity ();return true;"> <% } %> </td> </tr> <% } // cart level support %> <% if (isParentPageVLQUOTE || isParentPageVLQUOTEDet) { try { // added 6/6/01 //String newMessage2 = mmi1.getMessage("IBE", "IBE_PRMT_CRT_CSTM_MSG2"); String newMessage2 = DisplayManager.getTextMedia("IBE_PRMT_CRT_CSTM_MSG2"); %> <tr> <td colspan=3> <%=newMessage2%> </td> </tr> <% } catch (MediaException e) { } } %> </table> <% IBEUtil.log("ibeCScdShowCartSummary.jsp", "end"); %> <!-- ibeCScdShowCartSummary.jsp end -->