This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action mapped error

 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my web.xml


here is my struts.xml


here is my Struts2HelloWorld.java file


here is HelloWorld.jsp


if i type
http://localhost:8080/My/abc/Struts2HelloWorld.action it works.

but if i change HelloWorld.java Greater than mark(>) to Less Than(<) it is not working


here is error


 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem basically is that your ERROR result is not working. Since you have a relative path in your struts configuration (<result name="error">error.jsp</result>) so Struts is looking for error.jsp in abc folder at the root of your application. If error.jsp is at the root of your application (i.e. accessible via the URL http://localhost:8080/My/error.jsp), then you should change the configuration to an absolute URL like
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The namespace of your package, thus the action is "/abc".

Pay attention. Did you read any of the Struts 2 documentation? It talks about all of this. Read it.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.i look some examples.
http://www.jarvana.com/jarvana/view/org/apache/struts/struts2-assembly/2.0.14/struts2-assembly-2.0.14-all.zip!/struts-2.0.14/docs/docs/namespace-configuration.html

i change my struts.xml file


here is my Hello.html


when i run hellow.html file it gives this error


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your "showLogin" action is in a package that does not extend the struts-default package.

*Please* take care when reading your configuration files (and indent them properly). Right now you're just typing in random things hoping it will work.

Take a step back. Start small. Get that to work, then try to add functionality.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
i did simple one and it works.
here my struts.xml


here my Struts2HelloWorld.java file


when i type this it is working
http://localhost:8080/My/abc/Struts2HelloWorld.action

but still i can't run action name aruna.
can you tell me how to run action name aruna.other both actions are working.i tried many times.
but still action aruna not working?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TellTheDetails.

What URL are you using? Is anything in the log? Where's the JSP located?
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is url which i used
http://localhost:8080/My/aruna.action

aruna.jsp is in WEB-INF directory.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "aruna" action is in the package with the "/abc" namespace, just like the other action.

If the JSP is in the WEB-INF directory you need to specify that in the result.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry ,sory.
aruna action is in WebContent folder, not in WEB-INF.

i tried this
http://localhost:8080/My/WebContent/aruna.action
it gives me error


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're just typing randomly again.

You need to slow yourself down and start *thinking* about what you're doing, what I'm saying, what the documentation says, how you've configured your application.

David Newton wrote:The "aruna" action is in the package with the "/abc" namespace, just like the other action.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i type this tooo
http://localhost:8080/My/abc/aruna.action



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The configuration file you posted has the JSP at the top level.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.ok thanks.
now it is ok
anyway if you know please let me a Struts Reference
it is better step by step practical one other than all theory one.
Now i am using Manning in Action book and http://www.coreservlets.com/ site.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 2 in Action is a perfectly fine book; it's not just "theory". My book is okay, but the second half of the book isn't Struts 2-specific. Budi's book is pretty good. Both the S2iA and Budi's book are Struts 2.0, mine is Struts 2.1. The Struts 2 documentation wiki covers most everything, and is *entirely* practical, but only small parts of it are tutorial in nature:

http://struts.apache.org/2.1.8.1/docs/tutorials.html
http://struts.apache.org/2.1.8.1/docs/guides.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic