Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2003, 05:44 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Capi
Default Reading and Writing Objects

Hi,

We have been written a small application that saves our data using ObjectOutputStream. We saved our object with writeObject(palet). Palet is an array of data 'Palet[] palet = new Palet[25]'. We seem to beable to save the data but reading it back we get an Exception error.

Our code for reading it back looks like this:


    public void PaletInit() throws IOException, ClassNotFoundException
    {
        boolean blnTemp = true;
        try
        {
            File data = new File("palet.obj");
            ObjectInputStream in = new ObjectInputStream(new FileInputStream(data));

            while(blnTemp == true)
            {
                index = 0;
                palet[index] = (Palet) in.readObject();
            }
            in.close();
        }
        catch (Exception e)
        {
            System.out.println("Error during input");
        }
    }

We currently rewrote our program using binary stream and that works but would like to figure out why we couldn't get the object reading to work.



 
Old July 10th, 2003, 08:59 AM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jwenting Send a message via MSN to jwenting
Default

Read up on serialization.
The class you try to load probably has non-serializable data that isn't properly initialised when loaded.
 
Old July 29th, 2003, 03:26 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Capi
Default

Took a while but that did it.

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading and writing .PST file shoakat ASP.NET 2.0 Basics 1 January 25th, 2011 08:31 AM
Reading and Writing to Serial Devices muralidharan.d C# 2005 0 May 10th, 2007 07:50 AM
Writing works then reading fails childoftv XSLT 3 April 22nd, 2006 04:09 AM
Reading from a xml file and writing to another billy_bob_the_3rd XML 5 April 29th, 2005 01:40 PM
Reading / Writing from Serial Port ashu_from_india General .NET 1 April 29th, 2005 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.