jQuery in Action, 2nd edition*
The moose likes Other Application Frameworks and the fly likes FrontMan Commands ? 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 Commands ?" Watch "FrontMan Commands ?" New topic
Author

FrontMan Commands ?

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Is it possible to add multiple commandsPath to the descriptor?

i want to seperate my commands into different packages for different modules of my program
It make it easier to keep track of my classes

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61305
    
  66

I've added this ability to Front Man 2 as I've found that I've needed it myself.

I'll be looking for beta testers soon. Interested?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Yes very much so. This is soo much easier to maintain than adding all the mappings to the descriptor.

I am refactoring my admin project using this right now and hope to refactor an ecommerce site using this same structure.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61305
    
  66

OK, cool. Watch for a notice in the BA forum. I just need to find some time to finish the documentation and it'll be ready for testing.
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
I have another question about the descriptor with fromtman
for the welcome-file-list in the passed i have entered my mapped servlet name so it goes to that servlet when you got to
www.mysite.com

this still works fine <welcome-file>jsp/index.jsp</welcome-file>

but if i were to do <welcome-file>dispVendors</welcome-file> it doesnt work.

what would be the correct format using frontman?

below is the current web.xml i am using

thanks
john


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61305
    
  66

If dispVendors is a command, the URL will need the /command prefix.
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Ok the following works but when the page displays all my images arent showing up



this is my directory hiearchy


in my jsp i have it go up one folder to images

../images/bolt.gif

using http://127.0.0.1:8080/NID/command/testCommand and everything displays fine

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
ok if i remove ../ before all the images in the jsp file they display.

Im just not understanding why that is.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61305
    
  66

Page-relative references are death in web applications. Use server-relative references that begin with the context path.

Think about it for a minute: the browser is trying to find the image file in the file system relative to the current URL. That's fine in a static site where the URLs represent folders. But in a web app, the URLs are mapped and have nothing whatsoever to do with the file system.

By removing the .. you got it to accidentally work. Don't depend upon that. Use server-relative addresses as outlined in this JSP FAQ.
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
thanks worked like a charm. also answered alot of questions i never took the time to learn.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61305
    
  66

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Do you find yourself mixing the command classes with regular servlet classes?

like just using the command classes for url links and POST, and to use regular servlets for lets say displaying the page after the post?

Trying to figure out the neatest way to structure my new program.


**In addition is there a way to implement a filter and not to have to map all the pages in the web.xml using fromtman?

 
GeeCON Prague 2014
 
subject: FrontMan Commands ?