Jean-Baptiste Nizet said:
Oh come on! Sorry, but you need to read more on MVC in the context of
web apps. An application that doesn't use HTML correctly, tries to
Oh, yes, I need to do that. I've written over a dozen of these apps,
and read much on it. I hold my knowledge up against any standard you
like on this matter.
Just because I disagree with you doesn't mean that I'm ill read.
simulate hyperlinks with buttons, and makes your webapp look like a
Swing app IS what can be called as a bad web application. Hyperlinks are
"can be called" - sure, you can call anything anything. But it isn't
a bad web application, because using POST instead of links has
advantages, specific to web apps.
And you guys keep talking about "having a desktop [or Swing]
mentality" like that is some sort of criticism. How is that a bad
thing, and how is what I'm doing that?
And even more important, just what do you mean by "a desktop
'mentality'"?
The web has its rules and idioms, and web design is not the same as
rich application design. Webapps are usually more open, indexable,
bookmarkable, linkable. If you do everything with POSTs, good luck
with that. And go explain your customer that your webapp apears at the
56784th position when doing a Google search, because Google is not
able to index your web app and nobody links to it.
HTTP is a standard as well, and GETs are supposed to be used for
requests that don't modify the server state (navigate to a page,
consult items in a repository, search, etc.). POSTs are supposed to be
used to modify state, and not for everything else. You choose not to
respect the standard and that's your right, but it's also the sign of
bad design (as IE has always be considered as a bad browser by techies
because it doesn't respect the HTML and CSS standards, which doesn't
mean it doesn't work or do something useful).
Not for internal links, no they are not.
Maybe you should teach Google, Ebay, Amazon, Slashdot, Yahoo and so on
how to design webapps, because I see many many hyperlinks in their
apps. And they're pretty successful.
Not if you want to restrict those URLs, and control the application
experience. Doing those things can be undesirable.
It can be undesirable. Most of the time, it IS desirable. That's what
users expect from web apps. Would you like it if Ebay, Google or Yahoo
didn't let you open several tabs in their webapp?
There's that "mentality" word. How about defining what you mean by
that?
POSTs, as are commonly done internally in good web apps instead of
hyperlinks, allow the tramsmission of data also. They avoid a round-
trip to the browser to forward to the next page, on account of
forwards are server side, unlike links.
How would a GET need additional round-trip to the server just to go to
another internal page or search through a repository? How are your
users supposed to refresh a page or use their back button when using
your POST-only webapp. Oh, they are not supposed to do that? So your
webapp doesn't work well with the most-used browser buttons? That's
what I call a bad webapp.
The POST technique allows
precise control of application state, and keeps the user from entering
screens for which the preconditions have not been met.
How so? A POST carries information to the server just as a GET does
it: through request parameters. They're just not visible in the
address bar. Except for transmitting a large amount of information,
what can be done by a POST that can't be done by a GET? If you rely on
the fact that POSTs are used to be sure that preconditions are met,
then you have a problem. Preconditions must be verified by your server-
side code. HTTP is stateless, and a POST request is not more difficult
to do than a GET for any script kiddie. Whether your action is being
called through a GET or through a POST, you have to check your
preconditions, because a good webapp *always* checks what comes from
the browser.
There is
nothing in that design approach that precludes links to well-defined
screens, but such links will always lack the sort of contextual
information for which the OP was asking (distinguish internal
navigation from external).
No. You may add a parameter to a hyperlink just as you add a parameter
to your POST request. Doing everything by POST just makes it much more
difficult to link to your webapp from the outside. That's what I call
"desktop application mentality". The web is about hyperlinks between
pages around the world. Your webapp will tend to be an insulated
island in the web, that nobody can link to. Just as if your
application was a desktop app.
JB.