• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use jsp useBean tag

 
Ravinder S Edhan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody...
I'm having weblogic server installed in my system. I'm trying to run <jsp:useBean> but it is giving me error while running my jsp.. Error is --- Cannot resolve symbol.
Is this problem due to ..that my server is not configured or some other problem.
I had placed my class file in [classes] folder under [WEB-INF] folder. My jsp file which I'm calling from an HTML page is placed under [DefaultWebApp] folder.
for ur reference here are three file
1. html
2.jsp &
3. java file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Session Learning</TITLE>
</HEAD>
<BODY>
<FORM METHOD=POST ACTION="saveName.jsp">
Enter name : <INPUT TYPE="text" NAME="username"><BR>
Enter e-mail : <INPUT TYPE="test" NAME="emil">@edhan.com<br>
Enter age : <INPUT TYPE="TEXT" NAME="age">
<BR><INPUT TYPE="submit" VALUE="Enter">
</FORM>
</BODY>
</HTML>
-----------------------
<%@ page language="java" %>
<%@ page import ="java.util.*" %>
<jsp:useBean id="user" class="userData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Hello,
<%= user.getName() %>
<%= user.getEmail() %>
<%= user.getAge() %>
</BODY>
</HTML>
------------------------------
public class userData {
String name;
String email;
int age;
public void setName(String mname) {
name=mname;
}
public void setEmail(String memail) {
email=memail;
}
public void setAge(int mage) {
age=mage;
}
public String getName() { return name; }
public String getEmail() { return email; }
public int getAge() { return age; }
}
------
Please help me out.....
Thanx
 
swapna Kadali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Actually I am new to java. But....
Did you try changing the scope object from session to request or application or page ? Sorry, dont mind if I am wrong, I just got a thought and just in case it works for u.
Swapna.
 
swapna Kadali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can also refer this site,
http://java.sun.com/products/jsp/tags/10/syntaxref10.fm14.html
Swapna
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!