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 Open Source Projects and the fly likes Bear's Frontman help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Bear Watch "Bear New topic
Author

Bear's Frontman help

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Two questions:

1) do frontman questions go here or in frameworks? or someplace else?

2) I'm not groking how viewsPath works, or defaults. Or perhaps redirectToView. I've got a code fragment that looks like:



and in the ~/sandbox/bbook/fnfapp/web/WEB-INF/pages is a file named index.html




So I would not expect that file not found, its there, loosely protected, etc.

Thanks
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Pat Farrell wrote:Two questions:

1) do frontman questions go here or in frameworks? or someplace else?



I think either forum is OK, although Bear might have a stronger view on that.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

I've debugged some, and the code in
findCommandClass's String findViewPath(String viewName)

function is returning a null.

It looks in
/WEB-INF/pages/a.jsp
with is the right location (assuming the context or application path is prepended before it,
as there is a file a.jsp in the directory.

When it dispatches, the browser's URL bar shows

http://localhost:10005/fnfapp/WEB-INF/pages/a.jsp

Which is weird, I'm not used to seeing WEB-INF visible.


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Pat Farrell wrote:1) do frontman questions go here or in frameworks? or someplace else?

I'm used to just getting them in email. But here is fine with me.

2) I'm not groking how viewsPath works, or defaults. Or perhaps redirectToView. I've got a code fragment that looks like:

viewsPath set the relative base for specifying views. FrontMan assumes that a 'view' is a JSP, and the file type is implied. A static HTML file is just a static resource.

So if you have a view JSP in "myviews/someview.jsp" relative to the viewPath, you'd specify: forwardToView("myviews/someview").

Pat Farrell wrote:It looks in /WEB-INF/pages/a.jsp ... Which is weird, I'm not used to seeing WEB-INF visible.


Placing views that are to be the targets of a forward under WEB-INF is common in order to prevent them from being directly addressed via URL. Any JSP that will be the target of a redirect must obviously live elsewhere.

I've found it very rare to use redirectToView rather than forwardToView, but it's there because there are corner cases when it may be appropriate.

All that help?



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Bear Bibeault wrote:
I'm used to just getting them in email. But here is fine with me.


Oh, never thought of direct email, using forum so others can learn from my mistakes, etc.


FrontMan assumes that a 'view' is a JSP, and the file type is implied. A static HTML file is just a static resource.


Seems to implicitly out the '.jsp' extension on. I may have missed that in the docs, but early debugging found like as "a.jsp.jap" which gave me a clue.


Pat Farrell wrote:It looks in /WEB-INF/pages/a.jsp ... Which is weird, I'm not used to seeing WEB-INF visible.


Placing views that are to be the targets of a forward under WEB-INF is common in order to prevent them from being directly addressed via URL. Any JSP that will be the target of a redirect must obviously live elsewhere.


I've just never seen the ../WEB-INF/... in a browser's URL before.


I've found it very rare to use redirectToView rather than forwardToView
All that help?


At this point, forward to and redirect to are all the same to me. I'll try your suggestion of redirectToView....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Pat Farrell wrote:Oh, never thought of direct email, using forum so others can learn from my mistakes, etc.

I prefer the forum too for the same reason (even if I only know of a handful of people using FrontMan).

I've just never seen the ../WEB-INF/... in a browser's URL before.

That's because it won;t work. Containers are forbidden to directly serve files from under WEB-INF.

At this point, forward to and redirect to are all the same to me.

The difference is a very very important point. A redirect will issue a new request, while a forward simply transfers control of the same request to the next resource.

Forwarding from a page controller to its view is the common way to proceed.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

OK, changing that lets me make progress. Thanks.

Next question:

In the olden days, I did the jsp:setProperties name="*" to call the bean with all the field values from a POST'd form.
With Frontman, it seems that the perfered style is to post to a servlet.

Is there a parallel automagic way to get all the bean's setters to be called? If so, what is it.

Clearly I can do it manually in the servlet with something like

for (Enumeration e = theSession.getAttributeNames(); e.hasMoreElements();) {
}

(or some get query parameter equivalent)

But that seems old fashioned.

Thanks
 
wood burning stoves
 
subject: Bear's Frontman help