can i use a java class file in a similar way as beans

hi
i have a java file which interacts with database and retrives information.

Now can i use this java file in a jsp, where in i can use the functionalities of the java file.

basically, something like createing an object of the java file in jsp.

Comments

  • Well .. you can have a class that represents a row of the table. Call it Class1. That is all fields from the table would be represented as private members. Also for each of the fields you would provide a
    public void setField(type field){} - setter method
    and
    public type getField(){} - getter method.

    There also to be a mathching class (Class2) that will function to access the database, and populate the first class with data. Your JSP then would access the class1.
    From jsp you will have something like ..
    MyForm.class1.field1
    Here field1 - must have a matching method in the class1 named getField1

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion