Passing vectors into JSP from Servlet and passing data back to Servlet

I have been building an MVC application.
It has a controller which instantiates classes and evokes methods to
populate vectors. These vectors are then passed into a JSP. This part of the application works fine.
What I am having trouble with is a new JSP I have designed; this will
display the data that is actioned by the FORM action. This is actioned
based on the Search criteria entered by the user. Based on this a further vector is populated and brought back to the JSP as a vector
and this is rendered via the TABLE tag. Again this works fine.
Against each of the rows displayed, I have a print checkbox which can be checked by the user. On checking the records they want to print, they should then hint a Print button which should go back to the Servlet and print the data. THIS IS WHERE I HAVE THE PROBLEM. On going
back to the servlet the checkbox values are not displayed, rather
the values that initially populate the JSP. How do I get these new values back into the vector and hence accessible from the Servlet.
Any help with be very much appreciated.
Chris

Thanks for this.
Just to clarify I am not using Struts.
What I am having difficulties with is the fact that:
I can't get the checked values back to the Servlet - they keep the values they have in the bean - so as part of instantiating the bean class I set the value of the item to 'off'. The user will then check
the checkbox which should presumbably set the value to 'on'. This isn't happening because the setter method of the bean is not evoked again
because I don't come into this JSP again - the Servlet has finished here
and now needs to print the records. It can't do this because as
far as it is concerned nothing has changed since it last passed through
the vector to the JSP.
Even when I do the following:
Enumeration paramNames = request.getParameterNames();
String param = null;
while (paramNames.hasMoreElements())
param=(String)paramNames.nextElement();
System.out.println("parameter " + param + " is " +
request.getParameter(param));
what comes back is the valus of 'off' as opposed to 'on'.
The other thing is that 'request.getParameterNames()' only works
with the first record in the vector, i.e. it doesn't fetch any other
records that are rendered in the <TABLE> tag.
In desperation is there anybody out there who can help me.
Thanks
Chris
I am going to assume you are using a MVC framework
like Struts or very similar (I am assuming that from
the language you are using).
When the servlet passes the vector back to the JSP
page and you render the HTML that is passed back the
client your Vector is gone. The Vector is not
available at the HTML level that is being viewed at
the browser.
When the user selects the checkboxes and submits the
page (by clicking the print button) the controller
servlet (called ActionServlet in Struts, yours maybe
called something else) forwards the request to the
appropriate JavaBean and Servlet to process the
request. Either the JavaBean has to recreate the
Vector (not recommended) or the processing Servlet can
(better). You can do this by recreating the Vector
from scratch for the HttpRequest parameters or, at the
time of the initial request, saving Vector to a
session and then updating with the data you get back
from the client (again from the HttpRequest
parameters).
Either way you have to work with
HttpRequest.getParameter().

Similar Messages

  • How To Use OATS To Pull Data From DB And Insert Data Back To DB

    Hi All,
    My requirement is little different.
    I'll explain the scenario,
    I am working on OTM application, as far as I have read OAST supports OTM and already test scripts are ready.
    My situation is as follows bellow,
    I need to pull data of a field for 18,000 shipments.
    I have an excel sheet in the format as bellow
    Shipment_Number
    Stop_Number
    Planed_Arrival_Date
    Planed_Departure_Date
    1
    1
    1
    2
    1
    3
    2
    1
    2
    2
    I was able to write script in OATS so that it logins to OTM and searches for the specified shipment number and capture the Planed_Arrival_Date and Planed_Departure_Date for the specific stop.
    But the problem is I am not able to save the date back to the excel.
    Solution Expecting:
    Some way to save the captured data back to excel.
    Some way to save the captured data back to a column in a table. if this is possible then some way to make OATS reade the shipment number from a column in database.
    Thanks,
    Vishwamber Shetty

    Hi Vishwamber,
    Try using Datatable in OATS. Using datatable you can read and write to Excel.
    Regards,
    Deepu Muraleedharan

  • Reading a properties file in a servlet and passing its contents to a JSP pa

    Hi all,
    I'm totally new to Servlet pgmg n JSP. Please can ne1 tell how to read a simple properties file (in a servlet) and pass its contents to a JSP page.Actually the reason is to fill a combo box in a JSP page with the contents of a properties file.If calling a servlet for the same is d best way to do that, plz can ne1 tell me :
    1> whether to override the doPost method in the servlet in which to read d file using FileInputStream
    2> Putting the contents in an array and then how to pass this array to the JSP page.
    Thanks,
    deepthy.

    I'm using a properties file to let my web application know what the name of the database is. I'm using an abstract class GeneralDao which will be extended by all the DAO's (Data Access Objects or java classes containing SQL statements).
    Here's the code :
    protected Connection getDatabaseConnection()
              throws Melding
         Connection dbconn = null;     
         ResourceBundle resBundle;
         try
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         resBundle = ResourceBundle.getBundle("gcoConfig");
         String dbConnectie = resBundle.getString("databaseconnection");
         gcoLogger.debug("lezen databaseconnection in resourceBundle " );
         dbconn = DriverManager.getConnection(dbConnectie);
         } catch (InstantiationException exc)The ResourceBundle is used to read the properties file, named gcoConfig.properties.
    With the getString() command I read the content of the string named databaseconnection.
    The gcoConfig.properties file is placed inside the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes
    The GeneralDao is placed in the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes\org\gertcuppens\cluifDao.
    So this class is placed some folder below the WEB-INF\classes folder of gcoConfig.properties.
    And the content of the properties file is just one line :
    databaseconnection=jdbc:mysql://localhost/cluif
    If you want to let the JSP know what's inside the properties file, wrap the content in a Javabean, put it in the request or even the session and pass the control to the JSP.

  • How to passing value into Captivate from html?

    How to passing value into Captivate from html?
    Or
    How to communicate between objects in one slides?

    Hi czhao0378 and welcome to the forums!
    Captivate does not natively allow you to communicate your own
    data, either internally or externally. The only way to make this
    happen is to create your own functionality, either via custom-built
    Flash objects or JavaScript code executed in the browser or a
    combination of both.
    The only example I've seen of any "data passing" inside
    Captivate is a custom text input/output solution that was posted on
    the Captivate Developer Exchange:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1253 021
    This solution consists of an input box that takes information
    from the user on one slide and a second box that displays that
    information on another slide. The functionality was built in Flash
    and is embedded in Captivate as a Flash "animation". Unfortunately,
    since this is a custom functionality, the information is not
    included in the user completion results Captivate can pass to a
    Learning Management System.
    Since the solution mentioned above relies on a Flash
    Actionscript variable to hold the information that is displayed,
    you can also pass the information from HTML to Captivate using the
    "SetVariable" command in JavaScript. This would at least allow you
    to display your own HTML-based data inside Captivate.
    Beyond that, I'm not aware of any other way to gather and
    pass data in Captivate.

  • I need to call a batch file from java and pass arguments to that Batch file

    Hi,
    I need to call a batch file from java and pass arguments to that Batch file.
    For example say: The batch file(test.bat) contains this command: mkdir
    I need to pass the name of the directory to the batch file as an argument from My Java program.
    Runtime.getRuntime().exec("cmd /c start test.bat");
    How to pass argument to the .bat file from Java now ?
    regards,
    Krish
    Edited by: Krish4Java on Oct 17, 2007 2:47 PM

    Hi Turing,
    I am able to pass the argument directly but unable to pass as a String.
    For example:
    Runtime.getRuntime().exec("cmd /c start test.bat sample ");
    When I pass it as a value sample, I am able to receive this value sample in the batch file. Do you know how to pass a String ?
    String s1="sample";
    Runtime.getRuntime().exec("cmd /c start test.bat s1 ");
    s1 gets passed here instead of value sample to the batch file.
    Pls let me know if you have a solution.
    Thanks,
    Krish

  • How to bulk import data into CQ5 from MySQL and file system

    Is there an easy way to bulk import data into CQ5 from MySQL and file system?  Some of the files are ~50MB each (instrument files).  There are a total of ~1,500 records spread over about 5 tables.
    Thanks

    What problem are you having writing it to a file?
    You can't use FORALL to write the data out to a file, you can only loop through the entries in the collection 1 by 1 and write them out to the file like that.
    FORALL can only be used for SQL statements.

  • [svn:fx-trunk] 11966: Move focusSkinExclusions into Skin (from SparkSkin) and add suggestedFocusSkinExclusions to SkinnableComponent.

    Revision: 11966
    Revision: 11966
    Author:   [email protected]
    Date:     2009-11-18 16:21:41 -0800 (Wed, 18 Nov 2009)
    Log Message:
    Move focusSkinExclusions into Skin (from SparkSkin) and add suggestedFocusSkinExclusions to SkinnableComponent.
    QE Notes: None
    Doc Notes: new API (suggestedFocusSkinExclusions)
    Bugs: SDK-19255
    Reviewer: Glenn
    API Change: Yes
    Is noteworthy for integration: Yes
    tests: checkintests mustella/gumbo/components/TextInput, TextArea, CheckBox, RadioButton
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-19255
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/CheckBox.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Skin.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableCom ponent.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/SparkSkin.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/CheckBoxSkin.mxml
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/ComboBoxTextInputSkin.mxml
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin .as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/RadioButtonSkin.mxml
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/ScrollerSkin.mxml
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/TextAreaSkin.mxml
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/TextInputSkin.mxml
        flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/CheckBoxSkin.mxml
        flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/RadioButtonSkin.mx ml

  • I forgot my pass word so i reste it and it whent  back to it how it was.help

    i forgot my pass word so i reste it and it when back to it how it was. but it reset and whent back to how it was and i still dont know the password
    help me please

    If you mean that you forgot yur screen-lock passcode, you have to connect your iPod to its syncing computer and restore the iPod via iTunes.  If iTunes asks for the passcode and you can't enter the passsode, then place the iPod in recovery mode and then restore the iPod.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore
    If you forgot you restrictions passcode you need to resore to factory defaults/new iPod.

  • HT4859 The guy at the verizon store programmed my phone before I got the chance to restore my apps, etc. from icloud- therefore i did not get to go through the setup assistant..  How do i get my apps and app data back on my phone w/o having to go through

    The guy at the verizon store programmed my phone before I got the chance to restore my apps, etc. from icloud- therefore i did not get to go through the setup assistant..  How do i get my apps and app data back on my phone w/o having to go through and re-

    To restore from an iCloud backup you have to erase the phone and start over.  To do this, go to Settings>General>Reset, tap Erase All Content and Settings, then go through the setup assistant again and when given the option, choose Restore from iCloud Backup.  There is no other way to do this.
    Be sure you phone is connected to wifi and your charger as this is likely to take some time to finish.

  • I bought my Iphone4S from australia and then moved back to my country which is India. Two days back "GAMES" catogeries was missing from the app store. I have no idea why it went gone missing.I have treied to sign in various times but it doesn't work out.

    I bought my Iphone4S from australia and then moved back to my country which is India. Two days back "GAMES" catogeries was missing from the app store. I have no idea why it went gone missing.I have tried to signing in the app store several times but stil it doesn't show the GAMES catogery. Help me out.

    Try what Terence Devlin posted in this topic:
    Terence Devlin
    Apr 14, 2015 11:21 AM
    Re: Is Iphoto gone ? i want it back!
    in response to Johannes666
    Recommended
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • Imported ical from outlook and the date across the top of the weekly view all show the date i imported..

    imported ical from outlook and the date across the top of the weekly view all show the date i imported..

    I'm confused, what does iCal have to do with this, it seems as though you went from Outlook to Entourage, is that correct?

  • Using XML extraction from Oracle and XSLT data transformation

    Hi
    How can transfer data ie: Using XML extraction from Oracle and XSLT data transformation with java application?
    usually i use to do querying sql, getting data from table assinging to model class then send it to UI. how can i go for XML extraction form oracle?
    thanks

    Sorry, I don't understand what exactly you want to do. And I'm under the impression that you might not know exactly what you want to do as well. Could you explain a bit more detailed what you want to achieve?

  • HT5654 hi i cant get into my i tunes  and up date my phone it wont turn on its saying i need i need to conect to i tunes

    hi i cant get into my i tunes and up date my phone

    Help Tahlia wrote:
    It's not working at all ...
    See Here for  >  Frozen or unresponsive iPhone
    Try this First...
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    http://support.apple.com/kb/ht1430
    More Info here...
    https://discussions.apple.com/message/19521062

  • HT3939 I buy iphone 5 from us and when i back to saudi arabia I found the model A1428 how to replace it to model suuport in saudi arabia like A1429

    i buy iphone 5 from us and when i back to saudi arabia I found the model A1428 how to replace it to model suuport in saudi arabia like A1429
    or A1429 will be support in saudi arabia

    Return the existing iPhone to the US if still in the return window then buy the model you want somewhere outside the US.
    Only the A1428GSM and A1429CDMA are sold in the US.
    Apple does not sell or offer the A1429GSM in the US.
    Apple will not exchange an iPhone for a different model in a different country.

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation...
    all applications are routed through a login page...
    so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..the servlet must process the query string and then should pass all those values(as hidden values) to the login jsp..then user enters username and pswd, then there should be another servlet which takes all the hidden values of jsp and also username and pswd, authenticates the user and sends the control back to that particular application along with the hidden values...
    so i need help on how to parse the query string from the original url in the servlet, pass it out to jsp, and then pass it back to the servlet and back to the original application...damnn...any help would be greatly appreciated...thanks

    ok..this is the situation...Sounds like you have a bad design on your hands.
    You're going to send passwords in a GET request as clear text? Nice security there.
    Why not start with basic security and work your way up?
    %

Maybe you are looking for

  • HT1338 I did a software update yesterday and now can not open my email???

    Hello...HELP....No Email ??

  • Chart type option in diadem

    Hi, Do we have type of chart selection in diadem as like in excel which has different chart types like line, XY scatter, pie chart. At present I need X Y scatter type chart for my data. For example I have data like below, X -  0,    0.1,    0.2,    0

  • PO release strategy- order of names

    Hi! I have 3 releasers and either of the 3 may release the PO first that's why I did not ticked any prerequisites.  However, I would still want the names to appear in a certain order in the PO release tab.  How do I control this? Example:  the order

  • Emailing through iPhoto 11

    I've tried emailing through iPhoto 11 and have found that my emails will get to email addresses like gmail, etc. but will not go to people using Mail on the Mac. It seems to me if my preferences were entered wrong it wouldn't go anywhere. I've sent t

  • [svn:bz-trunk] 13477: Bug: BLZ-455 - Document client-load-balancing property in the sample config

    Revision: 13477 Revision: 13477 Author:   [email protected] Date:     2010-01-13 05:17:10 -0800 (Wed, 13 Jan 2010) Log Message: Bug: BLZ-455 - Document client-load-balancing property in the sample config QA: No Doc: No Ticket Links:     http://bugs.a