Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Frontman usage for newbie

 
Ranch Hand
Posts: 335
6
Tomcat Server Ubuntu Linux
  • 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

 
Marshal
Posts: 67287
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Tomcat Server Ubuntu Linux
  • 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
Marshal
Posts: 67287
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Tomcat Server Ubuntu Linux
  • 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
Marshal
Posts: 67287
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Tomcat Server Ubuntu Linux
  • 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.

 
Police line, do not cross. Well, this tiny ad can go through:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!