Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 最后一行在DisplayTag表中重复_Jsp_Jakarta Ee_Struts_Displaytag - Fatal编程技术网

Jsp 最后一行在DisplayTag表中重复

Jsp 最后一行在DisplayTag表中重复,jsp,jakarta-ee,struts,displaytag,Jsp,Jakarta Ee,Struts,Displaytag,我在displaytag表中获得相同的值,即它为所有行显示相同的值(即最后一行值) 下面是我在formbean中设置值的操作类片段 public class FormIdSearch extends Action { ResourceBundle rsBundle = ResourceBundle.getBundle("com.mindcraft.resources.ApplicationResource"); Collection formbeanCol = new Arra

我在displaytag表中获得相同的值,即它为所有行显示相同的值(即最后一行值)

下面是我在formbean中设置值的操作类片段

public class FormIdSearch extends Action {

    ResourceBundle rsBundle = ResourceBundle.getBundle("com.mindcraft.resources.ApplicationResource");
    Collection formbeanCol = new ArrayList();

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        Collection a = new ArrayList();
        FormBean formbean = (FormBean)form;
        ActionForward forward = new ActionForward();
        ActionMessages message = new ActionMessages();
        CMBConnection connection=new CMBConnection();
        HRMSUtill hrms = new HRMSUtill();
        IngUtill ing = new IngUtill();
        AppUtill au = new AppUtill();
        try{


            String polNo=formbean.getPolicyNo();
            String appN=(String)request.getAttribute("appno");
            System.out.println("Application No.1" + appN);
            String applnNo=formbean.getAppno();
            System.out.println("Application No.2" + applnNo);
            String appNo=(String)request.getParameter("appno");
            System.out.println("Application No.3" + appNo);
            HashMap<String, String> inpMap = new HashMap<String, String>();

            CMBSearchResults srchResults = null;
            CMBItem item = null;

            inpMap.put(rsBundle.getString("CM_INDEXCLASS_ADVISORSLICENSING"), rsBundle.getString("CM_INDEXCLASS_ADVISORSLICENSING"));
            //inpMap.put(rsBundle.getString("CM_INDEXCLASS_ADVISORSLICENSING"), rsBundle.getString("CM_INDEXCLASS_ADVISORSLICENSING"));
            inpMap.put(rsBundle.getString("CM_COMMON_ADVISORCODE"), "AA5555");
            inpMap.put(rsBundle.getString("CM_COLNAME_ADVISORCODE"), rsBundle.getString("CM_COLNAME_ADVISORCODE"));
            inpMap.put(rsBundle.getString("CM_COMMON_APPNUMBER"), appNo);
            inpMap.put(rsBundle.getString("CM_COLNAME_APPNUMBER"), rsBundle.getString("CM_COLNAME_APPNUMBER"));

            String winId=(String)request.getSession().getAttribute("windowsId");
            String empId = au.getEmpCodeOnWinId(winId);

            System.out.println("winId===="+winId);
            String ingBrCode="";

            if(hrmsBrCode1.equalsIgnoreCase(ingBrCode1))
            {

                ServletContext servletcontext = request.getSession().getServletContext();
                String cmbicmsrvsPath = servletcontext.getRealPath("WEB-INF/cmbicmsrvs.ini");
                System.out.println("cmbicmsrvsPath "+cmbicmsrvsPath);

                String icmsrvfilePath=servletcontext.getRealPath("WEB-INF/cmbicmsrvs.ini");
                String icmmenvfilePath=servletcontext.getRealPath("WEB-INF/cmbicmenv.ini");

                connection = new CMBConnection();
                //CMConnectionPool cmConnect = new CMConnectionPool();
                CMSearchDocuments searchDoc = new CMSearchDocuments();


                CMConnectionPool.setIcmenvfile(icmmenvfilePath);
                CMConnectionPool.setIcmsrvfile(icmsrvfilePath);
                //System.out.println("HHHEYEEEYYEYE TRUE.........3");
                connection=CMConnectionPool.getConnection();


                srchResults=searchDoc.searchForDocumentsInCM(connection, inpMap);

                Integer searchCount=srchResults.getCount();

                System.out.println("searchCount "+searchCount);
                LoggerUtil.logger.debug("searchCount "+searchCount);
                HttpSession session = request.getSession(false);
                session.setAttribute("searchCount",searchCount.toString());
                for (int i = 0; i < searchCount; i++) 
                   {
                    item = srchResults.getItem(i);

                    a=getDocumentMetaData(item,formbean);
                      String pid=item.getPidString();
                      request.setAttribute("pid", pid);
                      formbean.setPid(pid);

                   }
                request.setAttribute("formbeanCol", a);
                Object ia[] = a.toArray(); 
                int sum = 0; 
                // sum the array 
                for(int i=0; i<ia.length; i++) {
                sum += ((Integer) ia[i]).intValue(); 
                System.out.println("Sum is: " + sum); 
                } 

                if(searchCount>0){
                    //for (int i = 0; i < srchResults.getCount(); i++){
                    item = srchResults.getItem(searchCount-1);
                    //getDocumentMetaData(item);

                    String pid = item.getPidString();
                    System.out.println("pid "+pid);
                    request.setAttribute("pid", pid);

                    forward=mapping.findForward("success");

                }
                else
                {   
                    forward=mapping.findForward("failure");
                    message.add("ErrorOccurred", new ActionMessage("Invalid.SearchResult"));
                }
                System.out.println("Search Done");
                LoggerUtil.logger.debug("Search Done");
            }
            else
            {

                System.out.println("No Record Found");
                LoggerUtil.logger.debug("No Record Found");

                forward=mapping.findForward("failure");
                message.add("ErrorOccurred", new ActionMessage("Invalid.SearchResult"));
            }
            saveMessages(request, message);
        }
        catch(Exception e){
            forward=mapping.findForward("failure");
            LoggerUtil.logger.debug("Exception in FormIdSearch ",e);
            e.printStackTrace();
        }
        finally{
            try{
                if(connection!=null){
                    CMConnectionPool.freeConnection(connection);
                }
            }
            catch(Exception e)
            {
                forward=mapping.findForward("failure");
                LoggerUtil.logger.debug("Exception in FormIdSearch in finally block Closing CM Connection",e);
            }
        }
        return forward;
    }
     public Collection getDocumentMetaData(CMBItem item,FormBean formbean)
     throws CMBException, Exception 
{

     // Get document metadata attributes
        String FormID = item.getAttrValue(0);
        System.out.println(item.getAttrValue(0));
        System.out.println(item.getAttrValue(1));
        System.out.println(item.getAttrValue(2));
        System.out.println(item.getAttrValue(3));
        System.out.println(item.getAttrValue(4));
        formbean.setFormID(FormID);
        String MainDocument=item.getAttrValue(1);
        formbean.setMainDocument(MainDocument);
        String SubDocument=item.getAttrValue(2);
        formbean.setSubDocument(SubDocument);
        formbean.setAppNumber(item.getAttrValue(3));
        formbean.setBranchCode(item.getAttrValue(4));
        formbean.setAdvisor_NAME(item.getAttrValue(5));
        formbean.setAdvisor_Code(item.getAttrValue(6));


         formbeanCol.add(formbean);
         System.out.println("formbeanCol.size() "+formbeanCol.size());


  return formbeanCol;
}
}  
公共类FormIdSearch扩展了操作{
ResourceBundle rsBundle=ResourceBundle.getBundle(“com.mindcraft.resources.ApplicationResource”);
集合formbeanCol=newarraylist();
公共ActionForward执行(ActionMapping映射、ActionForm表单、,
HttpServletRequest请求,HttpServletResponse响应)
抛出异常{
集合a=新的ArrayList();
FormBean FormBean=(FormBean)表单;
ActionForward=新的ActionForward();
ActionMessages=新建ActionMessages();
CMB连接=新的CMB连接();
HRMSUtill hrms=新的HRMSUtill();
Ingutil ing=新的Ingutil();
AppUtill au=新的AppUtill();
试一试{
字符串polNo=formbean.getPolicyNo();
String appN=(String)request.getAttribute(“appno”);
系统输出打印项次(“第1号申请”+appN);
字符串applnNo=formbean.getAppno();
System.out.println(“第2号申请”+applnNo);
字符串appNo=(字符串)request.getParameter(“appNo”);
System.out.println(“第3号申请”+appNo);
HashMap inpMap=新的HashMap();
CMBSearchResults srchResults=null;
CMBItem项=空;
inpMap.put(rsBundle.getString(“CM_INDEXCLASS\u advisorLicensing”)、rsBundle.getString(“CM_INDEXCLASS\u advisorLicensing”);
//inpMap.put(rsBundle.getString(“CM_INDEXCLASS\u advisorLicensing”)、rsBundle.getString(“CM_INDEXCLASS\u advisorLicensing”);
inpMap.put(rsBundle.getString(“CM_COMMON_ADVISORCODE”),“AA5555”);
inpMap.put(rsBundle.getString(“CM_COLNAME\u ADVISORCODE”)、rsBundle.getString(“CM_COLNAME\u ADVISORCODE”);
inpMap.put(rsBundle.getString(“CM_COMMON_APPNUMBER”)、appNo);
inpMap.put(rsBundle.getString(“CM\u COLNAME\u APPNUMBER”)、rsBundle.getString(“CM\u COLNAME\u APPNUMBER”);
字符串winId=(字符串)request.getSession().getAttribute(“windowsId”);
字符串empId=au.getEmpCodeOnWinId(winId);
System.out.println(“winId==”+winId);
字符串ingBrCode=“”;
if(hrmsBrCode1.equalsIgnoreCase(ingBrCode1))
{
ServletContext=request.getSession().getServletContext();
字符串cmbicsrvpath=servletcontext.getRealPath(“WEB-INF/cmbicsrvs.ini”);
System.out.println(“cmbicsrvspath”+cmbicsrvspath);
字符串icmsrvfilePath=servletcontext.getRealPath(“WEB-INF/cmbicsrvs.ini”);
字符串icmmenvfilePath=servletcontext.getRealPath(“WEB-INF/cmbicmenv.ini”);
连接=新连接();
//CMConnectionPool cmConnect=新的CMConnectionPool();
CMSearchDocuments searchDoc=新的CMSearchDocuments();
CMConnectionPool.setIcmenvfile(icmmenvfilePath);
CMConnectionPool.setIcmsrvfile(icmsrvfilePath);
//System.out.println(“hhheyeeyeye-TRUE………3”);
connection=CMConnectionPool.getConnection();
srchResults=searchDoc.searchForDocumentsInCM(连接,inpMap);
整数searchCount=srchResults.getCount();
System.out.println(“searchCount”+searchCount);
LoggerUtil.logger.debug(“searchCount”+searchCount);
HttpSession session=request.getSession(false);
session.setAttribute(“searchCount”,searchCount.toString());
对于(int i=0;i<display:table name="formbeanCol" export="false" pagesize="20" sort="list" id="data" requestURI="" class="tablelist">

        <display:column title="advisor_Code" sortable="true" property="advisor_Code"></display:column>
        <display:column title="formID" sortable="true" property="formID"></display:column>
        <display:column title="mainDocument" sortable="true" property="mainDocument"></display:column>
        <display:column title="SubDocument" sortable="true" property="subDocument"></display:column>
        <display:column title="AppNumber" sortable="true" property="appNumber"></display:column>
        <display:column title="branchCode" sortable="true" property="branchCode"></display:column>
        <display:column title="advisor_NAME" sortable="true" property="advisor_NAME"></display:column>

</display:table>
public Collection getDocumentMetaData(CMBItem item,FormBean formbean)
throws CMBException, Exception 
{
    FormBean bean = new FormBean();

    // Get document metadata attributes
    String FormID = item.getAttrValue(0);
    bean.setFormID(FormID);

    // etc

    formbeanCol.add(bean);
    return formbeanCol;
}