473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

passing an Iterator from a Utility class to a JSP

14
I want to pass my Iterator to a JSP in the following code

code: Java

public class PolicyUpdateUtils {
public static void UpdatePolicyIncreases(){
PolicyLocalHome ppH = (PolicyLocalHome)Utils.getBeanHome("Policy");
PolicyLocal policyL = null;
IncreasesLocalHome incH = (IncreasesLocalHome)Utils.getBeanHome("Increases") ;
IncreasesLocal incL = null;

try{
Collection col=incH.findByPolicyUpdated(false);
Iterator iter=null;
if(!col.isEmpty())
{
iter=col.iterator();
while(iter.hasNext()){
incL=(IncreasesLocal)iter.next();
policyL=ppH.findByPrimaryKey(incL.getPolicyID());
AlterationsUtils.SetNewGrossAnnuity(policyL,incL);
}
}
else{

System.out.println("COLLECTION NOT FOUND");
}
//redirecting code here

}
catch(Exception e){
e.printStackTrace();
}

}

how do I pass iter to the next page.

NB this is not a servlet.
Jul 28 '07 #1
2 1585
madhoriya22
252 100+
I want to pass my Iterator to a JSP in the following code

code: Java

public class PolicyUpdateUtils {
public static void UpdatePolicyIncreases(){
PolicyLocalHome ppH = (PolicyLocalHome)Utils.getBeanHome("Policy");
PolicyLocal policyL = null;
IncreasesLocalHome incH = (IncreasesLocalHome)Utils.getBeanHome("Increases") ;
IncreasesLocal incL = null;

try{
Collection col=incH.findByPolicyUpdated(false);
Iterator iter=null;
if(!col.isEmpty())
{
iter=col.iterator();
while(iter.hasNext()){
incL=(IncreasesLocal)iter.next();
policyL=ppH.findByPrimaryKey(incL.getPolicyID());
AlterationsUtils.SetNewGrossAnnuity(policyL,incL);
}
}
else{

System.out.println("COLLECTION NOT FOUND");
}
//redirecting code here

}
catch(Exception e){
e.printStackTrace();
}

}

how do I pass iter to the next page.

NB this is not a servlet.
Hi,

why do you want to pass the iterator to the next page ?
If I get u right......then u can get this collection in the next page also...and there u can iterate through it again...hope this vil help u.

thanks and regards,
madhoriya
Jul 30 '07 #2
r035198x
13,262 8TB
I want to pass my Iterator to a JSP in the following code

code: Java

public class PolicyUpdateUtils {
public static void UpdatePolicyIncreases(){
PolicyLocalHome ppH = (PolicyLocalHome)Utils.getBeanHome("Policy");
PolicyLocal policyL = null;
IncreasesLocalHome incH = (IncreasesLocalHome)Utils.getBeanHome("Increases") ;
IncreasesLocal incL = null;

try{
Collection col=incH.findByPolicyUpdated(false);
Iterator iter=null;
if(!col.isEmpty())
{
iter=col.iterator();
while(iter.hasNext()){
incL=(IncreasesLocal)iter.next();
policyL=ppH.findByPrimaryKey(incL.getPolicyID());
AlterationsUtils.SetNewGrossAnnuity(policyL,incL);
}
}
else{

System.out.println("COLLECTION NOT FOUND");
}
//redirecting code here

}
catch(Exception e){
e.printStackTrace();
}

}

how do I pass iter to the next page.

NB this is not a servlet.
Make a static getter for your iterator/collection and call that method from the JSP.
Jul 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Carlo Milanesi | last post by:
Let's say I want to write the following function, void f(const list<int> &l, const vector<int> &v) { cout << get_second(l) << '\n'; cout << get_second(v) << '\n'; cout << get_nth(l, 2) << '\n';...
26
by: Michael Klatt | last post by:
I am trying to write an iterator for a std::set that allows the iterator target to be modified. Here is some relvant code: template <class Set> // Set is an instance of std::set<> class...
1
by: Martin Magnusson | last post by:
I'm writing a custom iterator which works on a specific class and needs access to some of this class' private data. The iterator class is a friend of the other class, but I suppose that the...
13
by: Mike Austin | last post by:
Hi all. Just working on a small virtual machine, and thought about using vector iterators instead of pointer arithmetic. Question is, why does an iterator plus any number out of range not...
4
by: Arturo Cuebas | last post by:
I've got a bunch of file_iterator<> (http://tinyurl.com/3uuxa) begin/end pairs that point to various chunks in a file. It would be super-cool, in my program, to be able to treat all of these ranges...
2
by: PengYu.UT | last post by:
I'm wonder whether 1. stl directly defined the 6 comparison operators(== != < > <= >=) directly for iterator and const_iterator 2. or it only define == and < and using std::rel_ops to get the...
3
by: KK | last post by:
Hello all, I have several classes binded by one common interface - say 'sum' interface which calculates the sum of all the class elements of type 'int'. class Alphabet { int _a; int _b; int...
14
by: shawnk | last post by:
I searched the net to see if other developers have been looking for a writable iterator in C#. I found much discussion and thus this post. Currently (C# 2) you can not pass ref and out arguments...
0
by: wellingj | last post by:
A little back ground on what I'm trying to do: I'm making a generic weighted graph class (vertexes and edges althought I don't call them that) to implement some pathfinding algorithms like A* and D*....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.