Now, for some programming advice...
using Java & JSP is not so hard...
You can put all the code into the JSP pages, you can separate some or all of your logic into servlets (small independant routines that run on the server) and leave you presentation logic in jsp files... you can use beans to store data between for passingbetween the logic and jsp, or jsp to jsp, and you can create custom tags to do specific logic that is unique to your site...
in the begining jsp did NOT have any way to loop through a code sequence repeatedly... this was a great weakness of JSP and so developers were forced to either
a) limit their output to fixed number of itterations... troublesome at best
b) create custom tags that would cause a loop.... common in professional applications where they wanted to hide the code...
c) use embedded Java (scriptlets) inthe code to control the loop...
This is just one example of why scriptlets were frequently needed.
Beans can also do more than just store information, you can program any logic into the bean code and trigger it either by the bean constructor or by a call into the bean from the jsp page... this use of beans removes the need, almost entirely, for servlets...
Then there is the MVC which stands for Model View Controller, a fancy way of saying separate logic, data storage "state", and presentation... in the MVC architecture model jsp "shows" the content to the user, and collects data via forms from the user... the forms are sent to the servlets on the server... the servlets handle the logic of processing the data and determine the results... the servlets place any output data, results, etc. into beans objects and save those into a scope that will persist, request, session or application... depending upon the need... the servlet then "forwards" the request to a jsp page, logic can choose between jsp pages if you like, to determine which one to show... this is a unique feature of Java over most other web coding languages... Java can pass the request off to another page, etc. to finish processing... most others cannot do that... that means that the servlet that processes your form, could pass the request to another servlet, and another and antoher, etc. prior to passing it off to the jsp page.... the jsp page, of course, shows the output....
This makes it easier to work in larger projects because it encapulates the code segments into logically related pieces and they are "pluggable" meaning they don't care what the other pieces do, or how, they just do what they do... you can modify the jsp page to chnage the display, without any effect on the servlet, or bean....
Oh, the bean, I forgot to mention... the data that was saved int he bean, because the bean was saved in a scope that persisted, canbe read from the jsp page so it know exactly what the results of the servlet processing were... at least the part it cares about...
jsp's key items are useBean, getProperty and setProperty... for accessing those beans...
Servlets are a bit more trickly but basically they are Java Classes that extend the HttpServlet class and implement the "action" methods of that parent class, but only the ones you need... so you can only worry about what you need... frequestly these are doPost and doGet...
Beans are just Java classes which usually store properties as private variables, and use methods to set or get the values of these properties... as I said, they can do much more too, but they don't have to...
it can be as simple as
private String name = "";
public void setName(String name){
this.name = name; // this.name keyword indicates the bean's name variable as opposed to the local name variable
}
public String getName(){
return this.name;
}
database access from a jsp, servlet or bean is a simple matter... I created a class file in which I place my connection code so I can obfuscate the passwords and usernames for db access, something that is hard to do in ASP, php, etc...
The rest of building you high end applications is the creative use of JSP, Java, Javascript, CSS, HTML, XML, databses and etc. most of which you already know...