Hi there all.
I have just started learning jsp and am not sure
how to access a class file from within a jsp page.
I have heard that it should be a Bean and u access
it by doing the following.
<jsp:useBean id="mybean"
scope="page"
class="hellopackage.Hello" /> <jsp:setProperty name="mybean" property=" * " /> My problem is that I have created the following
bean..
package hellopackage;
public class Hello{
private String username; public Hello(){
username=null; } public void setUserName(String name){ username=name; } public String getUsername(){ return username; } } and I am trying to access it with the folowing
page..
<%@ page
import="hellopackage.Hello"%>
<jsp:useBean id="mybean"
scope="page"
class="hellopackage.Hello" /> <jsp:setProperty name="mybean" property=" * " /> <html>
<head><title>Hello,User</title></head> <body bgcolor="#ffffff"
background>
<h1>What is your name ?</h1> <form method="get"> <input type="text" name="username" size="25"> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </form> <% if(request.getParamater("username") !=
null){
%> <%@ include file="response.jsp" %> <% } %> </body> </html> I keep getting the following error
jsp:useBean can't find class
`hellopackage.Hello'
I am realy stuck cause how do u let the jsp see the
bean..
I have even tried putting the bean in a jar file
called hellopackage...
Pls help....
Thanking you all in
adavance
|
- Re: how to access java classes from jsp nadia
- Re: how to access java classes from js... Sachin S. Khanna
- Re: how to access java classes from js... sharma Sumeet
- Re: how to access java classes from js... Angel \"Java\" Lopez
- Re: how to access java classes from js... anoop
- Re: how to access java classes from js... Narasimha Vijaya
- Re: how to access java classes from js... Narasimha Vijaya
- Re: how to access java classes from js... chenghong
- Re: how to access java classes from js... Bob Vú
- Re: how to access java classes from js... Isak-Rickyanto
- Re: how to access java classes from js... Sachin S. Khanna