• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why my link have "//" instead of "/"

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry, I am really frustrated, in my HelloPage.jsp

I have ">Register Here

and in my struts.xml



when I start the app, Tomcat console gives me namespace "//Pay_Roll"

why the extra / I really don't get it, what did I do wrong?

Please help
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Please see just remove "/" from Pay_Roll.

Like : <package name="Pay_Roll" namespace="Pay_Roll/Action" extends="struts-default">


 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that before, no luck. thanks for reading my post
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi,

Then can you please check your web.xml


it might looks like this..

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Please make sure it.

 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for responding so quickly

here is what my web.xml looks like



Does that look correct? what should I change?
I thought because the link contain two "/" that's causing the HTTP 404 error
but even if I remove the extra "/" it still give me the Action not mapped to Register.action

I know that my struts.xml is in /WEB-INF/ and should be /WEB-INF/classes
but I can't figure out how I can change my build.xml so that when Ant builds War file to place struts.xml in the right directory.
The only thing I can think of to do is to redo the entire project since it's not a big project yet.

thanks again
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi

Why you write in your wel-come file with Package name it just shows simple like this

<welcome-file-list>
<welcome-file>/index.htm</welcome-file>
</welcome-file-list>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>

Remove /Pay_Roll

And for your 404 error

<error-page>
<error-code>404</error-code>
<location>/index.htm</location>
</error-page>


 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
really? but that's where the welcome file is located

if I remove "Pay_Roll" and just have

<welcome-file>/HelloPage.jsp<welcome-file>

well work?

sorry, haven't have time to try that since you reply so quickly

I never know the <error-page> tag
what does it do and where does it needs to be, my guess is web.xml

but I don't see how that solve the problem since Tomcat is having problem finding the action
that the request is asking

thanks

 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Forgot about your <welcome-file>/HelloPage.jsp<welcome-file> .

Just make one action "index" at your struts.xml like others action you have declared.

from this index action just include your /HelloPage.jsp on success result type like.

<welcome-file-list>
<welcome-file>/index.htm</welcome-file>
</welcome-file-list>


And if you still want to list your /HelloPage.jsp then put this jsp at your Webroot directory.



 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your struts.xml is in WEB-INF? That won't work unless you configure S2 to look for it there.

It'd be better if you fix your environment to work right.
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mr. Newton
but I am new to Struts 2
when you say S2 you mean Struts 2 right

I am guessing my struts.xml is the problem why I am getting HTTP 404 Action not mapped correctly

should I redo the project (which is not too bad because it's not huge)
or rewrite the build.xml so struts.xml will be in /WEB-INF/classes?

I am using Eclipse but it won't show the /WEB-INF/classes on the left side,
how do I fix my environment? can you give me some directions?
what are my best options?

thanks for reading my problem, I really appreciated

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using Eclipse put the struts.xml file in the src directory and it will deploy it to WEB-INF/classes.

If you're using Ant then copy it to the right spot in the war or when you deploy.

You can also configure Struts to look in a non-default location, but it's probably a better idea to keep it on the classpath.
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Newton

When you say Using Ant and copy it to the right directory in <war>

my guess is you do the copy operation inside the <war></war>
Here is the the <war> part in my build.xml


would I say insert a <copy> somewhere in <war></war> I am not quite exactly sure how that's done
can you give me a hint?

I try doing that in <classes></classes> but it didn't work, struts.xml still in /WEB-INF

is there any other tag beside <copy> that I can use in Ant? that will move struts.xml instead of copy it

I haven't have time to try the things you suggest yet but I will give it a shot soon, I will put struts.xml in src directory this time
if that doesn't work than I will also try leaving struts.xml in ${src.dir} so that way it ends up in /WEB-INF/classes

Thank you so much for your input, I really appreciated
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I follow Mr. Newton's suggestion and move the struts.xml in src folder
but it still not in the right directory, It's ok, I use <copy> before <war> to
relocate struts.xml into the /WEB-INF/classes directory.

so, than I am still having "//Pay_Roll" with the extra "/"

now I try to delete the extra "/" and it goes to the page I want
because my struts.xml is in the right place now

so I believe, maybe the problem is in my <welcome-file>
(not the web.xml, the entry in the <welcome-file> tag)
which is my HelloPage.jsp

I have



I think here is the problem with my <s:url> tag

can anyone tell me what I did wrong here?

thank you
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic