• 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

Errr: requested resource xxxx.action is not available

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, everybody. I try a simple Struts 2 app to start learning it. The error message 'The requested resource (/s2_asciimonitor/starttoshow.action) is not available' keeps showing up if url is 'http://localhost:8080/s2_asciimonitor/index.jsp' (in 2 ways, 1. jsp forward and s:action. none of them works). But if I put url as 'http://localhost:8080/s2_asciimonitor/starttoshow.action'. It works. I can't figure out where causes the error. Please help me. Thanks in advance. northcloud

Here is my code:
struts.xml (in '\WEB-INF\classes' after deploy)

-----------
web.xml

-------------------------------------
StartToShowAction.java

----------------------------------
showIt3.jsp

---------------
index.jsp
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chan,
When you fire a request any extension is required.
When your call goes to the struts.xml file it creates the url as
namespace/actionName.action
in your case it would be /starttoshow.action

So as per my knowledge your request is coming as /starttoshow and is not matching with /starttoshow.action
So put the .action extension, you can change the extension though.
 
Chan Yan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, yash wardhan. I did try to add .action in the jsp file. The index.jsp looks like this:

It didn't work and error message is following:



If I don't use index.jsp to redirect the page, .action itself works fine (using 'http://...../starttoshow.action'). I think the error maybe from redirect. If it is the case, what's the right way to redirect in a jsp file?
 
yash wardhan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this,
<s:action name="starttoshow.action"/>
 
Chan Yan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, yash wardhan. I fix it. Since I defined namespace="/" in struts.xml for action 'starttoshow' in <package tag, I need to indicate it in index.jsp also. (If no 'namespace' defined in struts.xml for the action, it doesn't need to use it in index.jsp) So, index.jsp should look like:


And 'executeResult="true"' is for display the result, otherwise an blank page will show up.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic