Bean?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i have just started reading scriptless JSP's.....its all beginning with JavaBean....i am not familiar with Beans do i need to take a short crash course on Beans or can i go forward??? is Bean knowledge must to understand all other chapters?
Thanks,<br />Pallavi
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Prerequisite for jsp is html and java.
The standard way of handling forms in JSP is to define a "bean". You just need to define a class that has a field corresponding to each field in the form. The class fields must have "setters" that match the names of the form fields.
Once you have defined the class, compile it and make sure it is available in the web-server's classpath. The server may also define special folders where you can place bean classes.
Now you can just add the jsp:useBean tag and the jsp:setProperty tag. The useBean tag will look for an instance of the your class in the session. If the instance is already there, it will update the old instance. Otherwise, it will create a new instance of class(the instance of the class is called a bean), and put it in the session. The setProperty tag will automatically collect the input data, match names against the bean method names, and place the data in the bean!
Perhaps with this prior information, you can first get going with other topics like tags, directives, and session before getting to beans.
[ September 21, 2004: Message edited by: parul sahu ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
created Person class in
D:\Tomcat4.1\webapps\foo\WEB-INF\classes
package foo;
public abstract class Person{
private String name;
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
}
created Employee in
D:\Tomcat4.1\webapps\foo\WEB-INF\classes
package foo;
public class Employee extends Person{
private int empID;
public void setEmpID(int EmpID){
this.empID=empID;
}
public int getEmpID(){
return empID;
}
}
this is not compiling saying cannot resolve symbol Person
where should i place it to make it compile
Thanks,<br />Pallavi
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by pallavi utukuri:
i think i need to do the example given in the book.or else cant be clear
created Person class in
D:\Tomcat4.1\webapps\foo\WEB-INF\classes
package foo;
public abstract class Person{
private String name;
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
}
created Employee in
D:\Tomcat4.1\webapps\foo\WEB-INF\classes
package foo;
public class Employee extends Person{
private int empID;
public void setEmpID(int EmpID){
this.empID=empID;
}
public int getEmpID(){
return empID;
}
}
this is not compiling saying cannot resolve symbol Person
where should i place it to make it compile
I think that Person.class is not present in the foo folder while u try to compile Employee. Try compiling like this "javac -d . Person.java".
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks,<br />Pallavi
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
javac -d . Person.java it compiled fine but same prob when compiling Employee cannot resolve symbol Person
Thanks,<br />Pallavi
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
set classpath=%classpath%;D:\Tomcat4.1\webapps\foo\WEB-INF\classes
then
javac Employee.java
do i have to set the classpath everytime y so?
Thanks,<br />Pallavi
| Where all the women are strong, all the men are good looking and all the tiny ads are above average: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |






