• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stripes - ActionResolver.Packages

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to set in web.xml the root of the classpath? I mean how should i write if i have ActionBeans in the defaultPackage?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be a strong indication not to use the default package...
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frederic Daoud
author
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the way I have been treating my welcome file looks perfect.
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm talking about about architecture, not about the url binding...
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic