This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
hi, Im wanting to know what is the best ay to structure a java web application. The way I have set up my web app is i have client(which is composed of jsp pages) and server(which is a webservice to the client that has all the methods that get called from the client to access the database). What is the best way to separate the java code in the jsp pages(in the client) from the html but i still want to use jsp so that i can add some java code where needed? Is this a good way of doing it?
The accepted paradigm for J(2)EE web applications is the Model/View/Controller architecture. The View is typically a JSP or some similar form of page layout template. The Model is usually contained in one or more JavaBeans. The Controller is usually also contained in JavaBeans.
For those with smaller projects, bigger egos, or legacy systems to support, you can always roll your own. So if you want to forgo a framework, the "useBean" JSP tag will quickly become your best friend. You can find plenty of documentation on useBean in any basic J2EE book covering JSPs.
Customer surveys are for companies who didn't pay proper attention to begin with.
The basic idea while implementing is to put all your web service method calls in a java class.After getting the data through service call,put them into a DTO(java bean) and put it in request scope.
The data that you show on JSP will come from java bean retrieved in jsp from the request scope.
To implement the MVC you may use some framework of your choice per convenience,if you feel its necessary