🎴 Flashcard Mode
Oracle WebLogic Server Fundamentals
Card1 / 20
Mastered0
Review0
QuestionClick to flip
What is wrong with the following code ? 4. <% 5. if(strPassword.equals("boss")) 6. { 7. <jsp:forward page="Welcome.jsp" flush="true"/> 8. } 9. else 10. { 11. <jsp:forward page="Login.jsp" flush="true"/> 12. } 13. %>
AnswerClick to flip back
A
Actions cannot be used within scriptlet blocks
💡 Explanation:
JSP actions (like jsp:forward) are XML-based tags and cannot be embedded within scriptlet blocks (<% %>). Scriptlets contain Java code, while actions are processed by the JSP container at a different phase. To use actions conditionally, you would need to structure the code differently or use scriptlets exclusively.