aspose file tools*
The moose likes JSP and the fly likes 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "cannot be resolved to a type" Watch "cannot be resolved to a type" New topic
Author

cannot be resolved to a type

preet girn
Greenhorn

Joined: Aug 28, 2012
Posts: 5
Hello to all,

when i was practise a small application i got the error msg "DogBean cannot be resolved to a type"

I have a html form that sends 2 parameter to a controller servlet(named Controller.java),
In this servlet i set both of these parameters as attributes of next request, along with this i set an object of DogBean(a bean class containing 2 properties) as request attribute.
And call a JSP(using RequestDispatcher) named result.jsp (It will just display these attribute values).

Using
<%= request.getAttribute("name") %> 1st attribute( contains the value of 1st parameter of HTML form)


<%= request.getAttribute("type") %> 2nd attribute( contains the value of 2nd parameter of HTML form)


<%= request.getAttribute("dog") %> 3rd attribute ( contains the object of DogBean)

gives the expected result
Abc
A
DogBean@234567

But
when i try to type cast it to DogBean the error occurs.

<%= ((DogBean)request.getAttribute("dog")).getDogname() %>


Compilation of JSP File '/result.jsp' failed:
result.jsp:9:7: DogBean cannot be resolved to a type
<%= ((DogBean)request.getAttribute("dog")).getDogName() %>



jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Preet,

you need to import the dogbean in the jsp like you import the class in servlets.
Please mark the issue for close if you find the answer proper.

Regards
Jatan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: cannot be resolved to a type