473,761 Members | 8,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

struts <logic:iterat e> cannot find collection with IFrames

nc
My iterator can find my collection when my Action class calls my jsp
directly, however when my Action class calls an html file that is set
up with IFrames (one of which is loading that same jsp), I get a
servlet error "cannot find collection".

Not usre if my issue is HTML, JSP, WebSphere or ???
Any help is very much appreciated.

HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE> </TITLE>
<META HTTP-EQUIV="Expires" CONTENT="Mon, 03 Mar 1997 01:00:00 GMT">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
</HEAD>
<BODY>
<table width="700" border="1" cellspacing="0" cellpadding="0" >

<tr><td>
<iframe src="myJSP.jsp" width="100%" height=300 align="left"
scrolling="yes" NORESIZE
marginwidth="10 " marginheight="0 " name="step1">
</iframe>
</td></tr>

<tr><td>
<iframe src="" width="100%" height=400 align="left" scrolling="yes"
NORESIZE
marginwidth="10 " marginheight="0 " name="step2">
</iframe>
</td></tr>

</table>
</BODY>
</HTML>

JSP file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"% >
<%@ taglib uri="/WEB-INF/tlds/amarda-logic.tld" prefix="ifLogic "%>

<html>
<head>
<title> </title>

<META name="GENERATOR " content="IBM WebSphere Studio">

<SCRIPT LANGUAGE="JavaS cript">
<!--
inSubmit=0;
function doSubmit() {
if( inSubmit == 0 ) {
inSubmit = 1;
return true;
}
return false;
}
// -->
</SCRIPT>

</head>
<body bgcolor="#fffff f" link="#000000" alink="#000000"
vlink="#000000" >
<jsp:useBean id="viewBean"
class="myClass"
scope="request" />
<form name="form" method="post" action="myJSP2. jsp" target="step2"
onSubmit="retur n doSubmit();">
<input type="hidden" name="validateK ey" value="1">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >

<logic:iterat e id="id_Element " name="viewBean" property="myEle ment"
scope="request" >

<tr>
<td colspan="1">&nb sp;</td>

<td colspan="2" align="left"><i nput type="radio" name="inputValu e"
value="<bean:wr ite name="id_Elemen t" property="myPro perty" />"
onClick="docume nt.form.submit( )"></td>

<td colspan="1">&nb sp;</td>

</tr>

</logic:iterate>
</TABLE>
</TD></TR>

</table>
</form>

</body>
</html>
Jul 17 '05 #1
4 10306
This can't work. The problem is that the HTML goes to the browser, and the
browser then makes a separate request to the server. In the context of the
new request, your collection doesn't exist.

Since I don't know enough about your app, I'm not sure if this solution will
work, but:

1) In your original action, put the collection in session scope instead of
request scope (you possibly have issues here about clearing old data on
later requests)

Some recommendations on improving the code:

1) Make the iframe reference a new action (or use a dispatch action)--when
using struts, it's a good habit to make all requests go through the struts
controller.
2) Change direct references to jsp's or actions into references to global
forwards using the struts tag library--This allows flexibility in your app
and makes sure all links go through the rewriter.

Hope this helps

"nc" <nc**********@h otmail.com> wrote in message
news:16******** *************** **@posting.goog le.com...
My iterator can find my collection when my Action class calls my jsp
directly, however when my Action class calls an html file that is set
up with IFrames (one of which is loading that same jsp), I get a
servlet error "cannot find collection".

Not usre if my issue is HTML, JSP, WebSphere or ???
Any help is very much appreciated.

HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE> </TITLE>
<META HTTP-EQUIV="Expires" CONTENT="Mon, 03 Mar 1997 01:00:00 GMT">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
</HEAD>
<BODY>
<table width="700" border="1" cellspacing="0" cellpadding="0" >

<tr><td>
<iframe src="myJSP.jsp" width="100%" height=300 align="left"
scrolling="yes" NORESIZE
marginwidth="10 " marginheight="0 " name="step1">
</iframe>
</td></tr>

<tr><td>
<iframe src="" width="100%" height=400 align="left" scrolling="yes"
NORESIZE
marginwidth="10 " marginheight="0 " name="step2">
</iframe>
</td></tr>

</table>
</BODY>
</HTML>

JSP file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"% >
<%@ taglib uri="/WEB-INF/tlds/amarda-logic.tld" prefix="ifLogic "%>

<html>
<head>
<title> </title>

<META name="GENERATOR " content="IBM WebSphere Studio">

<SCRIPT LANGUAGE="JavaS cript">
<!--
inSubmit=0;
function doSubmit() {
if( inSubmit == 0 ) {
inSubmit = 1;
return true;
}
return false;
}
// -->
</SCRIPT>

</head>
<body bgcolor="#fffff f" link="#000000" alink="#000000"
vlink="#000000" >
<jsp:useBean id="viewBean"
class="myClass"
scope="request" />
<form name="form" method="post" action="myJSP2. jsp" target="step2"
onSubmit="retur n doSubmit();">
<input type="hidden" name="validateK ey" value="1">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >

<logic:iterat e id="id_Element " name="viewBean" property="myEle ment"
scope="request" >

<tr>
<td colspan="1">&nb sp;</td>

<td colspan="2" align="left"><i nput type="radio" name="inputValu e"
value="<bean:wr ite name="id_Elemen t" property="myPro perty" />"
onClick="docume nt.form.submit( )"></td>

<td colspan="1">&nb sp;</td>

</tr>

</logic:iterate>
</TABLE>
</TD></TR>

</table>
</form>

</body>
</html>

Jul 17 '05 #2
nc
Thank you, Java Architect

I like DispatchAction, I'm going with that. However, I cannot seem to
have the action recognize the dispatch parameter(step1 ), the iframe
src returns to the DispatchAction execute method, not the step1 method
I've coded. new HTML follows.

Thanks again for any help

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE> </TITLE>
<META HTTP-EQUIV="Expires" CONTENT="Mon, 03 Mar 1997 01:00:00 GMT">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
</HEAD>
<BODY>
<table width="700" border="1" cellspacing="0" cellpadding="0" >

<tr><td colspan="1"><IM G SRC="images/spacer.gif" WIDTH=400 HEIGHT=5
BORDER=0 ALT=""></td></tr>

<tr><td>
<iframe src="myAction.d o&dispatch=step 1" width="100%" height=300
align="left" scrolling="yes" NORESIZE
marginwidth="10 " marginheight="0 " name="step1">
</iframe>
</td></tr>

<tr><td>
<iframe src = "" width="100%" height=300 align="left" scrolling="yes"
NORESIZE
marginwidth="10 " marginheight="0 " name="step2">
</iframe>
</td></tr>

<tr><td colspan="1"><IM G SRC="images/spacer.gif" WIDTH=400 HEIGHT=5
BORDER=0 ALT=""></td></tr>

</table>
</BODY>
</HTML>
"Java Architect" <da**@dynamicre solve.com> wrote in message news:<sd******* *************@a delphia.com>...
This can't work. The problem is that the HTML goes to the browser, and the
browser then makes a separate request to the server. In the context of the
new request, your collection doesn't exist.

Since I don't know enough about your app, I'm not sure if this solution will
work, but:

1) In your original action, put the collection in session scope instead of
request scope (you possibly have issues here about clearing old data on
later requests)

Some recommendations on improving the code:

1) Make the iframe reference a new action (or use a dispatch action)--when
using struts, it's a good habit to make all requests go through the struts
controller.
2) Change direct references to jsp's or actions into references to global
forwards using the struts tag library--This allows flexibility in your app
and makes sure all links go through the rewriter.

Hope this helps

"nc" <nc**********@h otmail.com> wrote in message
news:16******** *************** **@posting.goog le.com...
My iterator can find my collection when my Action class calls my jsp
directly, however when my Action class calls an html file that is set
up with IFrames (one of which is loading that same jsp), I get a
servlet error "cannot find collection".

Not usre if my issue is HTML, JSP, WebSphere or ???
Any help is very much appreciated.

HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE> </TITLE>
<META HTTP-EQUIV="Expires" CONTENT="Mon, 03 Mar 1997 01:00:00 GMT">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
</HEAD>
<BODY>
<table width="700" border="1" cellspacing="0" cellpadding="0" >

<tr><td>
<iframe src="myJSP.jsp" width="100%" height=300 align="left"
scrolling="yes" NORESIZE
marginwidth="10 " marginheight="0 " name="step1">
</iframe>
</td></tr>

<tr><td>
<iframe src="" width="100%" height=400 align="left" scrolling="yes"
NORESIZE
marginwidth="10 " marginheight="0 " name="step2">
</iframe>
</td></tr>

</table>
</BODY>
</HTML>

JSP file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"% >
<%@ taglib uri="/WEB-INF/tlds/amarda-logic.tld" prefix="ifLogic "%>

<html>
<head>
<title> </title>

<META name="GENERATOR " content="IBM WebSphere Studio">

<SCRIPT LANGUAGE="JavaS cript">
<!--
inSubmit=0;
function doSubmit() {
if( inSubmit == 0 ) {
inSubmit = 1;
return true;
}

return false;
}
// -->
</SCRIPT>

</head>
<body bgcolor="#fffff f" link="#000000" alink="#000000"
vlink="#000000" >
<jsp:useBean id="viewBean"
class="myClass"
scope="request" />
<form name="form" method="post" action="myJSP2. jsp" target="step2"
onSubmit="retur n doSubmit();">
<input type="hidden" name="validateK ey" value="1">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >

<logic:iterat e id="id_Element " name="viewBean" property="myEle ment"
scope="request" >

<tr>
<td colspan="1">&nb sp;</td>

<td colspan="2" align="left"><i nput type="radio" name="inputValu e"
value="<bean:wr ite name="id_Elemen t" property="myPro perty" />"
onClick="docume nt.form.submit( )"></td>

<td colspan="1">&nb sp;</td>

</tr>

</logic:iterate>
</TABLE>
</TD></TR>

</table>
</form>

</body>
</html>

Jul 17 '05 #3
> <iframe src="myAction.d o&dispatch=step 1" width="100%" height=300

That should be src="myAction.d o?dispatch=step 1"
Jul 17 '05 #4
nc
Thanks Murray and Java Architect -
You guys are the best.
Dumb mistake of mine.

"Murray" <pa***@SPAMOFFo ptusnet.SPAMMAG E.com.au> wrote in message news:<40******* *************** *@news.optusnet .com.au>...
<iframe src="myAction.d o&dispatch=step 1" width="100%" height=300


That should be src="myAction.d o?dispatch=step 1"

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
6510
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key" labelProperty="value"/> In this case "key" is what I mean by "ID", and "value" is what I mean by "Value" -- the "Value" is shown to the user, but the "ID" is what I plan to keep, to be saved to a database (as a reference in a table to a common table as a part of...
3
1672
by: vijay | last post by:
Hi, I am using struts frame work and in one of the jsp pages I have a bunch of IFRAMES like this.(This is in logic iterate and the recordId is incremented with that iteration) ------------------------------------------------------------------------ <div class="floater" style="height:29em;"> <iframe name="frame0" id="frame0" align="center" width="100%" height="100%" frameborder="0"...
5
2224
by: Alex Maghen | last post by:
I frequently find myself wanting to insert some basic client-side JavaScript functions in the page of an ASPX of mine. But I find it so frustrating that I have to actually contruct my JavaScript in C# on the server-side and render it to the client because I can't use the IDs of my controls as they are written in the HTML page itself. Rather, I have to use Control.ClientID to get that ID that I can use in the client-side JS. So my...
13
8595
by: rakeshvthu | last post by:
hi all, i am using window.onunload() method in IE6, it works fines in local, but it does not work in Integration Box(Linux Environment), i have written a simple alert() statement to check whether it does really trigger that event alert() statement is also not working it seems event it self is not triggering. But it works fine in IE7 and FireFox. here is my code snippet: <script> window.onunload = confirmExit; function confirmExit(){...
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.