aspose file tools*
The moose likes Struts and the fly likes action mapped error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "action mapped error" Watch "action mapped error" New topic
Author

action mapped error

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
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

Joined: Aug 03, 2008
Posts: 9321
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jan 08, 2010
Posts: 510
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jan 08, 2010
Posts: 510
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

Joined: Sep 29, 2008
Posts: 12617

TellTheDetails.

What URL are you using? Is anything in the log? Where's the JSP located?
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
here is url which i used
http://localhost:8080/My/aruna.action

aruna.jsp is in WEB-INF directory.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jan 08, 2010
Posts: 510
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jan 08, 2010
Posts: 510
i type this tooo
http://localhost:8080/My/abc/aruna.action



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The configuration file you posted has the JSP at the top level.
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
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

Joined: Sep 29, 2008
Posts: 12617

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
 
subject: action mapped error