What is the best way of reading a browser cookie and writing to sessionbean

Hi,
So far I have happily written a cookie in the visting browser and happily can display with a browser using a servlet println etc
But what is the best way to take that value and put it into say getSessionBean1().setCookieValue("Cookievalue");
I was thinking on the lines of calling a forward from the servlet "nexpage?cookievalue=stringetc".... or is there some nicer way?
Thanks
James

In the page I simply referenced the facescontext directly... no need for a custom servlet.
public void createcookie() {
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletResponse resp = (HttpServletResponse)fc.getExternalContext().getResponse();
Cookie userCookie = new Cookie("cookiename", "cookievalue");
userCookie.setMaxAge(-1);
userCookie.setMaxAge(3600);
resp.addCookie(userCookie);
return null;
public String readcookie() {
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
Map cookiemap = ec.getRequestCookieMap();
if (cookiemap != null) {
Cookie cookie = (Cookie) cookiemap.get("cookievalue");
return cookievalue;
For reference I could not get getCookies() method of HttpServletRequest to work.. it would only return JSESSIONID.

Similar Messages

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi ,
    I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
    What is the best way to read the data form the excel file in fastest and most efficient way.
    2 nd Problem,
    I have one excel file that has many rows each row contain some data that has certain keywords.
    What I want is  to segregate the data of rows into respective sheets(tabs ) in the workbook.
    for example in rows have following data 
    1. Alfa
    2beta
    3 gama
    4beta
    5gama
    6gama
    7alfa
    in excel
    I want there to be 3 tabs now with each of the key words alfa beta and gamma.

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • What's the best way for reading this binary file?

    I've written a program that acquires data from a DAQmx card and writes it on a binary file (attached file and picture). The data that I'm acquiring comes from 8 channels, at 2.5MS/s for, at least, 5 seconds. What's the best way of reading this binary file, knowing that:
    -I'll need it also on graphics (only after acquiring)
    -I also need to see these values and use them later in Matlab.
    I've tried the "Array to Spreadsheet String", but LabView goes out of memory (even if I don't use all of the 8 channels, but only 1).
    LabView 8.6
    Solved!
    Go to Solution.
    Attachments:
    AcquireWrite02.vi ‏15 KB
    myvi.jpg ‏55 KB

    But my real problem, at least now, is how can I divide the information to get not only one graphic but eight?
    I can read the file, but I get this (with only two channels):
    So what I tried was, using a for loop, saving 250 elements in different arrays and then writing it to the .txt file. But it doesn't come right... I used 250 because that's what I got from the graphic: at each 250 points it plots the other channel.
    Am I missing something here? How should I treat the information coming from the binary file, if not the way I'm doing?
    (attached are the .vi files I'm using to save in the .txt format)
    (EDITED. I just saw that I was dividing my graph's data in 4 just before plotting it... so It isn't 250 but 1000 elements for each channel... Still, the problem has not been solved)
    Message Edited by Danigno on 11-17-2008 08:47 AM
    Attachments:
    mygraph.jpg ‏280 KB
    Read Binary File and Save as txt - 2 channels - with SetFilePosition.vi ‏14 KB
    Read Binary File and Save as txt - with SetFilePosition_b_save2files_with_array.vi ‏14 KB

  • What's the best way to read JSON data?

    Hi all;
    What is the best way to read in JSON data? And is the best way to use it once read in to turn it into XML and apply XPath?
    thanks - dave

    jtahlborn wrote:
    without having a better understanding of what your definition of "use it" is, this question is essentially unanswerable. Jackson is a fairly popular library for translating json to/from java objects. the json website provides a very basic library for parsing to/from xml. which one is the "best" depends on what you want to do with it.Good point. We have a reporting product ([www.windward.net|http://www.windward.net]) and we've had a number of people ask us for JSON support. But how complex the data is and what they want to pull is all over the place. The one thing that's commin is they generally want to pull down the JSON data, and then put specific items from that in the report.
    XML/XPath struck me as a good way to do this for a couple of reasons. First it seems to map well to the JSON data layout. Second it provides a known query language. Third, we have a really good XPath wizard and we could then use it for JSON also.
    ??? - thanks - dave

  • This community is great -- very helpful. What is the best way to read "word" docs on my brand new iPad 2? Is there an app for that?

    This community is great -- very helpful. What is the best way to read "word" docs on my brand new iPad 2? Is there an app for that?

    If you're just reading them from email attachments, you can just open it to "view" the document.
    However, if you wish to do editing and work, you'll need an application. I use Documents to Go, but there are other versions that people are happy with - do a search in the App store for "office suite" or "word processing".
    The next challenge is getting docs back and forth. Doc2Go and others have their own ways to physically sync docs when connected to a computer; you can also email changed/revised/new documents from the iPad to yourself. However, I use a "cloud service" called DropBox that stores docs in the cloud (so I can get to them anywhere) - I paid for the Premium version of Docs2Go to allow that kind of syncing.

  • What is the best way to have access to OSX and OS9 from the same machine?

    What is the best way to have access to OSX and OS9 from the same machine?
    Do I need to partition the hard drive? Installed both Tiger and OS 9 on the G5 and it is having problems starting up properly.
    G5   Mac OS X (10.4)  

    And here is the prove for Edwin's message: Macintosh: Some Computers Only Start Up in Mac OS X

  • What's the best way to set up my iPad and iPhone through I tunes

    I have an iPad and now an iPhone what's the best way to sync these in iTunes I'm assuming I'll use the same account and as such the same music aps etcwill sync on both devices? Also it is best to back up to the cloud and would this allows instant transfer of data between device ie pictures? Thanks

    You can use the same Apple ID, iTunes will still be able to tell them apart. If both are on IOS 5.x, you can use backup from the iCloud. To have pictures across all you devices, switch Photo Stream to ON.
    Settings > iCloud > Photo Stream.
    (Note: Photos that are already in Photo Library will not stream, only those you take after Photo Stream is switched on)

  • What is the best way to clean up your mac and make it faster and run to an optimum level?

    Hi Everyone, Hope all is well
    Iv been running my mac pro for a long time now, its a Mac pro, 2x 2.26 GHz Quad Core Intel Xeon. 12 GB 1066 MHz DDR3 Ram
    Over time now it has become slower, at the moment its still running fine but im sure over time it has probabally collected unwanted data etc. i just dont want it to become a problem as its only going to be used more and more... i now notice that some of the regular programs which i open do take a little while longer to open and i sometimes see that little round Mac loading the sign (the round multicolor wheel).., is there a way to clean the mac up? so that it can run more smoothly and just a better over all feel.,,, the machine is still running beautifully but its time i give it more care and revive it a little more..
    What are the best ways to do this, i dont trust any of these non apple based products which claim they can clean ur Mac etc.
    Any solutaion and advice that u guys can give would be great and i would be very thankful
    Thanks in advance

    For immediate speed improvements, upgrade to a Solid State Drive and upgrade your conventional hard drives to new ones, because the newer ones are faster at reading and writing than the ones from 5 years ago.
    By Re-installing your OS onto a solid state drive, the system will boot much faster, and your programs will launch much faster.
    I use a small SSD (only 60GB) which contains only OS X and all my apps.  All of my personal files are on the large mechanical hard drive.  If you still use the drive that shipped with the Mac, then it might be a good idea to replace it.
    Depending on what kind of work you do, then additional RAM will help.  Swapping CPUs should only be done if you are really in need of the improvements they would bring. 
    You appear to have the 2009 dual-CPU Mac Pro, which is the most challenging model to swap CPUs into.

  • What's the best way to copy a big poster and print it out?

    I'm doing a big art project (around 5ft by 5ft), where I'm going to draw stuff out by hand, and would like to make a copy of that project by scanning it into the computer, or taking high-res photos of the project and compiling them together in the computer, and then printing the image out at that size, or bigger. So, I will have the original, 5x5ft, and a printed copy. 
    What's the best way of doing this?
    I hear that vector images are ideal for this, so is Illustrator recommended for this?
    I know it's a vector graphics program, but is there any way I can take a bitmap image from a scan or photo, and somehow turn it into a vector? If this is not possible, what recommendations would you have?
    I have Illustrator CS2.

    Take the photo in one shot by a camera with 24MP, e.g.
    http://www.kenrockwell.com/nikon/d3x.htm
    This should be sufficient for a poster reproduction 5ft square
    as a raster image.
    For vectorizing one doesn't need high resolution (it's often
    recommended to blur the source image).
    Perspective and lens corrections can be applied by Photoshop,
    but the lighting should be well balanced.
    Barrel distortion by wide angle lens is really no problem.
    Plenty examples:
    All photos here were taken without tripod by a 170 Euro camera.
    http://www.fho-emden.de/~hoffmann/andalusien13032010.pdf
    Especially see p.20, a photo (with flash) of an exhibition photo,
    viewing direction not orthogonal to the object, then perspectively
    and lens-distortion corrected.
    (The PDF shows the photos heavily downsampled).
    Best regards --Gernot Hoffmann

  • What is the best way to preorder multiple iPhone 6s and take advantage of the $200 trade in deal?

    Here's my scenario.
    Currently: I have 2 iPhone 4 and 1 iPhone 4S
    Plan: Upgrade all three to iPhone 6 Plus (16GB)
    What is the best way to do the $200 trade in deal for each of the old phone?
    http://www.verizonwireless.com/support/faqs/Equipment/trade_in_program.html#iPhone Trade-in Promotion
    1. When I preorder at 12:01 AM do I have to pay $300 or $100 for each?
    2. Do I have to send the old iPhones first in order to get the $200 gift cards?
    What should I do to make sure each preorder can be discounted?

        Vice_Actual,
    Thank you so much for reaching out to us. We are super excited about the launch of the new iPhone. In order to get the trade in deal you would need to trade in the device and then you would get a Verizon Wireless gift card mailed out to you. If you pay for the devices with a credit card on pre-order the card will not be charged until the devices are shipped.
    KevinR_VZW
    Follow us on Twitter @VZWSupport

  • What is the best way to sharpen using both Lightroom_4 and Photoshop CS6?

    I want to learn the best way to sharpen various subjects.  I have Martin Evening's latest Lightroom 4 and Photoshop CS6 books, but no mention of which methods are better,  or better for which subjects/conditions.  It seems that Camera Raw and Lightroom are the same, so I'm tempted to just do it all in Lightroom with the Develop module Detail panel, and the adjustment brush for local sharpening. But can I be doing more with Photoshop CS6, or Lightroom and Photoshop together?

    Lightroom and Photoshop have different capabilities.  Photoshop power lies in layers so sharpening in Photoshop is best done using a sharpening layer which can be blended and masked into layers below.  Lightroom is more a image developer then and editor and does not have layer support.  Both Lightroom and Photoshop use Adobe RAW conversion engine to develop images.  Adobe RAW Conversion Engine has very good sharpening and noise reduction capabilities. Sharpening and Noise reduction is more or less a balancing act to much sharpening enhances noise to much noise reducing loose details and add softness.  Though both Photoshop and Lightroom use the same Adobe RAW conversion engine they use different user interfaces when they use Adobe RAW conversion engine.  Lightroom also lacks Layer support.

  • What's the best way of reading PDF books in iPhone? Please, name software.

    Hey all,
    I have a PC but a friend of mine has MAC, and we're both looking for best way to view pdf documents, but not through e-mail savings. Can you please help us, by naming any good APP or anything like that.
    Thanks for the answer,
    Mari!

    If the app store is not available then no one can recommend an app to read PDFs except as email attachments.

  • What is the best way to read in a file?

    i'm currently doing it like this:
    Vector inVector = new Vector();
    try
    File file = new File( "C:/1jkiesel/testAgent/Customers.txt" );
    BufferedReader in = new BufferedReader( new FileReader( file ) );
    String str;
    while( ( str = in.readLine() ) != null )
    inVector.add( str );
    in.close();
    catch( IOException e )
    e.printStackTrace();
    is there a better way? especially th full file path thing...

    I did a search in the formums for
    "best practice read file"
    there were too many results so it was not very helpful
    I think that the best practice is to look at the "read" methods for
    each stream super class and decide which one is best for the particular
    application you have.
    I ask a follow up question:
    Is there a web page where we can find some comparisons of the various methods? Comparisons like speed, size, exception handling?
    hope this helps

  • What's the best way to read in some strings?

    Please read the code below:
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    if I just press a Return key, what's the value of str?
    It seems not to be"\n" or "\r"?
    by the way,who can tell me a most efficient way to get the keyboard input?

    can't get to the link.
    Please see:
    http://www.csupomona.edu/~cs/labs/help_pages/docs/java/
    eyboard_Input.htm
    What is your opinion?

  • What's the best way to be able to access and work on files between new iMacs?

    One is used in office downstairs and other is for personal. We want to be able access office documents and work on them upstairs.

    There really is no best way, without knowing what you want to do more in-depth it's difficult to recommend.  You can turn on iCloud on both machines, you can use Sharing on both and/or  you can use a Dropbox account. Please explain in-depth what kind of files you will be sharing and what you are thinking of.

Maybe you are looking for