aspose file tools*
The moose likes Other Application Frameworks and the fly likes Frontman usage for newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Frontman usage for newbie" Watch "Frontman usage for newbie" New topic
Author

Frontman usage for newbie

margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 318
    
    6

I understand what to do with Frontman if I am going from a form jsp to a view but what happens if I need to run code in between?

Do all of these need to be either in the /command/ directory or the /pages/ directory -- if not how do I get to them?

index.jsp user fills in data--> servlet loads javabean with setters and getters, and pojo data class, then searches for data based on index.jsp form and stores it in the javabean --> another jsp displays data from the database --> redirect back to index.jsp for next search

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Sorry, but you'll need to explain what you are trying to do more clearly.

If you haven't read this article, you should do so. In it, I described the patterns that Front Man was designed to facilitate, and is the reason that I wrote Front Man int he first place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 318
    
    6

I have read the article. With your help I was able to build the example but in the example a servlet is never used, instead the GetHelloWorldMessageCommand sets the values that are used in the view that it forwards to.
So I am missing a piece and being new at both servlets and Java I am probably missing things that are obvious to someone with more experience. I don't understand how frontman passes control to the servlets that will lookup data and store it in the bean.

I am trying to take an existing training servlet project and convert it to Frontman. Pseudo code below.

murach\servlet_jsp\ex_stats\ch14email
program flow if using Frontman...



The questions are for 3):

What is the call to be used in frontman to pass control to the servlet , redirect(?) forward(?) forwardToCommand(?)

Does the AddToEmailListServlet.java (and the other servlets) have to be in the commands package?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Why is that functionality in a servlet to begin with? If it's not going to be fielding request -- in Front man you have the commands that handle that -- why a servlet at all?
margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 318
    
    6


in Front man you have the commands that handle that -- why a servlet at all


That is what I'm trying to wrap my head around. Now that you say this I see that Frontman is built on javax.servlet.http.HttpServlet. That is what I missed before.

To confirm what I think you are saying -- the commands classes replace the servlets in the project . To finish the project conversion I would move the logic that was in the servlets into the command classes. The command classes would be in the commands package.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Pretty much -- just be careful not to fall into the trap of putting all the logic in commands. They are intended for control -- business process and the model should be in separate layers and classes.
margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 318
    
    6

business process and the model should be in separate layers and classes.


Yes, that is what I see in the teaching projects. There is a javabean class for the data model that holds getters/setters and there is a POJO class that holds the business logic for the data.

Thank you.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Frontman usage for newbie