4 Replies Latest reply: Apr 30, 2011 10:33 AM by Sabitha RSS

    Sorting NSN no(partno) in my fast application

    Sabitha
      Hi,

      I am new to istore application development.I need to sort NSN numbers(part no) for my fast application.
      I am thinking to write a query for sorting process in java file.

      Here are the java files and the jsp's.

      package oracle.apps.ibe.xxnib.ao;

      import java.sql.SQLException;

      import oracle.apps.jtf.aom.transaction.TransactionScope;
      import oracle.apps.jtf.base.resources.FrameworkException;

      import oracle.jdbc.*;

      public class FastPack1 {

      private int _status;
      private boolean _success;

      public FastPack1() {
      }


      public boolean validateLogin(String aoddepotpassword) throws FrameworkException,
      SQLException {

      OracleConnection oracleconnection = null;
      OraclePreparedStatement oraclepreparedstatement = null;
      OracleResultSet oracleresultset = null;

      String p =
      "SELECT count(*) AS STATUS" + " FROM xxcust_depot_passwords" +
      " WHERE depot_password = :1";

      try {
      oracleconnection =
      (OracleConnection)TransactionScope.getConnection();
      if (oracleconnection == null)
      throw new FrameworkException("Error getting connection.");

      oraclepreparedstatement =
      (OraclePreparedStatement)oracleconnection.prepareStatement(p);

      oraclepreparedstatement.setString(1, aoddepotpassword);
      oracleresultset =
      (OracleResultSet)oraclepreparedstatement.executeQuery();

      if (oracleresultset.next()) {
      _status = oracleresultset.getInt(1);

      } else
      _status = 0;

      if (_status == 1)
      _success = true;
      else
      _success = false;


      } catch (FrameworkException frameworkexception) {
      _success = false;
      throw frameworkexception;
      } catch (SQLException sqlexception) {
      _success = false;
      throw sqlexception;
      } catch (Exception exception) {
      _success = false;
      throw FrameworkException.convertException(exception);
      }
      try {
      if (oracleresultset != null)
      oracleresultset.close();
      if (oraclepreparedstatement != null)
      oraclepreparedstatement.close();
      if (oracleconnection != null)
      TransactionScope.releaseConnection(oracleconnection);
      } catch (Exception exception1) {
      _success = false;
      }

      return _success;

      }


      }



      Jsp files

      <%@ include file="jtfincl.jsp"%>
      <%@ page language="java"%>
      <%@ page import="oracle.apps.ibe.displaymanager.*"%>
      <%@ page import="oracle.apps.ibe.store.*"%>
      <%
      final String JSP_NAME = "xxnib_ao_fastPackLogin.jsp";
      pageContext.setAttribute("_siteSelectionNotRequired", "false", PageContext.REQUEST_SCOPE);
      //pageContext.setAttribute("_signInPage", "true", PageContext.REQUEST_SCOPE);
      %>
      <%@ include file="ibeCZzpHeader.jsp"%>
      <%
      String errorMessage = null;
      errorMessage = IBEUtil.nonNull((String)pageContext.getAttribute("errorMessage",PageContext.REQUEST_SCOPE));

      if (errorMessage.equals(null)|| (errorMessage.equals("")))
      {
      if (pageContext.getAttribute("invalidfs", pc) != null) {
      if(IBE_logEnabled) IBEUtil.log(JSP_NAME, "Fast Pack Login failed.");
      errorMessage = "Invalid Password";
      }else{
      //if ca get ibe_se from request, display the session expired message
      if(request.getParameter("ibe_se")!=null)
      errorMessage = mm.getMessage("IBE_SESSION_EXPIRED_WARNING");
      }
      }
      pageContext.setAttribute("_pageTitle", "Fast Pack Login",PageContext.REQUEST_SCOPE);
      %>
      <%-- iStore Top page--%>
      <%@ include file="ibeCZzdTop.jsp"%>
      <%-- iStore Menu page--%>
      <%@ include file="ibeCZzdMenu.jsp"%>
      <%
      String browsebin = null;
      try
      {
      browsebin = DisplayManager.getTemplate("STORE_CTLG_SCT_BROWSE").getFileName();
      } catch (Exception e) {
      if(IBE_logEnabled) IBEUtil.log("xxnib_ao_fastPackLogin.jsp","Browse bin",e.getMessage());
      }
      %>
      <script language="JavaScript" type="text/javascript">
      function ValidateAndSubmit(thisform, depotpassword)
      {
      if (depotpassword.value=="")
      {
      alert( "Please enter your Depot Password." );
      depotname.focus();
      return false ;
      }
      thisform.submit();
      return true ;
      }

      </script>
      <form name="fastPackForm" method="post" action="xxnib_ao_fastPackpLogin.jsp?sitex=10020:22372:US">
      <input type="hidden" name="event" value=""></input>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" summary="">
      <tr>
      <td width="15%" valign="top" nowrap="nowrap">
      <jsp:include page="<%=browsebin%>"/>
      </td>
      <td>  </td>
      <td width="85%" valign="top">
      <table cellspacing="0" cellpadding="0" width="100%" border="0" summary="">
      <tr>
      <td width="100%">
      <img src="../OA_MEDIA/jtfutrpx.gif" alt="" width="1" height="1"></img>
      </td>
      </tr>
      </table>
      <jsp:include page="xxnib_ao_TopBrandBar.jsp" flush="true"/>
      <table cellspacing="0" cellpadding="0" width="100%" border="0" summary="">
      <tr>
      <td width="100%">
      <img src="../OA_MEDIA/jtfutrpx.gif" alt="" width="1" height="30"></img>
      </td>
      </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="">
      <tr>
      <td>
      <script language="JavaScript" src="ibeCButton.js"></script>
      <table border="0" cellspacing="0" cellpadding="0" width="100%" summary="">
      <tr>
      <td valign="top" width="15%">
      <br clear="all"></br>
      </td>
      <td valign="top" width="70%">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" summary="">
      <tr>
      <td class="pageTitle">Fastpack Access Control</td>
      </tr>
      <tr>
      <td>
      <img src="/OA_MEDIA/jtfutrpx.gif" height="1" width="1" alt=""></img>
      </td>
      </tr>
      </table>
      <table summary="" width="100%" border="0" cellspacing="2" cellpadding="0" align="center">
      <tr>
      <td class="prompt" width="99%">

      <%
      if(errorMessage != null && !errorMessage.trim().equals(""))
      {
      pageContext.setAttribute("msgText",errorMessage, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("msgType",oracle.apps.ibe.util.HtmlUtil.ERROR_MESSAGE, PageContext.REQUEST_SCOPE);
      String errMsgFile=DisplayManager.getTemplate("STORE_GENERIC_MESSAGE").getFileName();
      %>
                <jsp:include page="<%=errMsgFile%>" flush="true" /><br>
      <%
      }
           %>
      <img alt='' src="/OA_MEDIA/requiredicon_status.gif"></img>
      <%= mm.getMessage("IBE_PRMT_IND_REQUIRED_FIELD") %>
      </td>
      </tr>
      </table>
      <table summary="" width="100%" border="0" cellspacing="0" cellpadding="2">
      <tr>
      <td class="prompt" align="right" nowrap="nowrap">
      <img src="/OA_MEDIA/requiredicon_status.gif" alt=""></img>
      <label for="depotpassword">Depot Password:</label>
      </td>
      <td nowrap="nowrap">
      <input id="depotpassword" type="password" name="depotpassword" size="20"></input>
      <span class="prompt">(password case-sensitive)</span>
      </td>
      </tr>
      <tr>
      <td align="right"> </td>
      <td nowrap="nowrap">
      <script language="JavaScript">
      buttonGen("Login", "javascript:return ValidateAndSubmit(fastPackForm,depotpassword)");
      </script>
      </td>
      </tr>
      </table>
      </td>
      <td valign="top" width="15%">
      <br></br>
      </td>
      </tr>
      <tr>
      <td colspan="2">
      <p class=prompt><br><br><br>
      <%--
      MPC: Removed for PROD
      Example:<br>
      DEPOT_PASSWORD<br>
      DDDC<br>
      --%>
      <BR>
      </P>
      </td>
      </tr>
      </table>
      </td>
      </tr>
      </table>
      </td>
      </tr>
      </table>
      </form>
      <%@ include file="ibeCZzdBottom.jsp"%>
      <!-- xxnib_ao_fastPackLogin.jsp end -->

      fastplogin.jsp

      <%@ include file="jtfincl.jsp" %>
      <%--=========================================================================
      | Copyright (c)2000 Oracle Corporation, Redwood Shores, CA
      | All rights reserved.
      +===========================================================================
      |
      | FILE
      | xxnib_ao_fastPackpLogin.jsp - Fast Pack SignIn Process page
      |
      | DESCRIPTION
      | Sign In Process page for Custom Login
      |
      | HISTORY
      |
      | 05/9/2008 sgaddam Fast Pack Sign In Requirement
      +=======================================================================--%>
      <%@ page import="oracle.apps.ibe.xxnib.ao.*"%>
      <% //pageContext.setAttribute("_signInPage", "true", PageContext.REQUEST_SCOPE);%>
      <%@ include file="ibeCZzpHeader.jsp"%>
      <%
      final String JSP_NAME = "xxnib_ao_fastPackpLogin.jsp";
      String depotpassword = IBEUtil.nonNull(request.getParameter("depotpassword"));

      if(IBE_logEnabled) IBEUtil.log(JSP_NAME, "Start Fast Pack login");

      int status;
      FastPack1 fp = new FastPack1();
      try{
      if(fp.validateLogin(depotpassword))
      status = 1; //Login Success
      else
      status= 0; //Login Success
      }
      catch(Exception e){status=0;}


      if(status==0){
      if(IBE_logEnabled) IBEUtil.log(JSP_NAME, "Error ocurred during login user, status="+status);
      pageContext.setAttribute("invalidfs", "true", pc);
      //remain in the same page and display error message
      if(IBE_logEnabled){
      IBEUtil.log(JSP_NAME, "Aunthenticate fail, going back to login page");
      }
      %>
      <jsp:forward page="<%=DisplayManager.getTemplate(\"XXNIB_AO_FASTPACK_AUTH\").getFileName() %>" />
      <%
      }else {
      %>
      <jsp:forward page="ibeCCtpSctDspRte.jsp?section=10902&sitex=10020:22372:US" />
      <%}%>