| Author |
Struts url problem
|
Tauri Valor
Ranch Hand
Joined: Aug 03, 2005
Posts: 166
|
|
Hi I have the following problem with url in my web application: I run my app using Struts2 and Tomcat6. Context name of webapp: MY_WEB Namespace in my package tag of struts-config.xml: package name="registration" namespace="/register" extends="tiles-default" Mapping of Action class in my struts-config.xml : action name= acc.register.RegistrationForm A Href link in my jsp page: a href="register/acc.register.RegistrationForm.do" Now, the following url works fine when I launch my app: http://localhost:8080/CG_WEB/register/acc.register.RegistrationForm.do But the problem is the url when added something between my packagename(register)and my uri (acc.register.RegistrationForm.do) like following: http://localhost:8080/CG_WEB/register/somecrap/acc.register.RegistrationForm.do it still works fine instead of displaying the error page. Pls advise.
|
A Moment's insight is sometimes worth a Life's experience.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8265
|
|
Please do not post the same question more than once. It causes confusion and duplication of effort as the community tries to help everyone. If you have new or additional information to add to your original post, either edit it or post in the same topic.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Tauri Valor
Ranch Hand
Joined: Aug 03, 2005
Posts: 166
|
|
Joe, Sorry for duplictates but I thought the post should be more detailed as I got no replies . Thanks, Tauri.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8265
|
|
It's not a big deal. We just try to keep the saloon looking clean. I tested your issue on my Struts 2 app and I see the same behavior. My wild guess is that the culprit is the filter-mapping in the web-xml. If you want to limit the context you'd probably have to narrow down the url-pattern to something more specific than the default of "/*", which I'd interpret to be "if theres an action at the end of the URL, forward to it".
|
 |
Tauri Valor
Ranch Hand
Joined: Aug 03, 2005
Posts: 166
|
|
If you want to limit the context you'd probably have to narrow down the url-pattern to something more specific than the default of "/*", which I'd interpret to be "if theres an action at the end of the URL, forward to it".
Thats little complex for me, can you simplify - what do you mean by forwading an action at the end of URL ?
|
 |
Tauri Valor
Ranch Hand
Joined: Aug 03, 2005
Posts: 166
|
|
I understood that its the design flaw of the default Action Mapper When there's no match in a package namespace it falls back to the default package and matches a little to generously. Ive tried creating a package with empty name space in struts-config.xml : <package name="register" namespace="/" extends="tiles-default"> then the following url : http://localhost:8080/MY_WEB/acc.register.RegistrationForm.do without the namespace works fine .. But any other way to keep my namespace in tact in the url because the above may not be acceptable? Thanks, Tauri
|
 |
 |
|
|
subject: Struts url problem
|
|
|