You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinay Nagrik <vn...@gmail.com> on 2008/04/29 02:32:39 UTC

Removing package name all over does not work

Hello Group,

I am working with the preliminary HelloWorld.java example and removed the
very first line in HelloWorld.java

i.e I commented out

package tutorial;

Thereafter I modified the struts.xml file and it looks like


<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
    <package name="" extends="struts-default">
        <action name="HelloWorld" class="HelloWorld">
            <result>/HelloWorld.jsp</result>
        </action>
        <!-- Add your actions here -->
    </package></struts>

What does the name in

<package name="" extends="struts-default">

mean?

I compiled my HelloWorld.java and put the HelloWorld.class in the
WEB-INF/classes directory.

Then I tried deploying it through

localhost:8080/HelloWorld.action

It gives errors as

"The requested resoruce (/HelloWorld.action) is not available.

However, if I put the package name back in all those places and run it like

localhost:8080/tutorial/HelloWorld.action



Then it works perfectly.



For compiling I am always using



javac -d <classpath> <javafile>

Can someone please tell me what happens why does it not work if I take away
the package name from all the places.
-- 
Thanks

Nagrik

Re: Removing package name all over does not work

Posted by Vinay Nagrik <vn...@gmail.com>.
Thanks for the replies and info.

nagrik


On 4/28/08, Wes Wannemacher <we...@wantii.com> wrote:
>
> Vinay,
>
> You are talking about two different things... First off, in the java
> source file, the statement 'package tutorial;' relates to the following
>
> http://java.sun.com/docs/books/tutorial/java/package/packages.html
>
> In struts2, the package declaration is a way to logically organize your
> actions. It is documented here -
>
> http://struts.apache.org/2.x/docs/package-configuration.html
>
> -Wes
>
> On Mon, 2008-04-28 at 17:32 -0700, Vinay Nagrik wrote:
> > Hello Group,
> >
> > I am working with the preliminary HelloWorld.java example and removed
> the
> > very first line in HelloWorld.java
> >
> > i.e I commented out
> >
> > package tutorial;
> >
> > Thereafter I modified the struts.xml file and it looks like
> >
> >
> > <!DOCTYPE struts PUBLIC
> >     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> >     "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
> >     <package name="" extends="struts-default">
> >         <action name="HelloWorld" class="HelloWorld">
> >             <result>/HelloWorld.jsp</result>
> >         </action>
> >         <!-- Add your actions here -->
> >     </package></struts>
> >
> > What does the name in
> >
> > <package name="" extends="struts-default">
> >
> > mean?
> >
> > I compiled my HelloWorld.java and put the HelloWorld.class in the
> > WEB-INF/classes directory.
> >
> > Then I tried deploying it through
> >
> > localhost:8080/HelloWorld.action
> >
> > It gives errors as
> >
> > "The requested resoruce (/HelloWorld.action) is not available.
> >
> > However, if I put the package name back in all those places and run it
> like
> >
> > localhost:8080/tutorial/HelloWorld.action
> >
> >
> >
> > Then it works perfectly.
> >
> >
> >
> > For compiling I am always using
> >
> >
> >
> > javac -d <classpath> <javafile>
> >
> > Can someone please tell me what happens why does it not work if I take
> away
> > the package name from all the places.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Thanks

Nagrik

Re: Removing package name all over does not work

Posted by Wes Wannemacher <we...@wantii.com>.
Vinay, 

You are talking about two different things... First off, in the java
source file, the statement 'package tutorial;' relates to the following 

http://java.sun.com/docs/books/tutorial/java/package/packages.html

In struts2, the package declaration is a way to logically organize your
actions. It is documented here -

http://struts.apache.org/2.x/docs/package-configuration.html

-Wes
 
On Mon, 2008-04-28 at 17:32 -0700, Vinay Nagrik wrote:
> Hello Group,
> 
> I am working with the preliminary HelloWorld.java example and removed the
> very first line in HelloWorld.java
> 
> i.e I commented out
> 
> package tutorial;
> 
> Thereafter I modified the struts.xml file and it looks like
> 
> 
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
>     <package name="" extends="struts-default">
>         <action name="HelloWorld" class="HelloWorld">
>             <result>/HelloWorld.jsp</result>
>         </action>
>         <!-- Add your actions here -->
>     </package></struts>
> 
> What does the name in
> 
> <package name="" extends="struts-default">
> 
> mean?
> 
> I compiled my HelloWorld.java and put the HelloWorld.class in the
> WEB-INF/classes directory.
> 
> Then I tried deploying it through
> 
> localhost:8080/HelloWorld.action
> 
> It gives errors as
> 
> "The requested resoruce (/HelloWorld.action) is not available.
> 
> However, if I put the package name back in all those places and run it like
> 
> localhost:8080/tutorial/HelloWorld.action
> 
> 
> 
> Then it works perfectly.
> 
> 
> 
> For compiling I am always using
> 
> 
> 
> javac -d <classpath> <javafile>
> 
> Can someone please tell me what happens why does it not work if I take away
> the package name from all the places.


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


Re: Removing package name all over does not work

Posted by Dave Newton <ne...@yahoo.com>.
Is the Java class being deployed to the proper location? If you just deleted
the package statement w/o moving the file to the appropriate directory you
might run into problems.

Do you have debugging turned up and/or struts.devMode turned on?

Dave

--- Vinay Nagrik <vn...@gmail.com> wrote:
> I am working with the preliminary HelloWorld.java example and removed the
> very first line in HelloWorld.java
> 
> i.e I commented out
> 
> package tutorial;
> 
> Thereafter I modified the struts.xml file and it looks like
> 
> 
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
>     <package name="" extends="struts-default">
>         <action name="HelloWorld" class="HelloWorld">
>             <result>/HelloWorld.jsp</result>
>         </action>
>         <!-- Add your actions here -->
>     </package></struts>
> 
> What does the name in
> 
> <package name="" extends="struts-default">
> 
> mean?
> 
> I compiled my HelloWorld.java and put the HelloWorld.class in the
> WEB-INF/classes directory.
> 
> Then I tried deploying it through
> 
> localhost:8080/HelloWorld.action
> 
> It gives errors as
> 
> "The requested resoruce (/HelloWorld.action) is not available.
> 
> However, if I put the package name back in all those places and run it like
> 
> localhost:8080/tutorial/HelloWorld.action
> 
> 
> 
> Then it works perfectly.
> 
> 
> 
> For compiling I am always using
> 
> 
> 
> javac -d <classpath> <javafile>
> 
> Can someone please tell me what happens why does it not work if I take away
> the package name from all the places.


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