Java EE 7 Application Developer — Question 7
Which two approaches would result in the current date being added to the output of a JSP? (Choose two.)
Answer options
- A. <%= out.printIn(new java.util.Date()) %>
- B. <% out.printIn(new java.util.Date()); %>
- C. <%= new java.util.Date() %>
- D. <% System.out.printIn(new java.util.Date()); %>
Correct answer: A, C
Explanation
The correct answers, A and C, both utilize expression language to output the current date directly to the response. Option B does not output the date because it lacks an expression tag and option D is incorrect due to the use of 'System.out.printIn' instead of the JSP output methods.