Using if-else in JSP

It’s almost always advisable to not use scriptlets in your JSP. They’re considered bad form. Instead, try using JSTL (JSP Standard Tag Library) combined with EL (Expression Language) to run the conditional logic you’re trying to do. As an added benefit, JSTL also includes other important features like looping. Instead of: Use: Also, unless you plan on using response.jsp … Read more

if else construction

There are several errors in your code. And you should use a cond when dealing with multiple conditions (think of it as a series of IF/ELSE IF/…/ELSE statements). Be aware that the expression (and (> x 1) (= x 1)) will never be true, as x is either greater than or equal to 1, both … Read more

PHP if not statements

Your logic is slightly off. The second || should be &&: You can see why your original line fails by trying out a sample value. Let’s say $action is “delete”. Here’s how the condition reduces down step by step: Oops! The condition just succeeded and printed “error”, but it was supposed to fail. In fact, … Read more