- This topic has 4 replies, 3 voices, and was last updated 18 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
awebproMemberHi,
Where should I put a java bean in a web project? I simply want to access it from a jsp page.
Thanks.
flowcloudMemberyou put it /WEB-INF/classes
awebproMemberThat 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>
awebproMemberOK. 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.
Riyad KallaMemberMoving to OT > Soft Dev.
-
AuthorPosts