on 11-21-2005 6:06 PM
Hi folks,
I am diving into the wondefull world of struts - I found a very simple tutorial at http://wiki.apache.org/struts/StrutsMinimalInstall but I am getting a runtime error which I don't grasp when executing it on SAP WebAS 6.40 ...
If the web.xml would contain
<servlet-mapping>
<servlet-name>ActionServlet</servlet-name>
<url-pattern>/*.do</url-pattern>
</servlet-mapping>
and my welcome.htlm file has a form with action="name.do"
then I would assume that this request goes through the ActionServlet which basically does
return uActionMapping.findForward("success")
using in the struts configuration file
<action
path="/name"
type="com.sedacrivity.struts.test.actions.NameAction"
input="/Welcome.jsp"
name="nameBean"
scope="request">
<forward name="success" path="/hello.jsp"/>
<forward name="failure" path="/error.jsp"/>
</action>
then why am I getting the following ?
http://localhost:50000/GMData/name.do?name=steven
"Requested resource does not exist ...." doh !
Am I missing something basic here ?
My archives compile allright and get deployed without any issue ...
Thanks,
Steven
Hi Steven
I think it is because your servlet mapping is incorrect.
Try changing it from
<url-pattern>/*.do</url-pattern>
to
<url-pattern>*.do</url-pattern>
.
Hope this helps,
Gareth.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steven,
I'm not a struts expert unfortunately, I've just been using the technology as part of a CRM ISA B2B & B2C implementation I've been working on...
But, my understanding is that the url pattern is simply a way to force any links in a page to be handled by the struts action controller. The ".do" is just a way of saying any links that end with .do should be parsed by the struts action servlet thing and then handled accordingly. I guess that you could change this to ".mickeyMouse" and as long as your links were updated they would still run through the struts processing. Think of it as an entry point into the config.xml file. You aren't actually setting up folders or anything so the slashes become irrelevant.
Hope this makes some sense!
Cheers,
Gareth.
I'm not sure, but
In your <action> tag, you say input="/Welcome.jsp".
Shouldn't this be welcome.html. Because that is the page you are coming from ?
regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.