From the course: Java EE: Servlets and JavaServer Pages (JSP)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

JSP elements: Declaration

JSP elements: Declaration

From the course: Java EE: Servlets and JavaServer Pages (JSP)

Start my 1-month free trial

JSP elements: Declaration

- [Instructor] Now let's take a look at the declaration demo. What we are going to do is when I click on the login hyperlink on my landing page, there's a section out here which is going to display date and time for me. Now this date and time is of course going to change on a daily basis. The time may be minute basis, second basis, etc. So what we're going to do is we're going to display this date and time dynamically and all of this we're going to do with the declaration element. So let's go to the login jsp in our Eclipse. This is the login jsp and line number 38 onwards is the section which will allow me to display that date and time. Now, what I'm going to do is I'm going to go at the end of this file, and after the footer on line number 82, I'm going to open up a declaration element. Please note that the code for declaration or scriplet elements can be written anywhere on this jsp page. It really doesn't matter with the order that you're following. So let me begin a declaration…

Contents