How to create cookies in webdynpro and How to read from cookies

Hi all
Please let us know how to create cookies and how to store and retrieve the data from cookies in webdynpro.
we have the following requirement in each and every webdynpro form we have dropdownbox UI element , when ever a user logins into portal then he will select his state from the dropdownbox UI element then when even again the same user logs into portal and select the state field then the previously existing value which ever used in cookies that should be selected as dropdownbox.
can you please send sample codes how to create and read the data from cookies in webdynpro?
if you have any useful links or documents on this cookies in webdynpro then it would be great help to us.
Thanks in advance.
Regards
Kalki reddy

Hi,
Have a look at the following thread:
Re: How to use Cookies in Web DynPro?
This may help you.
Regards.
Rajat

Similar Messages

  • Each time I create a new album in IPhoto, photos from another album or from photo stream are automatically dumped into the new album..  how do I create a blank album and then import photos from a flash drive into the new album?

    each time I create a new album in IPhoto, photos from another album or from photo stream are automatically dumped into the new album..  how do I create a blank album and then import photos from a flash drive into the new album?

    just import the iPhoto
    Surely you meant "just import the photo"?  The Spell checker is dangerously creative !

  • How to read from properties file

    Hi,
    I am using JSR 168.
    while creating a new portlet, a folder gets created with the name as "portlet". Under which is resource package and <PortletName>Bundle.java.
    pls tell me how to read from .properties file.
    waiting eagerly for some reply
    Thanks & Regards,
    HP
    Edited by: user9003827 on Apr 13, 2010 3:42 AM

    I think i have mixed it up :)
    I have looked at it again and believe you are using regular JSP portlets.
    Can you tell what you want to achieve by reading .properties file. Are you meaning the preferences of the portlet or what exactly are you trying to do?
    Reading propertie files is easy:
    // Read properties file.
    Properties properties = new Properties();
    try {
        properties.load(new FileInputStream("filename.properties"));
        String myKey = properties.getProperty("yourKey");
    } catch (IOException e) {
    }Edited by: Yannick.O on 13-Apr-2010 05:52

  • How to read from 4 serial ports

    Hi
    Does anyone know how to read from 4 COM ports with only 2 interupts? I can
    manage it by using Close serial driver.vi, however this makes the amount of
    allocated memory by Labview increase throughout my experiment and thereby
    slows down the computer. I use Labview 4.0.1 on Win95.
    Regards
    Frede Lei

    Hi,
    Thanks for the reply however I could able to write the PCR to read one variable without wagetype. My question is, I have 6 variables in VAR table and now I want to read all the variable and based on the variable I need to create the 6 wagetype each for each variable.
    I know to create the wagetype with one variable.
    ZSSB CCE : restore 7SSB wage types paid separately in RT       
            AMT=& VSSB Set                                         
            AMT?0      Comparison                                  
                ADDWTI7SSB IT   Input table                        
              =                                                    
    However, how I could create the only 1 PCR for 6 variable?
    regards,
    Saurabh Garg

  • How to read from text file?

    I would like to read data (frequencies) already written in a text file. I will need read these frequencies one at a time to set the function generator (as part of my data acquisition application), acquire data that is in turn written to a file and then go back and read the next frequency from the file to repeat the process again. I also have another idea of doing the same, which is read all the frequencies from the text file and populate a table and a frequency value is picked from the table each time to go through the process mentioned above.
    Can anyone suggest the following: (1) How to read from a text file, (2) What could be the most efficient way of solving my above problem.
    I am a new LabVIEW user and any help will be appreciated.

    Hi Research,
    Depending on the format of the data file, there are a few options for reading it.  If it is tab delimited, you may want to use the Read from SpreadSheet File VI which will read the file into an Array.  You can then use the Index Array VI to pull out individual entries.  If the files is ASCII but not tab delimited, you could use the regular Open File and Read File VIs.  You can either read the file out piece by piece, or read the entire file into a string and then use the Match Pattern VI to parse out the different elements (there are actually many ways to do this - check out the Strings subpalette). 
    Since you're new to LabVIEW, you may want to check out these resources:
    Three Hour Introduction to LabVIEW
    Six Hour Introduction to LabVIEW
    Getting Started with LabVIEW
    I hope this helps!  Let us know if you have more questions,
    Megan B.
    National Instruments

  • How to read from UDP ??

    Hello,
       I have a device which sends MPEG2 multicast udp live stream, I can read it from udp://@236.1.1.14:34000 for instance. Next it is transcoded with vlc :
    cvlc -vvv udp://@236.1.1.14:34000 --sout \
            "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=250,sc ale=0.6,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10013,mux=ts }" 2>1 > /dev/null &
    My question is how to read from udp://@127.0.0.1:10013 using FMS and send it to flash clients ?
    Thank you

    Hi Nikhil,
        Thank you for the response. But what kind of streams can I feed into FMS input ? VLC supports other types of output, HTTP for example

  • How to read from file just the 2nd line onwards?

    hi guys can anyone help me?
    how to read from the file if the file was like this
    2 2
    2 1
    1 3
    and i want to get the 2 1 ,just the 2nd line and the 3rd line?
    i tried using the string tokenizer but it kept saying
    no such element
    i tried this code:
    StringTokenizer cols = new StringTokenizer(s," ");
         temp =  (String) (cols.nextElement());
         num_rows = Integer.parseInt(temp);
         temp = (String) (cols.nextElement());
         num_cols = Integer.parseInt(temp);
         matrix = new int [num_rows][num_cols];
         // to add all the values in the data file into an array                         
         while ( s!= null ) {
         StringTokenizer st1 = new StringTokenizer (s);
               while (st1.hasMoreTokens()){
                     for (i=0; i<num_rows; i++){
                          for (j=0; j<num_cols; j++)
                             matrix[i][j] = Integer.parseInt
                                ( st1.nextToken());
                } // whilecan anyone please help me?
    thanks

    This will read the file witout the first line:
    import java.io.*;
    import java.util.*;
    public class Read2
    public static void main (String[] args)
         try
              FileReader     file = new FileReader("f.txt");
              BufferedReader buff = new BufferedReader(file);
              String         line  = buff.readLine();
              while (line != null)
                   line = buff.readLine();
                   System.out.println(line);
              buff.close();
         catch(IOException e)
              System.out.println("IO Error");
    }       Noah

  • How to Read from Standard Input?

    Hi,
    I am new to Java. Been reading the tutorial, but still unable to find How to read from standard Input.
    Can anyone help? Thanks.
    Here is my simple & error code:
    public class test
    public static void main(String[] args)
    char filename[];
    int i=0;
    System.out.print("Type in a filename to read: ");
    while ( System.in(filename) != -1 )
    i++;
    System.out.print(filename);
    RP

    import java.io.*;
    public class forum{
         public static void main(String args[]) throws IOException
    InputStreamReader is = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(is);
    String input = "";
    do
    try
    System.out.println("Enter command: ");
    input = br.readLine();
    catch ( IOException io ) {}
    } while (!input.equals("exit"));
    [code\]
    package to import is java.io.*;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Lightroom encountered and error when reading from it preview cache and needs to quit

    A power outage caused my Lightroom 5.2 to shut down without closing.  When I powered back up and opened lightroom it gives me an error "Lightroom encountered and error when reading from it preview cache and needs to quit" and then it says it will try to fix it the next time it opens. I have opened it 20 times and it is not fixing it. I removed the program completely and upgraded to 5.5 AND it is still giving me the same error.  Is my catalog corrupt or something? I had it set to automatically load the most currently used catalog, so it is not allowing me to open or start a new catalog either. HELP!!!

    Search the forum, this has been answered many times.

  • "Lightroom encountered and error when reading from its preview cache and needs to quit"

    I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried uninstalled and installing the app and the error remains.
    Any Ideas here? Is there another app that may be telling it where to look for the cache and it no longer there? I was using a ramdisk for a bit but ditched it. Not sure if that has something to do with it but it seems suspect.
    Your thoughts?
    --Kenny Brandon Wilson

    Talked to Adobe support this morning, this is their response in case anyone else is looking for help. I'm running a Windows 7 box, LR 5.6.
      Gokul: Click on start and type %appdata%, then open roaming folder.
      Edward: ok
      Gokul: Open Adobe folder.
      Gokul: Open Lightroom folder.
      Gokul: Open Lightroom folder> Preferences.
      Edward: ok
      Gokul: Rename Lightroom 5 Preferences.agprefs file as Lightroom 5 Preferences.agprefsOLD.
      Edward: OK
      Gokul: Please check if you can launch Lightroom without any error.
      Edward: it shows me a welcome screen and is asking me to select my country
      Edward: aka, register the software
      Gokul: You can skip and launch it.
      Edward: LR catalog not found
      Gokul: Please select the catalog.
      Edward: my original catalog?
      Gokul: Yes.
      Edward: testing integrity of catalog
      Edward: loaded just fine
      Gokul: Okay.
      Gokul: Please check if you can re-launch it again.
      Edward: yes, it worked!
      Gokul: Excellent!
      Gokul: Since your preferences were corrupted you were facing issue so we renamed the preferences file to reset it.
      Edward: aha....ok
    All of my import/export presets were intact along with develop user presets. I'm happy as a clam for my $10/month!

  • I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried

    I keep receiving this error every time I open LR, "Lightroom encountered and error when reading from its preview cache and needs to quit" and the app won't open. It said LR would try and fix this error next time I opened it but the error remains. I tried uninstalled and installing the app and the error remains. I have windows 8. Can anyone please help???

    Use Windows Explorer to open the folder containing your catalog. The normal location is Pictures\Lightroom. Locate a folder with the extension .lrdata and delete that folder. Then you should be able to start Lightroom again, and Lightroom will begin building and new previews folder. Do not delete anything else.

  • How to read from and write into the same file from multiple threads?

    I need to read from and write into a same file multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

    Assuming you are using RandomAccessFile, you can use the locking functionality in the Java NIO library to lock sections of a file that you are reading/writing from each thread (or process).
    If you can't use NIO, and all your threads are in the same application, you can create your own in-process locking mechanism that each thread uses prior to accessing the file. That would take some development, and the OS already has the capability, so using NIO is the best way to go if you can use JDK 1.4 or higher.
    - K
    I need to read from and write into a same file
    multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

  • How to read from BLOB and Write to a file in user readable format.

    Hi,
         I am trying to read from a BLOB column and write the content to a file in user readable format. So far I was able to read the Blob column using dbms_lob, but not able to write to a file. Kindly let me know the method to do this.

    Hi, with this Java Code from Oracle Technet it's a easy thing:
    // classpath= /ORACLE/u01/app/oracle/product/10.2.0.3/jdbc/lib/ojdbc14.jar
    // Java SQL classes
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    // Oracle JDBC driver class
    import oracle.jdbc.OracleDriver;
    // Java IO classes
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    //Java Util classes
    import java.util.Properties;
    * This class demonstrates the Oracle JDBC 10g enhanced features for inserting
    * and retrieving CLOB data from the database. Using the new features, large
    * data of more than 32765 bytes can be inserted into the database using the
    * existing PreparedStatement.setString() and PreparedStatement.getString()
    * methods.
    public class ClobMan {
    /* Database Connection object */
    private Connection conn = null;
    /* Variables to hold database details */
    private String url = null;
    private String user = null;
    private String password = null;
    // Create a property object to hold the username, password and
    // the new property SetBigStringTryClob.
    private Properties props = new Properties();
    /* String to hold file name */
    private String fileName = null;
    * Default Constructor to instantiate and get a handle to class methods
    * and variables.
    public ClobMan(String fileName) {
    this.fileName = fileName;
    * Main runnable class.
    public static void main(String[] args) throws SQLException {
    // Instantiate the main class.
    ClobMan clobMan = new ClobMan(args[0]);
    // Load the Oracle JDBC driver class.
    DriverManager.registerDriver(new OracleDriver());
    // Load the database details into the variables.
    String dbUrl = "jdbc:oracle:thin:@pmol:1550:dbpmol";
    clobMan.url = dbUrl;
    clobMan.user = "gh10";
    clobMan.password = "secret";
    // Populate the property object to hold the username, password and
    // the new property 'SetBigStringTryClob' which is set to true. Setting
    // this property allows inserting of large data using the existing
    // setString() method, to a CLOB column in the database.
    clobMan.props.put("user", clobMan.user );
    clobMan.props.put("password", clobMan.password);
    clobMan.props.put("SetBigStringTryClob", "true");
    // Check if the table 'CLOB_TAB' is present in the database.
    //clobMan.checkTables();
    // Call the methods to insert and select CLOB from the database.
    //clobMan.insertClob();
    clobMan.selectClob();
    * This method will insert the data into a CLOB column in the database.
    * Oracle JDBC 10g has enhanced the existing PreparedStatement.setString()
    * method for setting the data more than 32765 bytes. So, using setString(),
    * it is now easy to insert CLOB data into the database directly.
    private void insertClob() throws SQLException {
    // Create a PreparedStatement object.
    PreparedStatement pstmt = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query to insert data into the CLOB column in the database.
    String sql = "INSERT INTO clob_tab VALUES(?)";
    // Read a big file(larger than 32765 bytes)
    String str = this.readFile();
    // Create the OraclePreparedStatement object
    pstmt = conn.prepareStatement(sql);
    // Use the same setString() method which is enhanced to insert
    // the CLOB data. The string data is automatically transformed into a
    // clob and inserted into the database column. Make sure that the
    // Connection property - 'SetBigStringTryClob' is set to true for
    // the insert to happen.
    pstmt.setString(1,str);
    // Execute the PreparedStatement
    pstmt.executeUpdate();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and inserting into " +
    "the database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and inserting into the" +
    " database table: " + ex.toString());
    } finally {
    // Close the Statement and the connection objects.
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * This method reads the CLOB data from the database by using getString()
    * method.
    private void selectClob() throws SQLException {
    // Create a PreparedStatement object
    PreparedStatement pstmt = null;
    // Create a ResultSet to hold the records retrieved.
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create SQL query statement to retrieve records having CLOB data from
    // the database.
    String sqlCall = "SELECT rownum, name, sourcetext FROM t_source";
    pstmt= conn.prepareStatement(sqlCall);
    // Execute the PrepareStatement
    rset = pstmt.executeQuery();
    String rownum = null;
    String o_name =null;
    String clobVal = null;
    // Get the CLOB value from the resultset
    //java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter("pr_all.sql"));
    while (rset.next()) {
    rownum = rset.getString(1);
         o_name = rset.getString(2);
         clobVal = rset.getString(3);
    System.out.println(" length: "+clobVal.length()+" "+o_name+" "+rownum);
         java.io.BufferedWriter out =
         new java.io.BufferedWriter(new java.io.FileWriter(o_name+".prc"));
         out.write(clobVal);
         out.newLine();
         out.write("/");
         out.newLine();
         out.newLine();
    out.flush();
    out.close();
    } catch (SQLException sqlex) {
    // Catch Exceptions and display messages accordingly.
    System.out.println("SQLException while connecting and querying the " +
    "database table: " + sqlex.toString());
    } catch (Exception ex) {
    System.out.println("Exception while connecting and querying the " +
    "database table: " + ex.toString());
    } finally {
    // Close the resultset, statement and the connection objects.
    if (rset !=null) rset.close();
    if (pstmt!=null) pstmt.close();
    if (conn!=null) conn.close();
    * Method to check if the table ('CLOB_TAB') exists in the database; if not
    * then it is created.
    * Table Name: CLOB_TAB
    * Column Name Type
    * col_col CLOB
    private void checkTables() {
    Statement stmt = null;
    ResultSet rset = null;
    try {
    // Create the database connection, if it is closed.
    if ((conn==null)||conn.isClosed()){
    // Connect to the database.
    conn = DriverManager.getConnection( this.url, this.props );
    // Create Statement object
    stmt = conn.createStatement();
    // Check if the table is present
    rset = stmt.executeQuery(" SELECT table_name FROM user_tables "+
    " WHERE table_name = 'CLOB_TAB' ");
    // If the table is not present, then create the table.
    if (!rset.next()) {
    // Table does not exist, create it
    stmt.executeUpdate(" CREATE TABLE clob_tab(clob_col CLOB)");
    } catch (SQLException sqlEx) {
    System.out.println("Could not create table clob_tab : "
    +sqlEx.toString());
    } finally {
    try {
    if( rset != null ) rset.close();
    if( stmt != null ) stmt.close();
    if (conn!=null) conn.close();
    } catch(SQLException ex) {
    System.out.println("Could not close objects in checkTables method : "
    +ex.toString());
    * This method reads the specified text file and, returns the content
    * as a string.
    private String readFile()
    throws FileNotFoundException, IOException{
    // Read the file whose content has to be passed as String
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    String nextLine = "";
    StringBuffer sb = new StringBuffer();
    while ((nextLine = br.readLine()) != null) {
    sb.append(nextLine);
    // Convert the content into to a string
    String clobData = sb.toString();
    // Return the data.
    return clobData;
    }

  • How to Read from two file and write to another file --Please help !!

    Hi all,
    Please suggest me where i'm goin goin wrng.
    I have 2 flat files. one of them is the main file(Ann.dat) has a about 150,000 lines (each line has unique ID from 00001 to 45000) of data and the the other(Miss.dat) has a just a list of IDs that are no longer in use & have to be deleted from the first file(NewAnn.dat). (Note that Ann.dat is a tab delimitted file and Miss.dat is just a list of all invalid IDs)
    Below is my code. It doesn't do what I'm supposed to. Please suggest me or help me with a code to do it. What I'm trying to do is read each of the lines from the 2 files compare the ID in ann.dat with all the IDs in Miss.dat & if it doesn't match with the ID in Miss.dat write the whole line to NewAnn.dat. And do the rest with all the lines in Ann.dat.
    It could be a real dumb question. since i'm not a software professional, I consider myself to be newbie to programming. I desperately need your help.
    import java.io.*;
    import java.util.*;
    public class anntemp{
         public static void main(String[] args)
              String keyAnn ="";
              String keyMis="";
              String recAnn =null;
              String recMis =null;
              try{               
              FileReader fr=new FileReader("C:\\Tom\\Ann.dat");
              BufferedReader br=new BufferedReader(fr);
              int couter=0;
              while ((recAnn = br.readLine())!=null)
                   couter++;
                   keyAnn = recAnn.substring(0, recAnn.indexOf("\t"));
              FileReader fr1=new FileReader("C:\\Tom\\Miss.dat");
              BufferedReader br1=new BufferedReader(fr1);
              while((recMis = br1.readLine())!=null){
              keyMis = recMis.substring(0, recMis.indexOf("\t"));
                   if(keyAnn.equals(keyMis)){
         FileWriter fw=new FileWriter("C:\\Tom\\NewAnn.dat",true);
         BufferedWriter bw=new BufferedWriter(fw);
         PrintWriter pw=new PrintWriter(bw);
         StringBuffer writeValue = new StringBuffer();
         writeValue.append(recAnn);
                                                 pw.println(writeValue.toString());
         pw.flush();
              }catch (Exception expe){
                   System.out.println("In Exception ");
                   expe.printStackTrace();
    Thank you all in advance,
    br

    I think you need to close the files when you are done in the inner loop. Plus I think you'll be overwritting the file in the inner loop if more than one match. It might be easier to read the unused id file into a map at the start, and then loop up the id's from the master file in the map. You can put the unused id's in as the keys, and a Boolean.TRUE as the value (value won't matter). Then just check if the map contains the key for the id read from the master file. That should cut down on disk activity. This assumes the unused id file is smallish.

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

Maybe you are looking for