Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frontman usage for newbie

 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic