3.2.0

Does ActiveWidgets work with JSP in Struts framwork?

I've coded the example grid into a very basic JSP page that runs in a Struts Framework. I receive this error when trying to create an obj:

Error: 'AW' is undefined

MyCode:

<script>
// create data for test:
var myCells = [
["rick", "OBI", "data1", "continue", "314", "571.156"],
["bob", "Septa", "data2", "stop", "514", "0.56"]
];

// create the headers:
var myHeaders = ["NAME", "COMPANY", "TYPE", "ACTIONS", "NUM1", "NUM2"];

// create grid object:
var obj = new AW.UI.Grid;

obj.setCellText(myCells);
obj.setHeaderText(myHeaders);

// set number of cols/rows
obj.setColumnCount(6);
obj.setRowCount(2);

// write grid to page
document.write(obj);

</script>
Rick
June 14,
Did you include the aw.js file in the .jsp?

Try adding this to the top:

<script language="javascript" src="<html:rewrite page="/javascript/rdm/aw.js" />" type="text/javascript"></script>
Justin
June 14,
Edit: you will need to change the path from what I have there to the path of the .js.
Justin
June 14,
here is the entire code - I'm still seeing no grid and receiving the same error:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/OBUITagLib.tld" prefix="obi" %>
<%@ page import="com.onebeacon.obsb.eds.edspasearch.util.User"%>
<%
User user = (User) session.getAttribute("user");
%>
<html>
<head>
<meta name="GENERATOR" content="IBM Software Development Platform">
<title></title>
<link href="/GUI/styles/xp/grid.css" rel="stylesheet" type="text/css">
<script language="javascript" src="<html:rewrite page="/GUI/scripts/aw.js" />" type="text/javascript"></script>

<script type="text/javascript">
function doAction(sAction)
{
var frm = document.forms[0];

switch(sAction)
{
case 'NewSearch':
frm.action="/eBusiness/EDSPASearch/backToSplash.do";
frm.submit();
break;
default:
break;
}
}

function openPopupCentered(url){
var name = "_blank";
var height=450;
var width=650;
if (arguments[1]!=null && !isNaN(arguments[1])){
width = arguments[1];
}
if (arguments[2]!=null && !isNaN(arguments[2])){
height = arguments[2];
}
var str = "height=" + height + ",innerHeight=" + height;
str += ",width=" + width + ",innerWidth=" + width;
var params = ", resizable=yes, scrollbars=yes";
if (arguments[3]!=null){
params += ", " + arguments[3];
}
str += params;
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
new_window = window.open(url, name, str);
new_window.focus();
}
function printReport() {
var f = document.print;
var action = f.action;
openPopupCentered(action,800,600,"menubar=yes");
}

</script>

</head>
<body>
<div class="headContainerStretch">
<obi:appHeader company="ob" styleSheet="appstyles" appName="Electronic Document Solutions"/>
<!-- Start Navbar -->
<div class="toolBar">
<table border="0" cellspacing="0" cellpadding="0" class="topNav" summary="Application Navigation Links">
<tr>
<td class="on"><div class="lighting"><div class="hilite"><span class="navItem">Home</span></div></div></td>
<td class="off" style="width: 100%;"><div class="lighting"><div class="hilite"></div></div></td>
</tr>
</table>
</div>
<div class="toolBarBottom"></div>
</div>
<!-- End Navbar -->
<form name="EdsPASearchSplashForm" method="POST" action="/eBusiness/EDSPASearch/edsSplashAction.do">
<table border="0" cellspacing="0" cellpadding="0" class="pageTitle" summary="Page Title" style="margin-top: 10px">
<tr>
<td class="pageTitleText" nowrap>&nbsp;&nbsp;&nbsp;Commercial Lines Archive | Search Results&nbsp;</td>
<td></td>
<td width="100%" class="pageTitleSmallerText" align="center">&nbsp;</td>
<td style="text-align: right;">&nbsp;</td>

</table>
&nbsp;

<table class="pageTitleText" cellspacing="0" cellpadding="0" border="0" height="3%" width="100%" bgcolor="#d5d6c5">
<tr><TD style="width: 0%;padding: 0px 3px 3px 3px;" height="9">&nbsp;</TD>
<TD class="contentText" align="center" height="9" width="100%">&nbsp;</TD>
<TD style="width: 0%;padding: 0px 3px 3px 3px;" height="9">&nbsp;</TD>
</tr>
</table>
&nbsp;&nbsp;&nbsp;Access the
<H4>&nbsp;&nbsp;&nbsp;Search Results</H4>

<H4>&nbsp;&nbsp;&nbsp;Policy Number equals:<br>
&nbsp;&nbsp;&nbsp;Results Ordered By:</H4>
<p>
&nbsp;&nbsp;&nbsp;Use the scrollbar button to navigate through your searchresults. Due to technical limitations, some characters may render incorrectly. You may also export your data<br>
&nbsp;&nbsp;&nbsp;results to Excel (this feature optimized for Excel 2002) or export you data results to a printer HTML grid.
</p>

<p>
&nbsp;&nbsp;&nbsp;Click on to request a true and certified reprint. Local copies are for internal use only. If you need exact rendering, please request a true and certified reprint.
</p>
<p>
&nbsp;&nbsp;&nbsp;Click on to open up a text PDF, which allows text selection. Click on to open a full-fidelity image PDF.
</p>

<p>
&nbsp;&nbsp;&nbsp;Process Duration Advisory: A PDF TXT formatted file can generally be delivered six to ten times faster than a PDF IMG formatted file. While the selectopn of PDF IMG
<br>
&nbsp;&nbsp;&nbsp;yeilds full-fidelity views, performance degradation may be encountered. PDF TXT quanity is suitable for most uses and offers a faster presentation.
</p>


<!-- end application page footer -->
<table class="pageTitleText" cellspacing="0" cellpadding="0" border="0" width=80%>
<tr>
<td height="9" style="width: 0%;padding: 0px 3px 3px 3px;" bgcolor="#f6f0bc">&nbsp;</td>
<td height="9" class="contentText" nowrap width="10%" bgcolor="#d5d6c5">&nbsp;</td>
<td height="9" style="width: 0%;padding: 0px 3px 3px 3px;" bgcolor="#f6f0bc">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td> </td>

<td>
<script>
// create data for test:
var myCells = [
["rick", "OBI", "data1", "continue", "314", "571.156"],
["bob", "Septa", "data2", "stop", "514", "0.56"]
];

// create the headers:
var myHeaders = ["NAME", "COMPANY", "TYPE", "ACTIONS", "NUM1", "NUM2"];

// create grid object:
var obj = new AW.UI.Grid;

obj.setCellText(myCells);
obj.setHeaderText(myHeaders);

// set number of cols/rows
obj.setColumnCount(6);
obj.setRowCount(2);

// write grid to page
document.write(obj);

</script>


</td>
<td></td>

</tr>
<tr>
<td>&nbsp;</td>
<td >
<CENTER><CENTER>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="botNavLeft"><input type="button" class="btn goldBlue110l"
value="New Search" onClick=" javascript:doAction('NewSearch')"><br>
<span class="btnText"></span></td>
<td> </td>
</tr>
<tr>
<td class="bottomNavBottomBorder"></td>
<td class="bottomNavBottomBorder"></td>
</tr>
</table>
</CENTER></CENTER>
</td>
</tr>
</table>

</form>
<table>
<tr>
<TD></TD>
<TD><obi:appFooter company="ob" footerstyle="major"/></TD>
</tr>
</table>
</body>

</html>
Rick
June 14,
Which aw.js are you including?
Justin
June 28,
Hmm, funny story: I am now recieving this on one of my pages. Alex?
Justin
July 23,
Ahh, I have found the solution. The Setup function (whatever one sets up your grid) must be called in a <script> block in the .jsp. Calling it in loadPage() doesn't work because it hasn't imported the file yet!
Justin
July 23,

This topic is archived.

See also:


Back to support forum