Results 1 to 4 of 4

Thread: JSP Where do I put my bean class file?

  1. #1

    Thread Starter
    Addicted Member MoE70's Avatar
    Join Date
    May 2006
    Posts
    185

    Angry JSP Where do I put my bean class file?

    Hi

    can someone tell me what folder to put a .class file to get my bean to work

    I've made a bean according to this guide, but i dont know how packages work. where do I place my UserBean.class to make it work?

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: JSP Where do I put my bean class file?

    That link is invalid! Also, if I remember correctly class files are what the IDE uses to compile your project. Try saving your files as ".java" in the "src" folder of the package.

    Edit:

    The class files get stored in a folder called "classes" which is inside the "build" folder.
    Last edited by Nightwalker83; Nov 12th, 2010 at 05:24 PM. Reason: Addimg more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Addicted Member MoE70's Avatar
    Join Date
    May 2006
    Posts
    185

    Re: JSP Where do I put my bean class file?

    Nightwalker87, the link works fine for me. try again.

    I'm still getting an error

    org.apache.jasper.JasperException: /SaveName.jsp(1,1) The value for the useBean class attribute user.UserData is invalid.
    My first page, GetName.html looks like:
    HTML Code:
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    name <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    e-mail <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    age <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>

    My SaveName.jsp looks like this:

    Code:
    <jsp:useBean id="user" class="user.UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/> 
    <HTML>
    <BODY>
    <A HREF="NextPage.jsp">Continue</A>
    </BODY>
    </HTML>

    And my UserData class looks like this:

    Code:
    package user;
    
    public class UserData {
    
        String username;
        String email;
        int age;
    
        public void setUsername( String value )
        {
            username = value;
        }
    
        public void setEmail( String value )
        {
            email = value;
        }
    
        public void setAge( int value )
        {
            age = value;
        }
    
        public String getUsername() { return username; }
    
        public String getEmail() { return email; }
    
        public int getAge() { return age; }
    
    }
    and my class is placed in
    Code:
    root>UserData>build>classes>user>UserData.class
    I've also tried it in
    Code:
    root>UserData>build>classes>UserData.class
    Last edited by MoE70; Nov 15th, 2010 at 04:48 AM.

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: JSP Where do I put my bean class file?

    I'm not sure I am only new to Java I could have misunderstood what you originally meant. I haven't learn about how to use java with html yet.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width