Wrox Programmer Forums
|
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 March 8th, 2004, 09:05 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ioda006
Default Chapter 16

Belive it or not, I have the chapter 16 example working with Apache Tomcat/5.0.16 - sort of.

Everything loads fine. I get a front page and I can access all the other pages. Struts appears to be working fine and the j_security stuff is.. well it's decent enough to make the application work.

The only problem I have is with the add (or i guess its actually the create) function. I can update and delete books just fine, but I can't add new ones. I added books to test via mysql control center.. right now im having trouble trying to create booknews items with it so i havent tested that, but i assume it works the same way (update and remove, but no create).

When I do try to add a new book this is what i get:

HTTP Status 500 - Dispatch[/book/aud] to method add returned an exception

type Status report

message Dispatch[/book/aud] to method add returned an exception

description The server encountered an internal error (Dispatch[/book/aud] to method add returned an exception) that prevented it from fulfilling this request.
Apache Tomcat/5.0.16


I can't find anything wrong with the java classes, but I can't imagine it's a problem with the jsps either. I've looked a ton of places for help, but I can't find anything. It's difficult to catch exceptions with all these seperate files. Any ideas?

Let me know what file source I can post if this will help.
Thanks
JC

 
Old March 8th, 2004, 11:10 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ioda006
Default

AHH! I found the problem. I had to look around on here a bit harder, but the magic for making this work lies in the struts-legacy.jar as i learned from this post:

http://p2p.wrox.com/topic.asp?TOPIC_ID=5160

In the GenericConnection class I replaced


    public CallableStatement prepareCall(String sql, int resultSetType,
                 int resultSetConcurrency,
                 int resultSetHoldability) throws SQLException {
        throw new UnsupportedOperationException();
    }

    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
    throws SQLException {
        throw new UnsupportedOperationException();
    }

    public PreparedStatement prepareStatement(String sql, int columnIndexes[])
    throws SQLException {
        throw new UnsupportedOperationException();
    }


with this:


    public CallableStatement prepareCall(String sql, int resultSetType,
                 int resultSetConcurrency,
                 int resultSetHoldability) throws SQLException {
        throw new UnsupportedOperationException();
    }


    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
        throws SQLException
    {
        if (closed) throw new SQLException(SQLEXCEPTION_CLOSED);

        return (conn.prepareStatement(sql, autoGeneratedKeys));

    }



    public PreparedStatement prepareStatement(String sql, int columnIndexes[])
    throws SQLException {
        throw new UnsupportedOperationException();
    }


Then I compiled that and the GenericDataSource class and put them in a jar and everything ran nice and smooth

Thanks a bundle to whoever figured that out.
 
Old June 17th, 2004, 07:36 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm new to JSP and Java. Would you mind sending me the new struts-legacy.jar? Thanks.

 
Old August 21st, 2004, 07:28 PM
Registered User
 
Join Date: Aug 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to seeDerekNow
Default

How did you compile these? I keep running into errors when I tried compiling. I just have GenericConnection.java and GenericDataSource.java.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 16 Fig 16-11 krsouthern BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 July 8th, 2008 12:11 PM
Chapter 16 boyce0324 VB.NET 2002/2003 Basics 1 June 5th, 2007 01:59 AM
Chapter 16 czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 April 11th, 2005 11:01 AM
chapter 16 ?? farsfar2 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 11 March 26th, 2005 10:01 PM
Help in Chapter 16 aldwincusi VB.NET 2002/2003 Basics 2 June 4th, 2003 09:52 AM





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