|
Re: Unable to compile class for JSP [message #650692 is a reply to message #650687] |
Wed, 26 January 2011 05:50 |
|
On 2011.01.25 21:10, llk wrote:
> I just started using eclipse today for first time.
>
> I created some JSPs and then created a java bean.
>
> The JSPs were running fine till I added the bean, Now the jsp that uses
> the bean gives error:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
> An error occurred at line: 11 in the jsp file: /SaveName.jsp
> UserData cannot be resolved to a type
>
> Not sure what this menas. The java file compiled fine.
>
> Here is the java bean:
>
> public class UserData {
> String username;
> String email;
> String age;
> // java BEAN!
>
> public void setUsername( String value )
> {
> username = value;
> }
>
> public void setEmail( String value )
> {
> email = value;
> }
>
> public void setAge( String value )
> {
> age = value;
> }
>
> public String getUsername() { return username; }
>
> public String getEmail() { return email; }
>
> public String getAge() { return age; }
> }
>
> Problem is in this line in JSP:
>
> <jsp:useBean id="user" class="UserData" scope="session"/>
> <jsp:setProperty name="user" property="*"/>
>
> is it that it cannot find the java class?
>
> Exclipe put the file under "build/classes" directory. Please suggest
> what is the cause.
>
> thanks
Shouldn't your use of useBean should be more something like:
<jsp:useBean id="user" class="packagename.UserData" scope="session" />
|
|
|
|
Powered by
FUDForum. Page generated in 0.08223 seconds