简体   繁体   中英

What is the equivalent of die() in Spring?

In PHP there is the die("some message"); to write output and stop the execution of the script. So is there an equivalent in Spring mvc ( in Controller and in the JSP ) ?

There is no reason to have something like die() in Java/JSPs. JSPs should be used as a pure view technology. It should just generate HTML. Not try to access a database, read files or whatnot. That is the job of a controller, written in Java

Use System.exit(0); to exit the java code.

Keep a note this will stop the JVM instance which is currently running.

If you want to come out of a method use return or throw exception to showcase error condition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM