• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bean?

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hii
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?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

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 ]
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
parul sahu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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".
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Person class is compiling fine....but error is with Employee class how do i compile it
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
compiled Person using
javac -d . Person.java it compiled fine but same prob when compiling Employee cannot resolve symbol Person
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got it used
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?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i cannot see the package foo ??
[ September 28, 2004: Message edited by: li chenli ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic