You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by struts2 <sa...@yahoo.com> on 2007/03/25 06:01:08 UTC

Problem with struts 2

Hi everyone,

             I have just started working with struts 2. Quit improved and
much like Spring(except DI and AOP), this is first time i am working with
struts and in HelloWorld programmer i am facing error when my action class
is called and the error is : The requested resource
(/hello_world/example/HelloWorld.action) is not available.

I am putting up my files below, any idea would be appreciated.

web.xml


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

    <display-name>Struts example by Sachin</display-name>

    <filter>
        <filter-name>struts2</filter-name>
       
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>

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

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

</web-app>




struts.xml

 
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <package name="example" namespace="/example" extends="struts-default">
        <action name="HelloWorld" class="example.HelloWorld">
            <result>/jsp/HelloWorld.jsp</result>
        </action>
    </package>
</struts>



HelloWorld.java


package example;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {

    public static final String MESSAGE = "Struts is up and running ...";

    public String execute() throws Exception {
        setMessage(MESSAGE);
        return SUCCESS;
    }

    private String message;

    public void setMessage(String message){
        this.message = message;
    }

    public String getMessage() {
        return message;
    }
}


-- 
View this message in context: http://www.nabble.com/Problem-with-struts-2-tf3461208.html#a9657134
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with struts 2

Posted by struts2 <sa...@yahoo.com>.
Thanks guys for your replies, now the application is working. What i did is i
copy some code from the eaxmple application shipped with the API and modify
it according to my needs and voila it's working. Now even i don't know
what's wrong with the earlier version even if i compared boith and coudn't
find anything changed. lol.

-- 
View this message in context: http://www.nabble.com/Problem-with-struts-2-tf3461208.html#a9667426
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with struts 2

Posted by Martin Gainty <mg...@hotmail.com>.
yes I see it
Thx,
M-
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Dave Newton" <ne...@yahoo.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>; "Martin Gainty" <mg...@hotmail.com>
Sent: Sunday, March 25, 2007 3:27 PM
Subject: Re: Problem with struts 2


> --- Martin Gainty <mg...@hotmail.com> wrote:
>> Could we see the action from action-mappings
>> (specifically path/type/name/scope config) from
>> struts-config.xml ?
> 
> ???
> 
> They're in the OP, although it's S2, not S1.
> 
> d.
> 
> 
> 
> 
> ____________________________________________________________________________________
> Now that's room service!  Choose from over 150,000 hotels
> in 45,000 destinations on Yahoo! Travel to find your fit.
> http://farechase.yahoo.com/promo-generic-14795097
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

Re: Problem with struts 2

Posted by Dave Newton <ne...@yahoo.com>.
--- Martin Gainty <mg...@hotmail.com> wrote:
> Could we see the action from action-mappings
> (specifically path/type/name/scope config) from
> struts-config.xml ?

???

They're in the OP, although it's S2, not S1.

d.



 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with struts 2

Posted by Martin Gainty <mg...@hotmail.com>.
Could we see the action from action-mappings (specifically path/type/name/scope config) from struts-config.xml ?
Thx,
M-
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Dave Newton" <ne...@yahoo.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Sunday, March 25, 2007 2:04 PM
Subject: Re: Problem with struts 2


> From: "struts2" <sa...@yahoo.com>
>> The requested resource
> (/hello_world/example/HelloWorld.action)
>> is not available.
> 
> I'd be suspicious of your deployment process; at first
> glance, at least, the configuration seems okay.
> 
> Are there any startup errors in the log files? Do you
> have devMode turned on? 
> 
> AFAICT S2 will run under Servlet 2.3 using the J4 jars
> (I was running under Weblogic 8.1SP5) so as the
> previous answer said, make sure you're using correct
> versions of everything.
> 
> d.
> 
> 
> 
> 
> ____________________________________________________________________________________
> Bored stiff? Loosen up... 
> Download and play hundreds of games for free on Yahoo! Games.
> http://games.yahoo.com/games/front
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

Re: Problem with struts 2

Posted by Dave Newton <ne...@yahoo.com>.
From: "struts2" <sa...@yahoo.com>
> The requested resource
(/hello_world/example/HelloWorld.action)
> is not available.

I'd be suspicious of your deployment process; at first
glance, at least, the configuration seems okay.

Are there any startup errors in the log files? Do you
have devMode turned on? 

AFAICT S2 will run under Servlet 2.3 using the J4 jars
(I was running under Weblogic 8.1SP5) so as the
previous answer said, make sure you're using correct
versions of everything.

d.



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with struts 2

Posted by Nuwan Chandrasoma <my...@gmail.com>.
hi,

I hope you are using a servlet container that support 2.4 spec., change your 
web.xml  .xsd to 2.4 one like below.

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4"
 xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

hope this would help you.

Thanks,

Nuwan.


----- Original Message ----- 
From: "struts2" <sa...@yahoo.com>
To: <us...@struts.apache.org>
Sent: Sunday, March 25, 2007 4:01 AM
Subject: Problem with struts 2


>
> Hi everyone,
>
>             I have just started working with struts 2. Quit improved and
> much like Spring(except DI and AOP), this is first time i am working with
> struts and in HelloWorld programmer i am facing error when my action class
> is called and the error is : The requested resource
> (/hello_world/example/HelloWorld.action) is not available.
>
> I am putting up my files below, any idea would be appreciated.
>
> web.xml
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>    <display-name>Struts example by Sachin</display-name>
>
>    <filter>
>        <filter-name>struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>    </filter>
>
>    <filter-mapping>
>        <filter-name>struts2</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>    <welcome-file-list>
>        <welcome-file>index.html</welcome-file>
>    </welcome-file-list>
>
> </web-app>
>
>
>
>
> struts.xml
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>    "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
>    <package name="example" namespace="/example" extends="struts-default">
>        <action name="HelloWorld" class="example.HelloWorld">
>            <result>/jsp/HelloWorld.jsp</result>
>        </action>
>    </package>
> </struts>
>
>
>
> HelloWorld.java
>
>
> package example;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloWorld extends ActionSupport {
>
>    public static final String MESSAGE = "Struts is up and running ...";
>
>    public String execute() throws Exception {
>        setMessage(MESSAGE);
>        return SUCCESS;
>    }
>
>    private String message;
>
>    public void setMessage(String message){
>        this.message = message;
>    }
>
>    public String getMessage() {
>        return message;
>    }
> }
>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Problem-with-struts-2-tf3461208.html#a9657134
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org