aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes pls help me in javabean usage in jsp(doubt) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "pls help me in javabean usage in jsp(doubt)" Watch "pls help me in javabean usage in jsp(doubt)" New topic
Author

pls help me in javabean usage in jsp(doubt)

bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
Hi All!

i created one bean named as data.i compiled and move class file in to web-inf/classes/data.class.

i created one html file in that one text field named as username(which is property name in bean also) and calling given jsp.

<html>
<body>

<%@ page import="data" %>


<jsp:useBean id="data" class="data">
<jsp:setProperty name="data" property="username" />


<jsp:getProperty name="data" property="username" />


</jsp:useBean>
</body>
</html>

but it showing error as


Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\servletDemo\org\apache\jsp\first_jsp.java:6: '.' expected
import data;
^
1 error

pls help me to resolve this error.

Thanks and Regards
bhaskar.
swarna dasa
Ranch Hand

Joined: Mar 15, 2007
Posts: 108
Did you have a package statement in your data.java file?
If no, then your data class doesn't have a package (it has a default package)

Remove the line
<%@ page import="data" %>
and you should be fine.
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707


You need to import in the following way:
packagename.classname to import particular class OR
packagename.* to import all classes of the package.


only writing import packagename gives error while exception in the Servlet
context.

So it data is a package you do like:
<%@ page import="data.*" %>


Thanks,


cmbhatt
 
 
subject: pls help me in javabean usage in jsp(doubt)