• Post Reply Bookmark Topic Watch Topic
  • New Topic

issue with jsp code

 
zulu zulup
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Java Gurus,
I'm attaching some sample jsp code from my server. I'm basically getting some weird error from second block of my code.
The second block contains if/else, and having hard time to fix variable issue. I'm newbie, learning java.
The first block and second block contains similar code except that second block contains if/else.
I've to use if/else in second block to filter data with null value.
How do I fix the if/else block? Your help is greatly appreciated.



-----------------------this block works without issue----------------------------------------


--------------------if/else this one does not work--------------------------

---------------------if/else creates this error block-----------------------
lastLoginTime cannot be resolved to a variable

----------------------------------------------------------------------------



Thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code is in a JSP?

As a newcomer to Java and JSP, you're heading in the wrong direction. As of JSP 2 in 2002 (over 10 years ago), Java code should never be put into a JSP. If you are using a tutorial of book that does not cover modern JSP with the JSTL and EL, you need to update your materials.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lastLoginTime cannot be resolved to a variable

This means that the variable is not in scope for the statement. Check your nesting.

I highly recommend that you read this article to make sure that you know what JSP is all about.

And then read this article to understand how to structure modern web apps.

Aside from the problem with scope, your code has other problems. For example, trying to assign a String to a Date variable.

I highly recommend focusing on core Java before trying to write web apps using servlets and JSP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!