This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes Eclipse .jsp shows an error -- Httpsession cannot be resolved to a type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Eclipse .jsp shows an error -- Httpsession cannot be resolved to a type" Watch "Eclipse .jsp shows an error -- Httpsession cannot be resolved to a type" New topic
Author

Eclipse .jsp shows an error -- Httpsession cannot be resolved to a type

Mark Wilberg
Greenhorn

Joined: Feb 05, 2011
Posts: 11
Hi,
This time its jsp that i've bumped into

Eclipse shows the error at this line
Httpsession cannot be resolved to a type
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

A few things:
  • Java code in a JSP is a really poor practice that has been discredited for almost 10 years now. Time to move on.
  • If you insist, did you import the class?


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    David O'Meara
    Rancher

    Joined: Mar 06, 2001
    Posts: 13459

    a few things
    * @Bear
    * yes, you still need to import the class similar to regular Java code
    Mark Wilberg
    Greenhorn

    Joined: Feb 05, 2011
    Posts: 11
    Thanks,
    Solved................Never thought that would be that simple! Code worked fine in Windows. Guess some changes have to be incorporated in Linux.
    Stefan Evans
    Bartender

    Joined: Jul 06, 2005
    Posts: 1018
    Is it worth pointing out that there is already an implicit variable called "session" for a JSP?

    So it could just be



    But I prefer using EL and ${sessionScope.id} or even just ${id}
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Eclipse .jsp shows an error -- Httpsession cannot be resolved to a type