How to stop processing a JSP early?

后端 未结 5 1162
失恋的感觉
失恋的感觉 2021-01-18 10:47

I\'ve got a JSP page, which calls a function and checks its return value. If the return value is not null, the JSP page goes on to use it. If the return value IS null, I wan

5条回答
  •  离开以前
    2021-01-18 11:34

    Regardless of how to terminate processing of a JSP early, I would suggest handling flow control in a servlet prior to handling the display, and switch to an appropriate JSP depending on the outcome of the function call.

    I tend to use JSPs purely for displaying the contents of a bean (or more than one), and all logic is contained within the invoking servlet. By doing this you get a much cleaner separation of concerns between your components, and a more easily comprehensible and debuggable system.

提交回复
热议问题