Best way to pass values btwn servlets?

i have to pass multiple values from one servlet to the next, when the user submits a form.
i don't know how many, or even the names of the parameters until the user submits the form.
right now, i send them as hidden fields when the form is submitted.
in the receiveing servlet, i dump them into a hashtable usng httpUtils.parse QueryString, and then parse them out of the hashtable.
is there a better way?
TIA,
Scott Murray

DrClap,
Yes, I am working with a single user.
Last night I reworked it as follows, dumping the parameters into a Properties object, which is easier to work with than a hashtable (at least it is for me):
Properties props = new Properties();
Enumeration paramNames = req.getParameterNames();
while (paramNames.hasMoreElements()) {
String name = (String) paramNames.nextElement();
String[] values = req.getParameterValues(name);
props.setProperty (name, values[0]);
The trick is that I don't know in advance the names or how many parameters are being received; I marked them on the sending page with different prefixes (@@@, ###, $$$) so as I parse thru the Properties object, I can determine what type of parameter it is.
Is there a better object to use than the Properties object? My ultimate goal is to have something similar to a ResultSet that I can search and step thru multiple times.
Thanks for you time and expertise,
Scott Murray

Similar Messages

  • Please Suggest best way to pass Strings in a pipeline

    I'm working in a project in which a line passes in a pipeline kind of situation.
    The String is passed between different modules and each module adds some more data to it (or may even remove some of it).
    Which is the best way to pass the String? I think java.lang.String might not be an efficient method because the String i'll be passing will be modified many times.
    Thanx

    Yes. StringBuffer or StringBuilder you can use.
    String string = "test";
    StringBuffer sb = new StringBuffer(string);later you will add some more strings to the StringBuffer
    sb.append("Hello World");No additiional String object will be created.

  • Best way to pass data sets to another program

    Hey
    I want to connect another (maths) program with my java application. Therefore I need to paste data (some kind of tab separated table) to this program.
    I try now to save these data in a separate newly generated file and to pass a command with Java's Runtime.exec() method to this program to read these data. Is this a good idea or might there be better ways?
    If I do so, is there a way in Java to generate some kind of a "temporary" file which will be deleted automatically after usage or is this nothing else than to save it in a common file and delete it afterwards. What's the best way to pass data generally?

    Well, the connection will not be over a network, so I'd rather think it's not a Socket or RMI problem (unless someone convinces me).
    Yes it's very external, it's a C or C++ written program, I don't have any source codes. So far I generated a file for Input command and data, I passed that on to the maths program and returned the output into another file.
    Now I would like to separate the output and like to obtain some tables and graphical things like charts at the output. Do I have to generate three different types of outputfiles? How to store some graphics e.g. some distributions. I thought even of generating a database. I never thought about XML, I don't know if this works for that kind of problem?!

  • Is there any way to pass value from one SWF to another ?

    I am doing project using flash, now I cant pass a value from one SWF to another, is there any way to pass value from one SWF to another.
    thanks

    Hi,
    Just to confirm here do you simply want to communicate between two SWFs without involving Flash Media Server. If this is the case one good way of doing it is to use a local connection. It can be used for direct communication between two separate instances of the flash player. However if you want to involve multiple clients sharing a common variable then you may have to use Shared Object for this. Please let me know what is the actual use case, is it multiple clients sharing a common variable or different player instances communicating between themselves.
    Thanks,
    Abhishek

  • What is the best way to pass a constant to a cin expecting a pointer to a value?

    I have a cin which has a leg that is expecting a pointer to a value. On the diagram, what is the best way to connect a constant widget to this leg of the cin? Connecting it directly crashes labview as it treats the constant as a pointer to memory.
    Thanks

    I am not sure that I understand your issue. CIN variables can be Input-Output or Output only. Either way, they are being passed in as a pointer to a value. You can see this very easily by placing down a CIN and wiring a constant integer to it. Next, right-click on the CIN and create the C file. You will see that the parameter list has an int* in it.
    If you are still having problems, do you have to create a CIN or can you create a DLL instead? The DLL will give you a few more ways to pass the data than a CIN does with no real performance decrease.
    Also, have you read the "Using External Code in LabVIEW" manual? This hsould answer some questions as well.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Passing values to servlet

    HI All
    I am developing a project using html and servlets. from my html page(regis.html) i am trying to pass the values which are entered by the user to the servlet (Admin_Regis.java) which is in the another package called Admin. The way i am doing is
    <form class="registerlogin" method="post" action="Adimn/Admin_Regis">
    but i am not able to send the values to the servlet. It showsr HTTP Status 404 - /Adimn/Admin_Regis.
    My question is how to pass the values from html to servlet which is the different packages . I have three more packages .
    Can any body please help me in solving this problem.

    HI
    The problem i was facing ie the values was not able to pass to the servlet i got the part of the solution for that . What actually i have done is i have kept all my web pages in one saperate folder so i was not able to send . But now when all my pages are in default folder even then i was not be send the values can any body please help me out for this problem.

  • Best way to pass large amounts of data to subroutines?

    I'm writing a program with a large amount of data, around 900 variables.  What is the best way for me to pass parts of this data to different subroutines?  I have a main loop on a PXI RT Controller that is controlling hydraulic cylinders and the loop needs to be 1ms or better.  How on earth should I pass 900 variables through a loop and keep it at 1ms?  One large cluster??  Several smaller clusters??  Local Variables?  Global Variables??  Help me please!!!

    My suggestion, similar to Altenbach and Matt above, is to use a Functional Global Variable (FGV) and use a 1D array of 900 values to store the data in the FGV. You can retrieve individual data items from the FGV by passing in the index of the desired variable and the FGV returns the value from the array. Instead of passing in an index you could also use a TypeDef'd Enum with all of your variables as element of the Enum, which will allow you to place the Enum constant on the diagram and make selecting variables, as well as reading the diagram, simpler.
    My group is developing a LabVIEW component/example code with this functionality that we plan to publish on DevZone in a month or two.
    The attached RTF file shows the core piece of this implementation. This VI off course is non-reentrant. The Init case could be changed to allocate the internal 1D array as part of this VI rather than passing it from another VI.
    Message Edited by Christian L on 01-31-2007 12:00 PM
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
    Attachments:
    CVT_Double_MemBlock.rtf ‏309 KB

  • Best way for lookup values

    I have a country abbreviation being passed as a parameter and want to know what the best way to do a look up in a view object that maps country codes to full country names if all I want to do is display that value on a report. Can anyone point me on the right track for the best way to do this?
    Thanks

    Hi,
    You can create a static VO where you can define the following parameters:
    ID:
    LookupType:
    LookupCode:
    LookupValue:
    In this, you can define LookupCode as Country Code and LookupValue as County Value. ID is the key attribute.
    And, in the VO from which you are getting the Country, go in the Edit LOV and under UI hints, put ID, LookupType, LookupCode under Available and LookupValue under Selected.
    hope it helps.

  • Best way to pass an array of waveforms inbetween VIs

    In my VI I am developing I have multiple data sources that output a single waveform. I group these waveforms togeather to make a wave form array. The user selects which waveform they would like to display and they are displayed on a graph on a different form. Right now I have each different graph VI generating the whole array and displaying the selected element.
    My question is, this seems to be not efficent because I am generating data in 3 spots. I would think it would be better to generate it in one spot and then pass only the need data to the three graph VIs. What is the best way todo this? A global variable? Queue? Any suggestions?

    You're probably tired of hearing me say this, but the global function idea is the best.
    A global variable makes a COPY of the data each time you read it. That takes time, and memory. If each of 3 window reads the global, and picks out a channel, then you've made 3 copies of the original data. Depending on your data size, that may or may not be a problem.
    A queue means that once you read the data, it's lost from the queue. If window A reads from the queue, that data chunk is not in the queue any longer, so Window B can't read that same data.
    If the main window generates the data and deposits it in a global function, then each window can ask the global function for a specific channel to display.
    DATA STORAGE.vi:
    Inputs:
    WRITE/read (bool
    ean)
    DATA IN (2-D array of DBL, for example)
    Channel Index (I32)
    Outputs:
    DATA OUT: 1-D array of DBL (or waveform, maybe).
    Code:
    WHILE
    If WRITE/read
    Store DATA IN in a shift reg.
    else
    Pass Shift reg IN to Shift reg Out.
    Pick out channel via CHANNEL INDEX
    Pass selected data to DATA OUT.
    Loop NEVER.
    The purpose of the loop is just to have a shift reg. It doesn't really loop - it executes once per call.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • The best way to insert values in a Nested Table

    Hi!
    I want to insert values from a SQL-query in a Nested Table.What's the best way to do it?
    In addition,the only way that I've found is doing a query and when I've got the query result I insert it into the Nested Table.For instance:
    FOR cur_row IN (SELECT id,nstreet from example Where id=3) LOOP
    --here I'm inserting the values of the query in the nested table.
    -- VarNestedTable is a Nested Table of Row_Type.
    --Row_Type is an object with two fields:Id,Nstreet
    VarNestedTable.extend;
    VarNestedTable(Coincidents.Last):= Row_type(cur_row.id,cur_row.nstreet);
    END LOOP;

    How to Use Tables: Creating a Table Model.
    very bad example:
    class DataObject {
    String name, age, numberOfMonkeys;
    class DOTableModel extends AbstractTableModel {
      final String[] COLUMN_HEADER = { "Name", "Age", Monkeys" };
      List dataObjects;
      public String getColumnName(int column)  {
         return COLUMN_HEADER[ column ];
      public int getRowCount() {
        return dataObjects.size();
      public int getColumnCount() {
         return COLUMN_HEADER.size();
      public Object getValueAt(int row, int column) {
         DataObject do = dataObject.get( row );
         switch( column ) {
           case 0: return do.name;
           case 1: return do.age;
           case 2: return do.numberOfMonkeys;
    }

  • Ways of passing values/attributes between Portlets of pageflow

    Hi
    Jusing Bea WebLogic Workshop 8.1.5 where i have one Portal.
    The portalt contains:
    Page A with A.portlet with A.jpf and a.jsp
    Page B with B.portlet with B.jpf and b.jsp
    I want to click on a link on a.jsp which then goes to A.action in A.jpf,
    then redirect to Page B which then start B.portlet and then start begin
    action in B.jpf
    and begin action on B.jpf gets the values that I got from link i a.jpf.
    How are the different ways to pass the values from A.portlet to another
    B.portlet
    and that the coresponding .jpf files can get the values. I can not get the
    values to passed .
    One way to solve this is to use session scope to store values in A.jpf and
    then get it from session scope in B.jpf. I dont want that, because it then I
    have to remove it to avoid trash in the session.
    Any information on this and code will help ?

    ks wrote:
    Any information on this and code will help ?Sounds like inter-portlet communication (IPC) is what you need, see the
    documentation at http://edocs.bea.com/wlp/docs81/ipcguide/overview.html
    Gerald

  • Best practice from passing messages from servlets

    Is there a best practice for passing user messages (typically errors) back to the page from servlets?
    e.g. http://localhost:4502/content/geometrixx/en.html?message=Some user error message
    Dan

    Well I suppose that answer to that question depends somewhat on your requirements, but I would say using a query string as you have indicated would be less than ideal because the page with the message would not be cached. No depending on your requirements and what sort of message you are passing that might be OK - especially if you message is highly personalized.
    If however you have a limited number of standard messages to display a more common approach is to have each message have it's own page and then to configure the servlet to redirect to the appropriate page based on the desired message.
    If you want the user to end up on the same page they submitted to the servlet from then another common approach would be to have the post to the servlet be AJAX and then display the message client side without having to change the URL.

  • Best way to pass back data from hierarchical table view?

    Hi,
    I have a view hierarchy using a navigation controller that's working pretty well. One of the bottom level views is a table view where the user selects an item from the list. This bottom view checks the list item, saves the selected item in a property, and then pops the view off the stack.
    What's the best way to alert the parent view that the child view has been popped off so it can retrieve the value in the property? The calling push returns immediately, so it doesn't appear to be a modal call. I want to be able to use the same controller from other parent forms, so I need to be able to do this without referencing the parent in the child form ideally.
    Thanks
    Ray

    Hi, well let me try to explain it a bit more
    - Add a "delegate" property to your child-viewcontroller-class
    - Define a protocoll within each chil-viewController-class
    In this example let us name it "didSelectValue:(NSString *)value"
    - In the parent-viewcontroller before pushing a child-viewcontroller set it's delegate property to "self" (parent-viewcontroller)
    - In the parent-viewcontroller implement to protocoll-method "didSelectValue:(NSTring *)value"
    - In the child view-controller in (assuming it is a tableViewcontroller) add some code in didSelectRowAtIndexPath that checks if the delegate is set and check if it responds to selector "didSelectValue:(NSString *)value". If so, call it with the selected value.

  • Best Way To Set values In Items

    Hello,
    I have a two database items and dynamically I would like to assign values to those items.
    What is the best way of accomplishing this task?
    Is there any SET property available or I need to like
    block_name.item_name :='Value'
    Regards

    You can use COPY built-in to perform dynamically assign values to different items.

  • Best way to swap values between 2 lists?

    I want tne user to be able to view s seperate lists of strings ( Via a dropdown combo, a scrollpane or similar ) and allow them to remove a value from one list and swap it over into another list and vice versa.
    What is the best way to implement this?

    Sorry, I should have been more specific. It's on a
    GUI, User is presented with 2 lists/tables of values
    and can select one or more on the first list and
    "move/pop" them over to the other list with a button
    click.?
    Well what can I say, remove it from list/table A and add the deleted item in list/table B.
    If you could post some code where you can show you're trying to do this, but failed, then perhaps you'd a more concrete answer.
    JList examples from the Javaalmanac:
    http://www.google.com/custom?domains=exampledepot.com&q=JList&sa=Google+Search&sitesearch=exampledepot.com&client=pub-6001183370374757&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A1%3B&hl=en
    JTable examples from the Javaalmanac:
    http://www.google.com/custom?hl=en&ie=ISO-8859-1&oe=ISO-8859-1&safe=off&client=pub-6001183370374757&cof=FORID%3A1%3BGL%3A1%3BLBGC%3A336699%3BLC%3A%230000ff%3BVLC%3A%23663399%3BGFNT%3A%230000ff%3BGIMP%3A%230000ff%3BDIV%3A%23336699%3B&domains=exampledepot.com&q=JTable&btnG=Search&sitesearch=exampledepot.com
    JList tutorial from Sun:
    http://java.sun.com/docs/books/tutorial/uiswing/components/list.html
    JTable tutorial from Sun:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

Maybe you are looking for

  • Updating iTunes to 7.5

    I know will sound like a stupid question...however, this is the first time I am updating itunes ever since I originally dowloaded itunes for my new ipod. So...since I wanted to update itunes I went to the apple site and it gave me the page where you

  • Embedding Java Code(URGENT)

    Hello, I'm trying to do the following, I'm trying to embed Java code into my BPEL process, I have read the tutorial that explains how to embed a java code into BPEL(http://www.oracle.com/technology/products/ias/bpel/pdf/orabpel-Training-Segment10.pdf

  • CS 6.3 : Failed to start correctly - Store timeout

    Hi guys ! I installed the CS 6.3 on a Solaris 10 box. The configuration was done correctly, without error, but when I try to start the CS, I got this error in the http.log : [11/May/2007:18:31:23 +0200] raikkonen cshttpd[15199]: General Notice: Sun J

  • Maps not working in lumia 620 after phone udate

    My maps r not working after phone update. Plz help

  • Typewriter tool in Adobe 10.1.8 version

    How can I use typewriter tool in Adober 10.1.8 version ? Even the option of "Add or edit text" is also not visible in this version ?