aspose file tools*
The moose likes Struts and the fly likes perplexed by package structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "perplexed by package structure" Watch "perplexed by package structure" New topic
Author

perplexed by package structure

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Hello:

I have a Struts 2 question. I took over an application built with Struts 2. The original developer is unavailable. He has divided up the application's actions into packages by role:




I'm not a Struts 2 expert but my understanding of packages is that the package name is reflected in a URL . . . so /appName/adminPackage/logout.action would map to the correct "logout" action (There is a "logout" action in every package). However, in this application the package names are not part of URLs and I am wondering how the application knows which "logout" action to call. Is there an alternative way to use package names? What should I be looking for? Thanks

Eric
Harsha Ka
Ranch Hand

Joined: Mar 14, 2010
Posts: 45

Hi Eric,

Its the namespace which is part of the URL and not the package name.

If your struts.xml had the below package declaration then you would have the namespace as a part of the URL.


SCJP 1.6,Preparing (Tryin to prepare) for scwcd
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

Harsha is correct to look for namespace. From the packages you posted it is very likely that the developer created packages which contain common actions. So somewhere there is probably a package with the namespace you seek which then extends the userPackage or adminPackage etc ...

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Thanks for the replies. There are no namespaces declared anywhere. It turns out that the programmer did a very poor job with authorization. Any user can successfully enter any of the URLs, if they know one. There is no filtering taking place with respect to the URLs.

Thanks!
 
 
subject: perplexed by package structure