aspose file tools*
The moose likes Struts and the fly likes prepare() question for struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "prepare() question for struts 2" Watch "prepare() question for struts 2" New topic
Author

prepare() question for struts 2

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
If I have an action class

class A implements Preparable {

prepare() {
// do some work
}
.....
}

class B extends A {
...

public void anAction() {
...
}
}


In my struts.xml, I map a path to a method "anAction" in class B. Quesions are ---

1. when the path link is invoked, does JVM automatically create an instance class B ? does it also create an instance of class A ?

2. when the path link is invoked, will prepare() method in class A be executed first before the "anAction" method in class B is executed ?

I tried but it did not give me consistent results, strange.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

1) This is a basic Java question and is trivial to figure out on your own.

2) If class B extends class A, does class B implement Preparable?

If you're seeing inconsistent results then something is wrong, either in your configuration, deployment, program flow, etc.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:1) This is a basic Java question and is trivial to figure out on your own.

2) If class B extends class A, does class B implement Preparable?

If you're seeing inconsistent results then something is wrong, either in your configuration, deployment, program flow, etc.


People are coming here to ask for help. People may have very different level of java knowledge/experience, some are experts and some are novice. If you don't want to answer, why not save yourself some time ? I don't see any point of acting in a cocky way...
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:1) This is a basic Java question and is trivial to figure out on your own.

2) If class B extends class A, does class B implement Preparable?

If you're seeing inconsistent results then something is wrong, either in your configuration, deployment, program flow, etc.


The rule for javaranch is "be nice", not "be cocky". Don't assume you have more priviledge to treat others' question rudly just because you wrote few "books", that's funny.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Beginner Java questions should be asked here:

http://www.coderanch.com/forums/f-33/Java-General-beginner

There is nothing rude about (a) pointing that out, or (b) believing that a few other JavaRanch guidelines, like Show Some Effort and Search First exist for a reason.

That aside, I *did* answer the Struts-portion of your question by telling you that something else is wrong besides your class definition(s).

I don't think I'm more "privileged" than *anybody*. I spend a *lot* of my time helping people. At the same time, I also believe that people should ask forum-appropriate questions, and spend even the smallest amount of time trying to answer their own questions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: prepare() question for struts 2