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 Application Frameworks and the fly likes Stripes - ActionResolver.Packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Stripes - ActionResolver.Packages" Watch "Stripes - ActionResolver.Packages" New topic
Author

Stripes - ActionResolver.Packages

Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
How to set in web.xml the root of the classpath? I mean how should i write if i have ActionBeans in the defaultPackage?


If you think you've done too much, usually it means you've done too few.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
This might be a strong indication not to use the default package...
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Ok, this is clear.

I can't handle the next situation....

when i request in browser url: http://localhost:8080/StripesTest/HelloWorld.action
i get the correct page!!!

when i request in browser url: http://localhost:8080/StripesTest
and put in welcome files list HelloWorld.action i get an error!!!

What's the point here? Ain't these two URL equal functionally?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
Ain't these two URL equal functionally?

"HelloWorld.action" is not a file, so it can't be used as a welcome file.
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Ulf Dittmer wrote:
Ain't these two URL equal functionally?

"HelloWorld.action" is not a file, so it can't be used as a welcome file.


Then how can we set a default action as welcome, not a jsp file. The idea is that everything goes thru dispatcher servlet, so it's a bad idea to acces a .jsp file directly for the home page(usually we need to collect some data for home page for instance). In a simple servlet based app we can set an url-servlet-mapping as default file, even it's not a file as well.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I haven't used Stripes (yet...) - but for other web application frameworks what I've done is write a html page that redirects to my "real" start page that is rendered through the framework, or make the page HTML only with links/actions pointing to URLs mapped to actions/controllers within the framework.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Maybe, anybody knows how is it in Stripes? Can't believe that nobody knows....

It's a variant Nathan, but only if there is no other "correct" way to do it.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Vadim Vararu wrote:Maybe, anybody knows how is it in Stripes? Can't believe that nobody knows....

It's a variant Nathan, but only if there is no other "correct" way to do it.


Technically, what Nathan suggest is the correct way to do it. It is exactly what I do.


GenRocket - Experts at Building Test Data
Frederic Daoud
author
Ranch Hand

Joined: May 22, 2008
Posts: 71
Nathan Pruett wrote:I haven't used Stripes (yet...) - but for other web application frameworks what I've done is write a html page that redirects to my "real" start page that is rendered through the framework, or make the page HTML only with links/actions pointing to URLs mapped to actions/controllers within the framework.


+1

I find that this is the best way to go. A very simple index.html file with a meta tag that redirects to your initial URL. With index.html as your welcome file, it will work and it is very clear for others to follow.

You can get Hello.action as a welcome file to work, but you need an empty file with that name to "fool" the servlet container. Personally, I don't like this method, because it does not work with all servlet containers, and it is less clear what is going on. Others may come across the empty file and wonder what it is doing there - maybe even delete it, and your welcome page stops working.

Do yourself a favor and just use the simple index.html file that redirects to your initial URL. You can use this method with any web framework.

Frederic Daoud
Author, Stripes...and Java Web Development is Fun Again
Stripes book
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
So the way I have been treating my welcome file looks perfect.
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 413

Even I am using the same method in Stripes , I am using a simple index.html file that redirects to the initial Action URL. I don't think there is any other way to do this in Stripes.


Pawan Chopra
SCJP - DuMmIeS mInD
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
How do you think guys? Would it be a good idea to stock all "show" actions in a single ActionBean? I mean we'll have one bean (for instance Show.action) with many events, like: home, news. So, finally we'll have http://......./Show.action?home, or http://........./Show.action?news

I just woke up few minutes ago with this idea, to centralize all shows in a single place, so it'll be pretty cozy to work with it, knowing where everything is.

Your ideas?
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 413

I think you can do like this:

http://......./Show.action.showHome(), or http://......./Show.action.showNews()

Read this @HandlesEvent or @URLBinding

I hope it helps and you will find it a better way.
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
I'm talking about about architecture, not about the url binding...
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Do i have to set URL mapping of the Stripes dispatcher from *.action to something like * to use clean url binding like http://......./show/home ?
I tried to bind such king of url mapping (http://....../show/home) and it does not work. When i changed url binding to (http://.....show/home/action) it worked.
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 413

Vadim Vararu wrote:I'm talking about about architecture, not about the url binding...


I am sorry if I have misunderstood your question but as you said that you are thinking about placing all the shows in one place so I just suggested you that this is a way you can define different handlers and you can handle them based on events like news,music etc. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stripes - ActionResolver.Packages