>
>
>
>
> Hello.
>
> I am not sure if this question is even a valid one, since I have not been
> able to find anything in the JSP spec regarding the halting of page
> execution. I'd like to think its not merely a figment of my imagination..
> Perhaps it might help if i explained...
>
> When for example a user visits a jsp page which processes certain request
> parameters, eg a login name and password. A perfectly good way of handling
> this request is:
>
> if (request.getParameter("blah") != null) {
>         // check this
>         // then verify login against db
>         if (user.hasValidLogin(string)) {
>                 // do something else
>                 // output some html
>         } else {
>                 //output some other html
>         }
>         // then something else
> } else {
>         // some logging
> }
>
> What i want to try to acheive instead of compounding more and more if
> loops inside each other is:
>
> if (request.getParameter("blah") == null) {
>         // output some html
>         throw someExceptionToStopExecution();
> }
>
> .. continue code
>
> Is this something that is possible, or is this just a pipedream... ?
>
> Jerome
>
> [>h<] Jerome Pimmel
> [>5<] Hawaii-5-0 Ltd. [.w.] http://www.hawaii-5-0.com
> [>0<] [.e.] [EMAIL PROTECTED] [.m.] 0777 565 8555
>
> [.@.] http://www.funmail.co.uk

        Throwing an Exception would either cause the errorpage or the
        implementation dependent error handling for the
        JSP to be invoked, this is probably not what you want to happen.

        The "easiest" thing to do is imagine that the whole JSP is one
        big "function" or "method" so, simply "return" from it ...

        <% if (request.getParameter("blah") == null) { %>
           // output some html ...
        <%
           return; // return from the body of _jspService() ...
        }
        %>

        This works when the scripting language is Java, but is undefined
        (as yet) for other scriping lanugages.

        Rgds

        - Larry Cable.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to