The Artima Developer Community
Sponsored Link

Java Answers Forum
Beginner in Trouble

5 replies on 1 page. Most recent reply: Aug 22, 2002 6:38 AM by Mike Murray

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Mike Murray

Posts: 5
Nickname: mikey
Registered: Aug, 2002

Beginner in Trouble Posted: Aug 19, 2002 7:25 AM
Reply to this message Reply
Advertisement
Hi I am new at this whole Java and JSP thing. I've just setup my Tomcat server and Eclipse software. I am in the process of creating my first Javabeans and Java/JSP webapp. It's the usual "Hello World" app. Easy as it might be, it's not working.

helloWorldBean.java file
----------------------------
package org.apache.jsp;

public class helloWorldBean
{
private static String message="Hello World";

/** Returns the message. @return String **/
public String getMessage() {
return message;
}

/** Sets the message. @param message The message to set **/
public void setMessage(String message) {
this.message = message;
}

}

test.jsp file
---------------------------------------------
<%@ page language="java" %>
<jsp:useBean id="helloBean" beanName="helloBean" scope="page" />

<html>
<body>
<jsp:getProperty name="helloBean" property="message" />

</body>
</html>

error i'm getting
---------------------------------------------
org.apache.jasper.compile r.CompileException: /test.jsp(1,0) useBean (helloBean): Either class or type attribute must be specified:

______________________________________________
If someone could please take a look at this I would greatly appreciate it. And then maybe I can start doing some real programming. Thanks.


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Beginner in Trouble Posted: Aug 19, 2002 8:06 AM
Reply to this message Reply

import java.io.*;

public class HelloWorldBean extends Object implements Serializable{

private static String message="Hello World";

/** Returns the message. @return String **/
public String getMessage() {
return message;
}

/** Sets the message. @param message The message to set **/
public void setMessage(String message) {
this.message = message;
}
}

Mike Murray

Posts: 5
Nickname: mikey
Registered: Aug, 2002

Re: Beginner in Trouble Posted: Aug 19, 2002 9:39 AM
Reply to this message Reply
>

> import java.io.*;
>
> public class HelloWorldBean extends Object implements
> Serializable{
>
> private static String message="Hello World";
>
> /** Returns the message. @return String **/
> public String getMessage() {
> return message;
> }
>
> /** Sets the message. @param message The message to
> set **/
> public void setMessage(String message) {
> this.message = message;
> }
> }
>
>



I've replace my code with the above that you wrote. But now i'm getting this error.

____________________________________________________
org.apache.jasper. compiler.ParseException: /test.jsp(1,72) Attribute has no value
____________________________________________________

Do you think it is the placement of my .java files and .class files? I'm still not sure what to do.

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Beginner in Trouble Posted: Aug 19, 2002 1:28 PM
Reply to this message Reply
You need to copy the HelloWorldBean.class file into the
webapps/ROOT/WEB-INF/classes directory
and put the jsp file in the webapps/ROOT directory

Javed

Posts: 15
Nickname: javedm
Registered: Aug, 2002

Re: Beginner in Trouble Posted: Aug 20, 2002 3:11 AM
Reply to this message Reply
import package org.apache.jsp in ur JSP.

Mike Murray

Posts: 5
Nickname: mikey
Registered: Aug, 2002

Re: Beginner in Trouble Posted: Aug 22, 2002 6:38 AM
Reply to this message Reply
Ok thanks i figured it out... let me know if anyone needs the code and i'll email it to them. Thanks for all your help guys.

Flat View: This topic has 5 replies on 1 page
Topic: how do I make jar files Previous Topic   Next Topic Topic: Using filter to get #s from file, sort, show...help?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use