hi frds

in my proj, a jsp file has prod type (either prod or non prod) if we select prod it will display prod related items, if not it will display non production item. but i want both to be displayed at a time.

action class:

[B] ArrayList [U]prodNonprod [/U]= getProductList(poTypeId.intValue(), productPattern, groupPattern);[/B]

private ArrayList getProductList(int poTypeId, String productPattern, String groupPattern) {

        String poType = SystemPrefManager.getInstance().getSystemPrefValue(SysEnv.PREF_PO_TYPE);

       if ( (poTypeId == 3 && poType.equals("false")) || (poTypeId == 0) ) // Production Orders;

[B]            return getPartsList(productPattern, groupPattern);

        else

            return getNonManufItemsList(productPattern);[/B]

    }

 

    private ArrayList getNonManufItemsList(String productPattern) {

        INonManufItemsManager nmiBG = NonManufItemsManagerBD.getNonManufItemsManagerBD();

       

        Collection itemCol = nmiBG.findItemsStartWith(productPattern);

        if (itemCol == null || itemCol.size() == 0)

            return null;

       

        ArrayList prodParams = null; // Object[] { prodGroupName, ArrayList products : String[] { prodId, prodName, prodSKU, description } }       

        prodParams = new ArrayList();

       

        ArrayList items = new ArrayList();

        prodParams.add( new Object[] { "Non-Manufacturing Items", items });

       

        Iterator iter = itemCol.iterator();

        while (iter.hasNext()) {       

           // NonManufItemsDTO item = (NonManufItemsDTO) iter.next();

            Object[] itemRec = (Object[]) iter.next();

            /*Object[] itemRec = new Object[] { item.getItemId(),

                                              item.getItemName(),

                                              item.getItemSKU(),

                                              item.getDescription(),

                                              item.getProductType()};*/            

                                                                 

            items.add(itemRec);

        }

       

        return prodParams;

    }

 

    private ArrayList getPartsList(String productPattern, String groupPattern) {

        ProductManager      productManager      = ProductManager.getInstance();

        ProductGroupManager productGroupManager = ProductGroupManager.getInstance();

       

        ArrayList prodParams = new ArrayList(); // Object[] { prodGroupName, ArrayList products : String[] { prodId, prodName, "" } }

       

        Collection groupList = null;

       

        if (groupPattern != null)

            groupList = productGroupManager.findProductGroupStartWith(groupPattern);

        else

            groupList = productManager.findProductStartWith(productPattern, true);

           

        if (groupList == null)

            return prodParams;

       

        Iterator groupIter = groupList.iterator();

        while (groupIter.hasNext()) {

            ProductGroupDTO productGroup = (ProductGroupDTO) groupIter.next();

            String          groupName    = productGroup.getGroupName();

            Collection      productCol   = productGroup.getProducts();

           

            if (productCol.size() > 0) {

                ArrayList products = new ArrayList();

                prodParams.add( new Object[] { groupName, products });

               

                Iterator productIter = productCol.iterator();               

                while (productIter.hasNext()) {

                  Object[] idNameTuple = (Object[]) productIter.next();

                                   

                  products.add( idNameTuple );

                }

            }

            else

                prodParams.add( new Object[] { groupName, null });

        }

      

        return prodParams;

    }

    private ArrayList getAllProductList(String productPattern, String groupPattern) {

        ArrayList arr = getPartsList(productPattern, groupPattern);

        arr.addAll(getNonManufItemsList(productPattern));

            return arr;

    }

   

}
<%--

  This displays the list of products in the interior table for PO -%>

 

<%@page import="java.util.*"%>

<%@page import="com.serus.modules.modPOManagement.config.POManagementModule"%>

<%@page import="com.serus.configuration.PermissionManager"%>

<%@page import="com.serus.controller.UserSession"%>

<%@page import="com.serus.configuration.SysEnv"%>

<%@page import="com.serus.core.systempreferences.service.SystemPrefManager"%>

 

<%

Integer poTypeId = (Integer) request.getAttribute("poTypeId");

String poType = SystemPrefManager.getInstance().getSystemPrefValue(SysEnv.PREF_PO_TYPE);

PermissionManager permManager = PermissionManager.getInstance();

UserSession userSession = (UserSession) session.getAttribute(UserSession.Key);

 

ArrayList [B]prodParams [/B]= (ArrayList) request.getAttribute("prodParams"); // Object[] { prodGroupName, ArrayList products : String[] { prodId, prodName } }

ArrayList prodNonprod = (ArrayList) request.getAttribute("prodNonprod");

boolean bAnyFound = false;

 

if (prodParams != null) {

  Iterator iter44 = prodParams.iterator();

  while (iter44.hasNext()) {

     Object[] prodString = (Object[]) iter44.next();

       ArrayList productList = (ArrayList) prodString[1];

               

     if (productList != null && productList.size() > 0)

        bAnyFound = true;

  }

}

if (bAnyFound) { %>

     

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

      <td width="10">&nbsp;</td>

    <td><span><b>Product Search List</b></span></td>

<%

      if (poTypeId != null && poTypeId.intValue() != 0 && permManager.hasSpecifiedPermission(userSession, POManagementModule.PERMISSION_NON_MANUF_ITEM_CREATE)) {

%>

      <td><input type='button' name='AddNewNonManuf' value='Add New Item' onClick='javscript:parent.addNewNonManufItem();'></td>

<%

      }

%>   

  </tr>

  <tr><td colspan="3" height="3"></td></tr>

  <tr>

      <td width="10">&nbsp;</td>

    <td colspan="2" valign="top">

        <select name="Product" size="20"

                class="control_size" style="width:380px;"

                onChange="parent.selectProduct(this.value)">

<%   for (int i = 0; i < prodParams.size(); i++) {

                  Object[] prodString = (Object[]) prodParams.get(i);

                  ArrayList productList = (ArrayList) prodString[1];

               

                if (productList == null || productList.size() == 0)

                    continue;

%>

                  <optgroup label="<%=(String) prodString[0]%>">

<%                for (int j = 0; j < productList.size(); j++ ) {

                        Object[] idNamePair   = (Object[]) productList.get(j);

                        String   id           = idNamePair[0].toString();

                String   name         = (String) idNamePair[1];

                        Object   intNameOrSKU = (Object) idNamePair[2];

                        Object   canOrder    = (Object) idNamePair[3]; // can order flag

                        String   displayName  = name;

                        String   eccn         = "";

                        String   scheduleB    = "";

                       

                        if (intNameOrSKU == null)

                              intNameOrSKU = name;

                             

                        // disabled display of internal name

                        //if (intNameOrSKU != null)

                        //   displayName = name + " (" + intNameOrSKU + ")";

                        if (poTypeId.intValue() == 3 && poType.equals("true") || (poTypeId.intValue() == 0)) {System.out.println(" true");}

                        else {System.out.println("false");}

            if ( (poTypeId.intValue() == 3 && poType.equals("false")) || (poTypeId.intValue() == 0)){ //canOrder - product

                              if (idNamePair[3] != null) {

                                    System.out.println(idNamePair[3]);

                                  canOrder = (Object) idNamePair[3];

                                  if (canOrder.toString().equalsIgnoreCase("1")) {

                                  String desc = "";

                                  if( idNamePair.length > 7) {

                                    desc         = (String) idNamePair[7]; // description

                                    System.out.println(desc);

                                  }

                                  if (idNamePair.length > 8) {

                                    if (idNamePair[8] != null)

                                      eccn            = idNamePair[8].toString();

                                 if (idNamePair[9]  != null)

                                      scheduleB = idNamePair[9].toString();                    

                              }

                                  String accountCodeId = "";

                                  if(idNamePair[12] != null){

                                    accountCodeId = idNamePair[12].toString();

                                  }

%>

                                    <option value="<%=id%>|<%=name%>|<%=intNameOrSKU%>|<%=desc%>||<%=accountCodeId%>|<%=eccn%>|<%=scheduleB%>"><%=displayName%></option>

<%                            }

                              }    

                        } else {

                              String   prodType = (String) idNamePair[4]; // Product Type

                              String accountCodeId = "";

                              if(idNamePair[5] != null){

                                    accountCodeId = idNamePair[5].toString();

                              } // ATTR_VALUE

%>

                        <option value="<%=id%>|<%=name%>|<%=intNameOrSKU%>|<%=canOrder%>|<%=prodType%>|<%=accountCodeId%>"><%=displayName%> <%=intNameOrSKU==null?"":"("+intNameOrSKU+")"%></option>

<%

                        }

                  } //end for

%>

help me frds,,,,,


i just want to display both the items when we select a prod type...

Uhm something like

//pseudo code
if (prod) {
  // display prod items
}
// display non-prod items

IOW always display the "non-prod" items and only display the "prod" items if that option is selected.

it is already displaying

if ( (poTypeId == 3 && poType.equals("false")) || (poTypeId == 0) ) // Production Orders;

            return getPartsList(productPattern, groupPattern);

        else

            return getNonManufItemsList(productPattern);

    }

i just want both prod n Non Prod to be displayed at the same time

:sigh:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.