Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Error running Login servlet?


Message #1 by "Low Kok Leong" <lousai@t...> on Sun, 22 Oct 2000 05:14:55 +0100
> Here is my code try to compile but prompt me this error
> unreported exception java.sql.SQLException; must be caught or 
> declared to
> be thrown
>   String uName = validateUser(userId, password);

<snip>

>     public String validateUser(String inputUserid, String inputPwd) 
>             throws SQLException {

Hi,

Your validateUser() method does not need to declare SQLException
as thrown; the try { ... } catch block inside the method deals
with any Exception that may occur, and doesn't seem to re-throw
SQLException. Of course, you could also change the handling so
validateUser() does indeed throw SQLException, and deal with it
by putting try { ... } catch around the call to that method.

Cheers,

Dave.

-- 
David Long <davidl@w...>
Wrox Press - Programmer to Programmer(tm)
http://p2p.wrox.com/

  Return to Index