It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers
2

Let's say you go to the database and get a list of objects that contain few attributes (with setter and getter methods), among them, the dbid attribute. The object would be your model. Let's call it myBean.

The Java class from you will do the query will be the Controller class. Let's call it myController. So, the controller should: 1. Get the list of objects you need. 2. Do anything that should be done before representing the information (in your case, I would say nothing) and 3. pass the information to the JSP through the list of your beans setting the information in the request so the information can be displayed.

So, basically, you need to remove from your JSP all the code that is not "view", take it to a "controller" and use a "model" for sending the information from the "controller" to the "view".

Also

You should avoid scriptles (<% %>) in your JSP, better to use JSTL and others similar tools. If you do it, probably your JSP will not have "controller" code.

I recommend you to use a MVC framework, like Spring MVC or Struts, among others.

It is also nice if you create another layer in your code just for database access. This database layer will be used by the controllers so the controllers. You can reuse code, make controllers independent of database and keep them clearer.

I am new too MVC as well, but I can suggest you some tips. Make a bean. Beans are Java class with getter and setter. In your case the bean would be

public class Scope2
{
String dbID;
//all other attributes of the table.Beans should be reusable so usually there is only one bean for one corresponding table
public String getDBID()
{
return dbID;
}
public void setDBID(String dbId)
{
this.dbId=dbId;
}
//Other getters and setters for all other attributes
}

Now make a class that would perform database query. And return bean Scope2 from that class to jsp. And in your jsp you will simply print the values as out.println(bean.getDBID());