Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2007, 10:16 PM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Is it possible to store "SET" values to Vector ?

hi,
     The below is the "ActionClass" from which i am getting values from "FORMBEAN" i am setting those value into the "jsp" page successfully. WHAT I NEED NOW IS, IS IT POSSIBLE TO STORE THOSE VALUES INTO SOME VECTOR OR SOME OTHER TYPE SO THAT I CAN DISPLAY A REPORT FORMAT. Because i have more than one record in my table.The below is my ACTION CLASS.

public void performRim(HttpServletRequest req, X52Form form, ActionErrors errors) {

try{
form.setAgentcd(totaxpath.getValueAsString("/response/text/agentcd/text()"));
form.setAgentName(totaxpath.getValueAsString("/response/text/agentName/text()"));
form.setCurcd(totaxpath.getValueAsString("/response/text/curcd/text()"));
form.setBankActno(totaxpath.getValueAsString("/response/text/bankActno/text()"));
form.setSwiftcd(totaxpath.getValueAsString("/response/text/swiftcd/text()"));
form.setGlno(totaxpath.getValueAsString("/response/text/glno/text()"));
            
}
catch(Exception ex){
System.out.println("error!"+ex);
}

for example: -------------

Vector v=new Vector();
v.addElement(totaxpath.getValueAsString("/response/text/agentcd/text()"));
             HttpSession session = req.getSession();
             session.setAttribute("name",testSrring);

thx, Ajay
 
Old September 4th, 2007, 06:45 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

You messed the code block Its difficult to understand. Anyway what you can do is use ArrayList class. Java5 supports generics i mean you can declare object for ArrayList as ArrayList<MyObject> list = new ArrayList<MyObject>(); the MyObject class will contain all the values for one row in your database. Loop through the resultset object and initialize the MyObject class instance with the values of current row and add this object to the Array list object. Hope you understand this. Be little more elaborate if you need more information.

- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
getting a result set to a vector cakalanka Java Databases 1 March 24th, 2008 07:33 AM
How to pass vector values form one JSP midhun JSP Basics 1 January 30th, 2006 06:49 PM
store values of recieved xml Steven1984 XML 0 April 17th, 2005 11:22 AM
To split values and store in the database lily611 SQL Server 2000 3 July 15th, 2004 09:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.