• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bear's Frontman help

 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?


 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
We don't have time to be charming! Quick, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic