I want to put processing bar on my page when requesting is taking too much time to write html file. So I used execAndWait
interceptor in Strust2 , But page is not able to redirect on wait.jsp.
Struts.xml
<action name="htmlUtility"
class="com.support.action.ActivityAction" method="htmlUtility">
<interceptor-ref name="execAndWait">
<param name="delay">1000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
<result name="wait">/pages/reportingview/ftl/wait.jsp</result>
<result name="success" type="stream">
<param name="contentType">application/octet-stream</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment;filename="${filename}"</param>
<param name="bufferSize">1024</param>
</result>
</action>
Wait.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>wait</title>
<meta http-equiv="refresh" content="0.5;url='<s:url includeParams="all" />'">
</head>
<body>
<p>your request is processing...</p>
<img src="ajax-loader.gif"/>
</body>
</html>
ActivityAction-
private InputStream saveAsHTML() {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PrintStream printhtml = new PrintStream(buffer);
String htmlheader="<html><style type='text/css'>.dataTable "
+ "{width:100%; font-family:Verdana, Geneva, sans-serif;border-top:1px solid #ccc; border-right:1px solid #ccc;+}"
+ ".dataTable th {background:#f1f1f1; text-align:left;padding:5px;font-weight:normal; border-bottom:1px solid #ccc;"
+ " border-left:1px solid #ccc;}.dataTable tr {}.dataTable td { padding:5px;border-bottom:1px solid #ccc;border-left:1px solid #ccc;}.txtCenterAlign "
+ "{text-align:center !important;}.transparentBg{ background:transparent !important;}</style><head>";
if(activityType.equalsIgnoreCase(SupportWebConstants.ACCESSPOINT_CONSTANT)){
htmlheader+="<title>Access Point Activity Report</title></head><body> <table width='100%' border='0' cellpadding='0' cellspacing='0' class='dataTable'><thead> <tr>"
+ "<th colspan='9' class='txtCenterAlign'>Access Point Activity Report</th></tr><tr>";
}
else
{
htmlheader+="<title>Credential Holder Activity Report</title></head><body> <table width='100%' border='0' cellpadding='0' cellspacing='0' class='dataTable'><thead> <tr>"
+ "<th colspan='9' class='txtCenterAlign'>Credential Holder Activity Report</th></tr><tr>";
}
for (String columnName : ReportHeaderMapper.getColumnList(activityType)) {
htmlheader+= "<th class='transparentBg'><b>"+columnName+"</b></th>";
}
htmlheader+="</tr></thead> <tbody>";
String tableData="";
String htmlfooter=" </tbody></body></html>";
activityList = activityDTOList.getActivityDTOs();
ReportHeaderMapper.setData(activityList);
for (List<String> activityDTO : ReportHeaderMapper.getAccessPointAllRows(activityType)) {
tableData= tableData+"<tr>";
for (String data : activityDTO) {
tableData+= "<td>"+data+"</td>";
}
tableData=tableData+"</tr>";
}
printhtml.println(htmlheader+tableData+htmlfooter);
printhtml.close();
LOGGER.info("HTML file created successfully.");
LOGGER.info("HTML activityList size" + activityList.size());
return new ByteArrayInputStream(buffer.toByteArray());
}
When i generate the request i got below error
HTTP Status 404 - No result defined for action com.narendra.stg.Sdg.support.action.ActivityAction and result error
type Status report
message No result defined for action om.narendra.stg.Sdg.support.action.ActivityAction and result error
description The requested resource is not available.