File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Why .action not show up in URLs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Why .action not show up in URLs" Watch "Why .action not show up in URLs" New topic

Why .action not show up in URLs

James Lee
Ranch Hand

Joined: Oct 16, 2006
Posts: 36
Hi everyone,

Each request is sent to an action which processes the request and then redirected to a JSP result page based on the execution of the action class. So the <action name>.action should be in the URL when we browse a web site built in struts. My question is why the <action name>.action is not in the browser's URLs.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33113

If I understand correctly, "<action name>.action" is a JSP.

JSPs don't show up in the web browser history in Struts because they are results of a forward. In the browser's mind, it simply doesn't exist. Consider the steps involved in a forward:
- browser requests URL
- action processes
- struts forwards to JSP
- JSP is output
- browser receives output of JSP

Since the browser only received one thing, it thinks the output of the JSP is the output of the URL it requested. The browser doesn't know something else happened in between.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Why .action not show up in URLs
It's not a secret anymore!