File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Front Man Examples? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Front Man Examples?" Watch "Front Man Examples?" New topic
Author

Front Man Examples?

Mike Heffelfinger
Greenhorn

Joined: Jan 11, 2010
Posts: 13

I'm new to Java web programming and have been looking at some application frameworks. Two that look interesting to me are Stripes and Front Man, mostly due to their low overhead and simplicity. I'd really like to get something going with Front Man, but I need an example or two to get started ... does anyone have any?

Thanks, Mike.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Sure, what do you need an example of?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Heffelfinger
Greenhorn

Joined: Jan 11, 2010
Posts: 13

A simple app will do; one that uses a front controller, does a little processing and returns a view, and that includes a deployment descriptor.

Maybe a starting page with just a text field and submit button. The user types some text in the text field and clicks the submit button. The application handles the post and returns another view to the browser that displays: "This is the text you submitted: submittedText".

Alternatively, Ben Souther has an example (Simple Command) of a front controller type application that's a little more complicated than what I described previously, but I don't believe it uses Front Man. Something similar to that using Front Man would be nice.

Thanks, Mike.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Hmmm, interesting. I hadn't thought about including a sample skeleton application. That's a good idea.

Front Man 2.0 is in the works... maybe this is something I'll include.

In the meantime, any "spot" examples you need?
Mike Heffelfinger
Greenhorn

Joined: Jan 11, 2010
Posts: 13

Yes, a skeleton app would be nice. Right now I'm stuck, and any small example app would probably save me hours of trial and error. I'm coming from a mod_perl/Mason environment where I used a front controller pattern, but the differences between Perl/Mason and Java has me stumped.

I'm not sure I understand what you mean by "spot" application, but anything will do.

Mike
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Well, if its the whole Servlet/JSP environment that's unfamiliar to you, a few Front Man spot examples aren't going to be very enlightening, but for what it's worth:

Here's the servlet and mappings from one of my deployment descriptors:


and the skeleton of a Command implementation:


And that's about it for Front Man penetration. It takes care of the whole Front Controller thing. The rest is up to the Servlet and JSP environments (which is exactly Front Man's point -- don't try to re-invent the wheel like the big frameworks do).
Per Lindberg
Ranch Hand

Joined: Jan 17, 2008
Posts: 48
In the example above you do a servlet forward. How about the PRG (Post-Redirect-Get) pattern? Would that be as easy in FrontMan?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Absolutely. I'm a big fan of that pattern and use it often.

The example above is a page controller and forwards to its view.

Within a task controller, a statement such as the following would be used to redirect to the page controller of the next view:



in place of the forwardToView().
Per Lindberg
Ranch Hand

Joined: Jan 17, 2008
Posts: 48
Looks promising, Bear! A minimalistic skeleton webapp of "Hello World" flavour (showing PRG) would be most interesting, and will surely help sell Front Man.

Like you, I'm not enthusiastic about all these bloatware frameworks that just add more complexity and little else.
Mike Heffelfinger
Greenhorn

Joined: Jan 11, 2010
Posts: 13

I'd like to report that I've been using Front Man and it's working great. I'd post a link to my website which uses it, but it's a work in progress.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Cool! Nice to hear that its working out for you, Mike!
Scott Huffman
Greenhorn

Joined: May 14, 2010
Posts: 3
A long long time ago I wrote a few web apps using the original Struts Framework. I am now having to port a ruby on rails application to java because RoR is not approved by corporate. I want to go bare bones and love your solution however I have a couple questions to start with. 1. What is the status of FrontMan2? Is there a site for it yet? 2. How would you incorporate property files for populating rendered html with values from property files based on keys and selected locale? 3. How do you gracefully intercept a request that is missing a verb (http://domain/contextPath/command). 4. How would you route root domain request to a command?

Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

1. It's in beta. Care to give it a whirl?
2. Not sure what this has to do with FrontMan.
3. An exception will be thrown that you can handle in any manner that you like.
4. Configure it in the deployment descriptor like any other start URL.

For questions 2 through 4, the answer is that FrontMan doesn't get in the way of doing things the "normal" way. You don't have to do anything different just because you are using FrontMan.
Scott Huffman
Greenhorn

Joined: May 14, 2010
Posts: 3
I could give it a whirl. What changes/features do you have planned for the new version? Why did you set out to rewrite it?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Version 2 is not a rewrite, just an update. See: http://www.coderanch.com/t/489024/ba/Wanted-Front-Man-beta-testers
Mike Heffelfinger
Greenhorn

Joined: Jan 11, 2010
Posts: 13

Frontman is still working great for me. Here are two of my websites which use it:

Tech City Systems and NASA Review.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Too cool, Mike!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61207
    
  66

Too cool, Mike!
 
 
subject: Front Man Examples?