Communication between servlets with data

I have a servlet that creates a HTML table (a report) with some data. The data used is a vector of some java objects. Now, I want to add a hyperlink to each row in the table and when clicked, open a new browser window and show the record info in detail. I know how to add a hyperlink and open a new window, but I do not know how to pass the data associated with that (user-clicked) row to a new browser window. The Java object for that row contains 20 items and I do not want to pass them in name-value pair to another servlet. Is there a smarter way to do this ? Can someone please help me?
This is a rough sketch of how I want to put a hyperlink in a row: The following method creates rows in my table:-
private void loadTableData(Vector data, PrintWriter out, int col)
        throws IOException {
        MyRecordObject myRec = null;
        if (data != null) {
            Object[] myArray = null;
            myArray = new Object[data.size()];
            for (int k = 0; k < data.size(); k++) {
                myArray[k] = data.get(k);
            Arrays.sort(myArray, new MySorterClass(col));
            for (int i = 0; i < myArray.length; i++) {
                myRec = (MyRecordObject) myArray;
out.println("<TR bgcolor= \"E5E5E5\"> ");
// When the following hyper link
//is clicked, pass "myRec" object to some servlet/JSP
//and create a new HTML page with that data
out.println("<TD> <a href=\"myDetailInfoServlet_with_data\" target =\"_blank\"> " + myRec.getName() + " </a> </TD>"); // <==
out.println("<TD>" + myRec.getFathersName() + "</TD>");
out.println("<TD>" + myRec.getMothersName() + "</TD>");
out.println("<TD>" + myRec.getPetName() + "</TD>");
out.println("<TD>" + myRec.getSpouseName() + "</TD>");
out.println("</TR>");
out.println("</TBODY>");
out.println("</TABLE>");
out.println("</div>");
out.println("</html>");

My approach would be to just pass along an id with the hyperlink. Something you use to identify which record you want to display. This can be the recordId, or maybe the index of it in the data vector if that is still available and hasn't changed.
eg
out.println("...<a href=\"myDetailInfoServlet_with_data\?id= " + i + " ...
Also, I would recommend using JSPs for this sort of stuff.
For sure, retrieve your data in a servlet, but then just put it into request/session variables, and forward to a JSP to display.
using out.println for table code is a real pain in the butt.
Cheers,
evnafets

Similar Messages

  • Difference between initialization with data transfer?

    Dear Ones,
    What is the Difference between initialization with data transfer,initialization without data transfer and early delta initialization?
    Please explain me in senario basis..
    Thanks
    Shiva

    Hello Shivananda,
    See oss note 505700 :
    The early delta initialization is used to admit document postings
                in the OLTP system as early as possible during the initialization
                procedure.
    Regards,
    Fred

  • Diff between init with data transfer and repair full request

    hi,
    i have observed that even in the new flow we are doing init without data transfer and then repair full request
    if i do init with data transfer also i can achieve the same?
    i want to know why we need to do this ,do we have any advantage of doing init without transfer and repair full request?
    please suggest me

    Hi Venkat,
    A repair full request is loaded in cases where you get erroneous records or where there are missing records which you want to load. In such cases, a repair full request for the selective records can be loaded and is the most efficient way to correct the data, since you won't be required to load the entire data once again. Also you acheive the desired result without disturbing the delta. (You are not required to do an init w/o data transfer after a repair full, people just do it a a precaution)
    However, repair full requests should only be loaded to infoproviders with update mode 'overwrite'. Otherwise, if the InfoProvider, its very probable that you might double the value of the key-figures due to rows being added twice - in case of an InfoProvider with update mode 'Additive'. So, if your InfoProvider is additive, you will need to delete the entire data and do an 'init with data transfer' to avoid corrupting the data. (Note: you can do a repair full request for an additive infoprovider in case of lost records or if you can delete erroneous records with selective deletion.But you have to be careful with the selections lest you inadvertently load other records than required and corrupt the data)

  • Communication between servlet & rich client - ObjectStream or OutputStream?

    Hi,
    I need to send a text file from a servlet to a rich client. Is it better to send it over OutpputStream or wrap it up as an Object(eg: StringBuffer) and send it over OutputStream?
    Will the performance be significantly be affected if I try to wrap the file into an object at the Servlet's end and send it over ObjectStream? We are planning to wrap all responses from the servlet into a generic response object (containing data, exceptions and error codes if any) and send it to the client
    Please advice. Thanks in advance!

    Using object streams will create some protocole overhead. But you can minimize the effect by using compression.
    Ex:- java.util.zip.GZIPOutputStream & GZIPInputStream
    If you have already decided to use a genaric responce object then it will be good to have a generic request object too that will make your communication more flexible.
    But remember when you are doing serialization you might get problems when having different java versions in different ends if your object structures use data structures provided by java API (Ex:- Collections). You can work arround this problem (In most cases) by implementing custom serialization using writeReplace and readResolve methods.

  • Delta between ODS with Data field as key field

    Hello,
    I have a problem with a data load between two ODS. Below is the scenario
    ODS 1 has delivery data with delivery Doc and Delivery Item as key field and Plant,Material, Delivery Qty, etc..  as Data filed
    ODS 2 need to create as a aggregare at the plant, material level. So for ODS 2, Key Field is Plant, Material and the Data filed is Delivery Qty (additive), etc...
    When I load the Full load it works correctly, But when I bring the data as a delta it is updating the delivery Qty incorrectly and some of the data fileds are comming as blank also eventhough the source ODS (ODS1) has data.
    Can we use data filed from ODS1 as a Key filed for ODS2 ?
    Is that causing the
    Regards,
    Biju

    Hi,
    Looks like someone deleted/ added/ updated some entries in the change log table of ODS1.
    Did you check the "Change log" of ODS1 and compare with the delta request of ODS2?
    Isn't change log of ODS1 showing the entries you got as part of delta in ODS2?
    Another recommendation would be to compare the "Change log" of ODS1 with the "Active" table of ODS1 and see if they are showing the same value of the key figures.
    - Ashish

  • ObjectStream communication between servlet and rich client

    Hi,
    I need to send multiple objects from a servlet to a rich client.
    Is it possible to send 2 objects of different types at the same time - ie, a hashtable and a custom object by writing them one after another into the response's ObjectOutputStream?
    Also, if I have two vectors containing different object types, say a Vector of Strings and a Vector of custom objects, how do I read the ObjectStream at the client end to get these two objects? Do I read two Vectors from the ObjectInputStream and then check the contained object using instanceOf?
    In the above scenarios, is it better to wrap the entire set of objects with a serialized wrapper class and send that single object from the server to the client?
    Please advice. Thanks in advance!

    You can send any number of objects in a stream one after other. If they are in different types/classes then you have to be carefull when casting to the specific types at the other end becouse if you try to cast to wrong type you get a runtime exception.
    Normally when you receive the objects you will know in advande (programming time) which vector comes first in the stream so you can treat them acordingly.
    Since both of them are vectors you can cast them to vector references at the read end and can tread the elements of the first vectors as strings and the elements of the other vectors as something else provided that the client always send the string vector first.
    Whether to make it a single object or ot is a design decision that you have to make. It it make sence to put those two vectors together(logically related) then its better to do so.

  • Communication between servlet(client behavior) and stand alone java program

    Hello all:
    I need to send a message (ascii characters sequence) from a servlet to a java program, but I'm not sure what is the best way to get it: socket, JMS or other mechanism that I don't know.
    Is the servlet who is operating how client behavior.
    Please, any comment will be appreciated, regards,
    Ulises.

    You can always start a ServerSocket on the client (kinda sounds funny, doesn't it) which will accept connections. You then open a plain old Socket on the server to connect to the client's listener. (Note, this is the reverse of a normal set-up). Once you have the connection established, you will call getOutputStream() to get a stream to write to. Likewise, you will call getInputStream() to read the data sent. You will want to investigate the java.net.* and java.io.* libraries.
    - Saish

  • Where in clause vs. between clause with date conditions

    Hi Forum.
    I am struggling with two different query structures and wonder why one is more costly than the other one. Does anybody have any idea?
    Query a) Total Cost: 188. Bytes 511,966. Cardinality: 2,639
    Query b) Total Cost: 112. Bytes 511,966. Cardinality: 2,639
    Example:
    Query a) select * from table where trunc(date_time) between to_date('10/12/2011','DD/MM/YYYY') and to_date('20/12/2011','DD/MM/YYYY') and XYZ_ID = 007
    Query b) select * from table where trunc(date_time)
    in (
    to_date('10/12/2011','DD/MM/YYYY') ,
    to_date('11/12/2011','DD/MM/YYYY'),
    to_date('12/12/2011','DD/MM/YYYY'),
    to_date('13/12/2011','DD/MM/YYYY'),
    to_date('14/12/2011','DD/MM/YYYY'),
    to_date('15/12/2011','DD/MM/YYYY'),
    to_date('16/12/2011','DD/MM/YYYY'),
    to_date('17/12/2011','DD/MM/YYYY'),
    to_date('18/12/2011','DD/MM/YYYY') ,
    to_date('19/12/2011','DD/MM/YYYY') ,
    to_date('20/12/2011','DD/MM/YYYY')
    and XYZ_ID = 007
    -The table has local index on date_time and XYZ_ID
    -The table is partitioned like:
    PARTITION VALUES LESS THAN (TIMESTAMP' 2011-12-16 00:00:00')
    PARTITION VALUES LESS THAN (TIMESTAMP' 2011-12-17 00:00:00')
    etc.
    -Database: 11gR1
    If any other information needed, please ask for it.
    Thanks for this discussion!
    - Ugur-
    Edited by: user11384454 on 23.12.2011 04:56

    Hi,
    user11384454 wrote:
    I am struggling with two different query structures and wonder why one is more costly than the other one. Does anybody have any idea?
    Query a) select * from table where trunc(date_time) between to_date('10/12/2011','DD/MM/YYYY') and to_date('20/12/2011','DD/MM/YYYY') and XYZ_ID = 007
    Query b) select * from table where trunc(date_time)
    in (
    to_date('10/12/2011','DD/MM/YYYY') ,
    to_date('11/12/2011','DD/MM/YYYY'),
    to_date('12/12/2011','DD/MM/YYYY'),
    to_date('13/12/2011','DD/MM/YYYY'),
    to_date('14/12/2011','DD/MM/YYYY'),
    to_date('15/12/2011','DD/MM/YYYY'),
    to_date('16/12/2011','DD/MM/YYYY'),
    to_date('17/12/2011','DD/MM/YYYY'),
    to_date('18/12/2011','DD/MM/YYYY') ,
    to_date('19/12/2011','DD/MM/YYYY') ,
    to_date('20/12/2011','DD/MM/YYYY')
    and XYZ_ID = 007Because your 2 queries are functionnaly different.
    Query A would retrieve rows where date_time=to_date('10/12/2011 11:23:45','DD/MM/YYYY HH24:MI:SS') where the query B wouldn't.

  • Communication between servlet & applet

    Hello everybody,
    Well, I have a problem with my applet/servlet system.
    I Would like my applet to send some queries to the servlet.
    However, I don't know how to link the applet with the servlet (the only way I know is to use "openConnection()", but I don't see how to incorporate my query in the URLConnection (in order to have one, I need openCOnnection, and once it's done, well, the doGet method has already be laucnh, without any parameter to read). In my case, the DoGet methods of the servlet is launched, and of course, the HTTPRequest is almost empty, seeing thath I don't see how to specify the differnets parameters.
    Is thereany simple meaning to make the applet communicate this the servlet, sending strings, and receiving objects (I have already solve the problem of the sending of an object from the servlet to the applet, in the doGet method).
    Thank you very much
    C U

    In the applet html include a servlet parameter.
    <param
    name="servlet"
    value="/SqlServlet" />
    In your applet open a connection to servlet.
    InputStream in = null;
    URLConnection conn = null;
    URL url = null;
    String servlet = getParameter("servlet");
    url = new URL(servlet + "?sql=" + URLEncoder.encode(sql));
    conn = url.openConnection();
    in = conn.getInputStream();

  • BETWEEN function with dates

    Hi,
    how do i edit my where clause to display between the SYSDATE and exactly one month before that date?
    i know it's something like
    WHERE last_used >=SYSDATE
    AND last_used is <=??????
    i don't know what to put after that...
    anybody know?

    Daniel,
    This might get you what you want:
    WHERE last_used &gt;=SYSDATE
    AND last_used is &lt;= add_months(sysdate, -1)
    If this answers your question, please assign points and close the question..
    Thank you,
    Tony Miller
    Webster, TX

  • Communication between NativeWindows with Air 2.0 and Actionscript 3

    Greetings.
    I'm starting to learn how to use Air and i've hit a wall.
    My Application has the main window, and then i add a second window called rendererWindow.
    The Application has a MovieClip (movieclipA), and then i create a Custom Class MovieClip which i then add to the rendererWindow.stage.
    In the Custom Class MovieClip, i add an event( enter frame ) to check the properties of movieclipA.
    I've tried everything i can remember but i always get an error.
    i want to do the following:
    customClassMovieclip.x = movieclipA.y (movieclipA is on the main window and customClassMovieclip is added to the rendererWindow.stage)
    How to get properties from Objects in the main window accessed by objects in the other window and vice-versa?
    Thanks.

    definately 3.0

  • Encrypting communication between an app that uses an ODBC/DSN (with ADODB) and SQL Server 2008 R2

    I've been doing a lot of reading the last couple of days on how we can encrypt db communication between our product app and a customer's SQL Server db, but cannot make it work as expected. The app uses a ODBC/DSN to connect to the SQL Server db. I use this
    ODBC app to setup the DSN (on a Windows 7 PC):
    C:\Windows\SysWOW64\odbcad32.exe
    The  DSNconnection uses the SQL Server driver 6.01.7601.17514 and has these properties:
    - WinNT authentication.
    - Client Config button: TCP/IP to <server-name>\<instance.-name>
    - Change to default db: <name-of-app-db>
    - Everything else is default setting.
    SQL Server is on the same Windowns 7 PC and has a self-signed cert installed (used IIS to generate it) and has the Force Enryption set to "yes".
    I have a test C# program that uses the ADODB 2.7.0.0 COM-wrapper, made by Visual Studio after adding a reference to the ADO 2.7 library version 6.1.7601.17857. The program creates an ADODB.Connection object that has a simple connection string: "DSN=<san-name>;UID=<user>;PWD=<password>". The
    program then creates an ADODB.Recordset object and reads and displays a field from a table.
    Works fine.
    If I go into SQL Server and set Force Encryption to "no," clear the cert, restart the SQL service, and then re-run the program, it works fine.
    Here's the kick. If I go into the DSN and select "Use strong encryption for data" the Test button on the DSN works—why does it work? The SQL Server is no longer encrypting the connection so an error should occur. If I run the test program, it works
    as well—why? I can look at the connection properties in the test program and see that ADODB has added the ";Encrypt-yes" stuff to the end of the connection string. Yet that option seems to have no effect.
    If I set the SQL instance back to Force Encryption:yes, enable the cert, restart the SQL service, and clear the DSN's "Use strong encryption for data" option, I can still connect to the db with the
    test program—why?
    What am I doing wrong? I need to be able to ensure that the communication between our app product and the SQL instance is encrypted, and that we get an error if the SQL instance does not support encrypted communications. We really don't want the customer
    to have to enable Force Encryption because they have other db's on their SQL Server that do not use encrypted communication, but they want to know that our product's communication channel with the db is encrypted.
    No, I can't change the app product's code at this point in time. I'm stuck with working with what a DSN called from ADODB has to offer.
    Also, how can I be sure that communications are encrypted? I mean, I've tried things like "SELECT * FROM sys.dm_exec_connections" but that doesn't help because I have no idea how to tie the list of sessions shown back to my test program, although
    I guess it's a good thing that some of the sessions listed show encrypt_option as TRUE.
    -glenn-

    Ah yes, very good point. It's easy to miss because you have to delete then recreate the DSN in order to change drivers. So I switched the DSN over to the SQL Native 11 driver.
    Now when I try to connect to the SQL instance as <computer-name>\<instance-name>, and without a cert on the server, I get "the target principal name is incorrect". Perfect; now we're getting somewhere!
    Change my DSN to use <fqdn>\<instance-name> and it works. This tells me that SQL Server has auto-generated a cert and named it <fqdn>. I would have expected the "cert fail" error, not a cert
    name mismatch, because I'm not using Trust Server Cert.
    So I load up my self-signed cert, and that works too.
    I am still confused as to why I'm not seeing the "cert fail" error when I have no cert loaded on the SQL Server. I am not using Force Encryption on the server at all, so wouldn't expect SQL Server to auto-create a cert when an Encrypt=yes request comes in,
    but apparently it does?
    I also ran into a problem with this:
    select c.session_id, c.encrypt_option, s.client_interface_name
    from sys.dm_exec_connections c
    join sys.sysprocesses s
      on c.session_id = s.session_id
    where s.dbid = db_id('MyDatabase')
    There is no s.client_interface_name, probably should be s.hostname. There's also no s.session_id. I thought maybe this should be s.sid, but then no rows ever come back. The c.session_id looks like 51 and 52, but the s.sid looks like a very long binary number,
    so these two fields cannot be joined. I don't know how to convert the sid's properly so that the join would work. Ah wait, I just found the s.spid column; the join works when that column is used (I assume that's correct anyhow).
    If I add a Thread.Sleep(30 seconds) to my C# program just before the connection is closed, this query shows me the session for the correct hostname has encrypt_option=TRUE.
    And I have to keep my fingers crossed that all the app I/O will still work properly after
    changing the driver. Probably a safe bet though.
    Think I'm ready to throw in the towel on getting the "cert fail/no SSL" error to appear.
    It does look like I am able to sufficiently show that the connection is encrypted when Encrypt=yes is used with the newer driver.
    Thank for all the help!
    -glenn-

  • Data conversion for communication between Java and C/C++ program

    The real problem, i guess, is about data type conversion between Java and C programs. For instance, and int is supposed to be 4 bytes in Java, and also in C/C++. But, as far as I know, the size of and int in C depends on the processors architecture, so if it were a 64 bit arch., size of and int, double, etc. in C, would change. The real scenario would be a communication between a 32 bit machine (Java) and a 64 bit machine (C/C++).
    First of all, is this assumption correct?
    If so,
    how is it possible to deal with this problem in Java?
    Is there any way to know 'type length' automatically? or
    would it be necessary to modify the Java program to work with a C program in 32-bit or 64-bit arch?
    thx in advance

    cotton.m wrote:
    Yes you should develop the C part of the protocol first and then build from there.
    See http://forum.java.sun.com/thread.jspa?threadID=5243547 for a previous discussion of this topic.
    I understand what you mean, also the topic you referenced. I will explain the situation a bit more. The protocol is already defined: (16 bits message size, 16 message id, 32 bit time, etc.); it is also defined in C (structures and so on). So it would be easy to write my Java code using the specified protocol in bytes, and C types wouldn't be necessary to be considered. But, let's say that the C code can't be modified, and I thought (and don't know yet if its correct), that size of C types CAN changed depending on architecture. So if size changes for C types (code is specified in short, int, etc, and not in bit format), it all would be a mess, if I don't implement something in my Java code.
    cotton.m wrote:
    I don't believe that 32 or 64 bit enters the equation here at all.Maybe 32 o 64 doesn't mind, but sparc or PC could take a point here. Communication would be between a sun solaris sparc and windows x86 PC. But if type size in C/C++ does not change, I wouldn't really have any problem then...
    The situation is not ideal, I know, but is what I have; and I think I could have problems if I run the C program in other machines; so I would have to try to solve it whithin my Java Program.
    I hope it is clear now what I need.
    thx
    Edited by: MGasa on Jan 16, 2008 1:51 AM

  • I have problem with data transfer between Windows Server 2012RT and Windows7 (no more than 14kbps) while between Windows Sever 2012RT and Windows8.1 speed is ok.

    I have problem with data transfer between Windows Server 2012RT and Windows7 (no more than 14kbps) while between Windows Sever 2012RT and Windows8.1 speed is ok.

    Hi,
    Regarding the issue here, please take a look at the below links to see if they could help:
    Slow data transfer speed in Windows 7 or in Windows Server 2008 R2
    And a blog here:
    Windows Server 2012 slow network/SMB/CIFS problem
    Hope this may help
    Best regards
    Michael
    If you have any feedback on our support, please click
    here.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Diagram with communications between all XI components

    Is there a diagram on help.sap.com or somewhere that along with specifying the communication connectivity between all of the XI components it also has the URLs and RFC destinations that correspond to the cache refreshes, etc.
    This would really help troubleshoot some intermittent problems I am having.  Much appreciated.

    Hi George Hamilton ,
    The following web-sites give u step-by-step solution for communications between all XI components :
    SAP XI Infrastructure : Demo Example configuration
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/605c8e2f-d611-2a10-5187-abd511fa339b
    SAP Security Guide XI
    http://help.sap.com/saphelp_nw04/helpdata/en/14/ef2940cbf2195de10000000a1550b0/frameset.htm
    XI Configuration guide
    http://help.sap.com/saphelp_nw04/helpdata/en/d7/f01a403233dd5fe10000000a155106/frameset.htm
    Technical Communication between configuration tools, Integration Builder tools and monitoring tools
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/f85141196ff423e10000000a155106/content.htm
    Monitoring Set Up guide for SAP Netweaver 04
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/df1a6313-0a01-0010-c9a2-d76d3f115d42
    Process Integration : Demo Example configuration
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80da7e60-d511-2a10-8885-f9ee5b36d63b
    Troubleshooting the File Adapter
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/troubleshootingtheFile+Adapter&
    Xi message processing monitoring & troubleshooting
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2f2a9fa2-0a01-0010-32ac-d281db722b86
    SAP XI- New possibilities in SAP Integration
    http://www.english.bcc.com.pl/pad_files/aw_files/260_EN_AW_096_DB21_SAPXI_ENG.pdf
    Interoperability between Microsoft BizTalk Server 2004 and SAP XI 3.0
    http://download.microsoft.com/download/5/7/f/57f1490e-8a8d-497b-bbae-ec2a44b3799f/BizTalkSAPXIInterop.pdf
    Supportability Set up guide : SAP Netweaver 04
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cc1ec146-0a01-0010-90a9-b1df1d2f346f
    *******Pls reward points if u find this useful
    cheers!
    gyanaraj

Maybe you are looking for

  • Lenovo System update installati​on fails

    i think it fails to install the service. windows 7 64 bit. latest and greatest systemupdate503-2013-10-31.exe full installation logs here http://pastebin.com/rBVAWj51 thanks for the help. Solved! Go to Solution.

  • How do I create a session with the datasource set in code not sessions.xml

    I want to create a session where I specify the J2EE datasource name dynamically in code. Normally, I would hard-code a J2EE datasource name in sessions.xml e.g. <login> <datasource>jdbc/MyApplicationDS</datasource> <platform-class>oracle.toplink.plat

  • Credit Management- KRML Output not generated for Sales Order ( v.v.u.)

    <u>Credit Management - Credit control check at Sales order Level</u> While saving the Sales order,which failed the Credit check ( As per Automatic Credit Check Settings), there is no output generated for output type KRML, for Partner Fn KB/KM. Normal

  • What happened to share to a DVD from iMovie?

    I upgraded to the latest iMove... CAN NO LONGER SHARE TO A DVD?????? What gives?

  • Canon iRC2380i with Mac OS 10.6.3

    Hi all, Our office has a number of iMacs running OS 10.6.1 that can print to our Canon iRC2380i using the UFR II driver, but we recently bought a number of new iMacs running 10.6.2 and lost the ability to print (Error -170). Does anyone know if and h