Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot be resolved to a type

 
preet girn
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic