facebook

Where should I put a Java Bean in a web project?

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #246991 Reply

    awebpro
    Member

    Hi,

    Where should I put a java bean in a web project? I simply want to access it from a jsp page.

    Thanks.

    #246999 Reply

    flowcloud
    Member

    you put it /WEB-INF/classes

    #247011 Reply

    awebpro
    Member

    That is where it is. Here is my jsp page. The error I get is

    “org.apache.jasper.JasperException: /address.jsp(29,4) The value for the useBean class attribute src.beans.Address is invalid.” Can you spot what it is? Thanks.

    <%@ page language=”java” import=”java.util.*” %>
    <%@ page import=”src.beans.Address” %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSP ‘address.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>

    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>
    </head>

    <body>
    This is the address JSP page. <br>
    <jsp:useBean id=”Address” class=”src.beans.Address” scope=”session” />
    <jsp:setProperty name=”Address” property=”*” />
    </body>
    </html>

    #247012 Reply

    awebpro
    Member

    OK. If anyone is following this thread, I have finally figured it out.

    Solution:

    Step I.
    I highlighted my project and right clicked on properties.

    Step 2.
    Then I clicked the ‘java build path’ entry on the left side. Once there, under the first tab which is source, I clicked ‘Add folder’. Then I selected my src/beans package. This is where I store my beans.

    Step 3.
    Also in the fourth tab, ‘order and export’, make sure everything is checked. That’s it.

    Also, thanks to flowcloud for responding to my dilemma. I appreciate it.

    #247029 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Where should I put a Java Bean in a web project?

You must be logged in to post in the forum log in