aspose file tools*
The moose likes Struts and the fly likes facing problem with struts  tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "facing problem with struts  tags" Watch "facing problem with struts  tags" New topic
Author

facing problem with struts tags

Shyam Sunder
Greenhorn

Joined: Dec 23, 2006
Posts: 24
Hi, I am facing a problem with the struts tags.
I am not able to display the records

This is my jsp and iam


<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>


<html:html>
<head>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>

</head>
<body>
<html:form action="/aSDReport.do?method=exportToPdf">


<table width="100%" border="" cellspacing="0" cellpadding="0">
<%System.out.println("inside table "); %>

<tr>
<td>Transaction Date </td>
<td>Type of transaction </td>
<td>Number / Nominal</td>
<td>Security Name</td>
<td>Price in Local Currency</td>
<td>Local Currency</td>
<td>exchange Rate</td>
<td>Transaction Type</td>
</tr>

<tr>
<%System.out.println("inside tr "); %>
<logic:equal name="SDForm" property="status" value="FAILURE">
<%System.out.println("inside failure "); %>
<h4><font color=red>Records Not Available For This Client</h4>
</logic:equal>

<logic:equal name="SDForm" property="status" value="SUCCESS">
<%System.out.println("inside equal "); %>
<logic resent name="SDForm" property="aStampDutyReport">

<%System.out.println("insde present"); %>
<logic:iterate id="data" name="SDForm" property="aStampDutyReport">
<%System.out.println("inside iterate "); %>
<td align="left" valign="middle" bgcolor="#FFFFFF">

<bean:write name="data" property="Transaction_Date" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Shares_per_Quantity" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Security_Name" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Price_In_LC" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Local_Currency" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="XChg_Rate" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Transaction_Type" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Gross_Amount_Base" />
</td>
<td align="left" valign="middle" bgcolor="#FFFFFF">
<bean:write name="data" property="Gross_Amount_Local" />
</td>
</logic:iterate>

</logic resent>
</logic:equal>
</table>
<input type="Submit" Value="Export To PDF">
</html:form>
</body>
</html:html>
****************************************************************************

// This is my action class

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.statestreet.sda.bo.StampDutyReportBD;
import com.statestreet.sda.forms.StampDutyReportForm;
import com.statestreet.sda.util.SDALogger;
import com.statestreet.sda.vo.StampDutyReportVO;

/**
*
*getStampDutyReport
*/
public class StampDutyReportAction extends DispatchAction{
public ActionForward getStampDutyReport(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {

System.out.println("inside StampDutyReportAction");

ArrayList alSDReport = null;
StampDutyReportForm SDForm = null;
HttpSession session = null;
String target = null;
int returnvalue = 0;
StampDutyReportBD stampDutyReportBD = null;
StampDutyReportVOstampDutyReportVO = null;

try {

System.out.println("inside StampDutyReportAction Try");

stampDutyReportBD = new StampDutyReportBD();
SDForm =(StampDutyReportForm)form;
System.out.println("before VO");
stampDutyReportVO = stampDutyReportBD.getStampDutyReport(SDForm);
System.out.println("after BD");

SDForm.setAStampDutyReport(stampDutyReportVO.getAStampDutyReport());
alSDReport=stampDutyReportVO.getAStampDutyReport();
for(int i = 0; i<alSDReport.size();i++) {
System.out.println("**^^^ "+alSDReport.get(i));
}
SDForm.setStatus(stampDutyReportVO.getStatus());
System.out.println("*****"+stampDutyReportVO.getStatus());

request.setAttribute("SDForm", SDForm);

if(stampDutyReportVO==null){
System.out.println("in VO)");
target = "FAILURE";
}
else {
target = "SUCCESS";
}
} catch (Exception e) {
SDALogger.logError( this, "PBOEException in CheckListDispatchAction@createCheckList()", e);
}
System.out.println("Targeted :> :> " + target);
System.out.println("before StampDutyReportAction return ");
return mapping.findForward(target);
}


/* public boolean exportToPdf() {
StampDutyReportVO stampDutyReportVO = null;
StampDutyReportBD stampDutyReportBD=null;
boolean xmlCreate = false;
try {
xmlCreate = stampDutyReportBD.exportToPdf();
}catch(Exception e) {
e.printStackTrace();
}
return xmlCreate;
}*/
}

****************************************************************************
//This is my DAO Class
/**
*
*/
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;

import com.statestreet.sda.util.database.ConnectionManager;
import com.statestreet.sda.forms.StampDutyReportForm;
import com.statestreet.sda.vo.StampDutyReportVO;
/**
* *
*/

public class OracleStampDutyReportDAO implements IStampDutyReportDAO {
public StampDutyReportVO getStampDutyReportDAO(StampDutyReportForm form)
{
System.out.println("inside OracleStampDutyReportDAO");
StampDutyReportVO stampDutyReportVO = null;
HashMap hmSDReport = null;
ArrayList aSDReport=null;
ResultSet aResultSet = null;
try {
stampDutyReportVO = new StampDutyReportVO();
System.out.println("inside OracleStampDutyReportDAO try block");
//stampDutyReportForm = new StampDutyReportForm();
ConnectionManager conManager = new ConnectionManager();
System.out.println("inside after connection Manager");
aResultSet = conManager.getResultSet("SELECT TX.TRD_DT,TX.SHRPAR_QTY,TX.SECURITY_NAME,TX.UNTPRC_LAM,TX.CRNCY_CD_LOC,TX.CRNT_XCHG_RT,TX.TXN_TYPE_CD,TX.GROS_AMT_BAM,TX.GROS_AMT_LAM,TX.BLUE_CARD FROM WK_TRANS_ADJST TX,WK_CLIENT CL WHERE CL.CLIENT_LONG_NM='TATA' AND TX.CLIENT_ID = CL.CLIENT_ID AND TX.FINAL_CHK_FLG ='Y' AND TX.TRD_DT <= TO_Date( '12/11/2006 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM') AND TX.TRD_DT > TO_Date( '11/11/2006 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM')");
System.out.println(aResultSet);
aSDReport = new ArrayList();
while (aResultSet.next()){
hmSDReport = new HashMap();
hmSDReport.put("Transaction_Date",aResultSet.getString("TRD_DT"));
System.out.println(aResultSet.getString("TRD_DT"));
hmSDReport.put("Shares_per_Quantity",aResultSet.getString("SHRPAR_QTY"));
System.out.println(aResultSet.getString("SHRPAR_QTY"));
hmSDReport.put("Security_Name",aResultSet.getString("SECURITY_NAME"));
System.out.println(aResultSet.getString("SECURITY_NAME"));
hmSDReport.put("Price_In_LC",aResultSet.getString("UNTPRC_LAM"));
System.out.println(aResultSet.getString("UNTPRC_LAM"));
hmSDReport.put("Local_Currency",aResultSet.getString("CRNCY_CD_LOC"));
System.out.println(aResultSet.getString("CRNCY_CD_LOC"));
hmSDReport.put("XChg_Rate",aResultSet.getString("CRNT_XCHG_RT"));
System.out.println(aResultSet.getString("CRNT_XCHG_RT"));
hmSDReport.put("Transaction_Type",aResultSet.getString("TXN_TYPE_CD"));
System.out.println(aResultSet.getString("TXN_TYPE_CD"));
hmSDReport.put("Gross_Amount_Base",aResultSet.getString("GROS_AMT_BAM"));
System.out.println(aResultSet.getString("GROS_AMT_BAM"));
hmSDReport.put("Gross_Amount_Local",aResultSet.getString("GROS_AMT_LAM"));
System.out.println(aResultSet.getString("GROS_AMT_LAM"));
hmSDReport.put("Blue_Card",aResultSet.getString("BLUE_CARD"));
System.out.println(aResultSet.getString("BLUE_CARD"));

aSDReport.add(hmSDReport);

}
if(aSDReport.size() > 0) {
stampDutyReportVO.setStatus("SUCCESS");
}
else
{
stampDutyReportVO.setStatus("FAILURE");
}
System.out.println("inside OracleStampDutyReportDAO after result Set");

stampDutyReportVO.setAStampDutyReport(aSDReport);
// System.out.println(stampDutyReportVO.setStatus());
aResultSet.close();
conManager.commit();
conManager.closeConnection();
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("inside OracleStampDutyReportDAO before Return");
return stampDutyReportVO;
}
}
***************************************************************************

/**
*
*/
package com.statestreet.sda.forms;

import java.util.ArrayList;

import org.apache.struts.action.ActionForm;

/**
*
*/
public class StampDutyReportForm extends ActionForm{

private ArrayList aStampDutyReport = null;
private String status = null;
/**
* @return Returns the aStampDutyReport. status
*/
public ArrayList getAStampDutyReport() {
return aStampDutyReport;
}
/**
* @param stampDutyReport The aStampDutyReport to set.
*/
public void setAStampDutyReport(ArrayList stampDutyReport) {
aStampDutyReport = stampDutyReport;
}
/**
* @return Returns the status.
*/
public String getStatus() {
return status;
}
/**
* @param status The status to set.
*/
public void setStatus(String status) {
this.status = status;
}

}

And VO class is same as Form bean class.

My dought is control is not coming in to that logic:equal tag
[ December 27, 2006: Message edited by: Shyam Sunder ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Did you get it working? It is likely that you did not get a response because you provided very few details. Could you expand on "I am not able to display the records"?

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: facing problem with struts tags
 
Similar Threads
Usage of Struts tags
jsp & HTML
facing problem with tags
using ajax and struts iterate tags
&gt;html:text &lt; default value