简体   繁体   中英

Where will be better use logic with conditions on JSP or Java(backend)?

I have 10 different jsp, each of them have similar tag <div class="content"/> Different only style. Each jsp have Label,3 button, and couple forms. I want know, must show tag <div class="content"/> or not depends of 2 buttons and 1 form, if they are fill, I need show CONTENT. Question where better create checking conditions, in each jsp using JSTL or in Java method, and in each jsp call this method ?

PS I using Slice Framework

It is always advisable to not write any logic in presentation layer according to MVC(Model View Controller) structure. So, in this scenario JAVA is more preferable than writing logic in JSP.

It is the standard to not write logic in JSP but if you are using JSTL not scriptlets for logic it is also ok.

It is always recomended to use Presentation layer(HTML,JSP etc) only to perform client validation , showing contents from Model layer , recieving user inputs and displaying outputs.

The business logic recomended to be wrapped in java side. So in your case go ahead with Java part

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