• Post Reply Bookmark Topic Watch Topic
  • New Topic

Novice (java SE programs to run in java EE)

 
Gregory Prescott
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm am currently doing a group project based on creating a web application in java EE to preform gene searches and data analysis, the group as a whole has only primarily worked on creating applications in java SE.

The layout of the webpage has been set awaiting the functions to be passed too it.

The problem is that the search function has been written by my college in java SE (this works). However I am really struggling to be able to get the web application to use these java files.

I have looked at numerous netbean tutorials and would expect to create a 'session bean' to handle the call but from what I have looked at they don't use main classes and cant see how multiple java classes are called from on bean.

Any help would be appreciated.
 
Swastik Dey
Rancher
Posts: 1683
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically a web application goes through different layers. The user sends the request using html/jsp page (so in your case the input to search data). This data is submitted to a servlet deployed in the web server. The servlet then performs necessary computations and sends the response back to the client/browser. So in your case servlet can you the classes you have written for search functionality.
 
Gregory Prescott
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:Typically a web application goes through different layers. The user sends the request using html/jsp page (so in your case the input to search data). This data is submitted to a servlet deployed in the web server. The servlet then performs necessary computations and sends the response back to the client/browser. So in your case servlet can you the classes you have written for search functionality.


So i already have a Control servlet that currently handles the navigation between pages. I would use this to to retrieve my gene search glasses when it is called via the search submit button on my Main.jsp

 
Swastik Dey
Rancher
Posts: 1683
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.... I think you are on the right direction.
 
Bell Katapa
Ranch Hand
Posts: 57
Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Gregory,

Hope you have made tremendous progress with your project.

I assume from your SE perspective you are invoking the search function and other functional classes from the main method (public static void main(String[] args) { ... }).
Ever heard of the term MVC? It's a very simple yet powerful design pattern that lets you build a project with clear separation of fundamental concerns.
In your case the C-ontrol servlet's doGet() is like the main class of the SE application. The search function and other classes can be ported as they are either as other methods of the servlet (legal but poor practice) or as separate classes preferably in the same package as the controlling servlet. This class or group of classes becomes the M-odel. The HTML/JSP plus associated JavaScript/CSS is what you use to V-iew responses and issue further requests. You can use just servlets to render HTML views but this is generally discouraged. You should use JSPs instead (which are just glorified sevlets themselves).

There is a wonderful chapter on MVC in Oriely's Head First Servlets & JSP book. I think it's titled 'MVC Tutorial'. If you can, read this and then map your project to this 'clean separation of concerns' design methodology. You don't need the 'heavy weight lifting' that comes with the EJB container and session beans. A web profile container such as Apache Tomcat can get you over the line.

Hope i have helped somewhat in clarifying your concerns.


Regards.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!