The thing to remember here is that unlike the constructor, prepare() won't
run on its own outside of a Struts context. So if you are writing unit
tests of your various execute() type methods, be aware that you will need to
run prepare() manually within the unit tests (or as part of setUp() or
what
Sheesh, that works like a dream, thanks ...
Can't think how I missed that bit in the book.
Preparable, marvelous.
lyallex
On Wed, Jul 9, 2008 at 5:04 PM, Jim Kiley <[EMAIL PROTECTED]> wrote:
> I think in this situation I would have SomeAction implement Preparable, and
> put someComponent's init
I think in this situation I would have SomeAction implement Preparable, and
put someComponent's initialization into the prepare() method, if I could get
away with it. I realize that might not be possible in your situation, but
not knowing more details it's my first suggestion.
jk
On Wed, Jul 9,
To do have a similar behavior I have extended ServletDispatcherResult
and overridden doExecute(...)-
@Override
public void doExecute(String finalLocation, ActionInvocation
invocation) throws Exception {
try {
// some operation
} catch (Exception e) {
su
It doesn´t works, the Result is executed after the Interceptors
On 8/7/07, Thorsten Schäfer <[EMAIL PROTECTED]> wrote:
>
> > I need to do something like:
> >
> > public void execute(ActionInvocation invocation) throws
> > Exception {
> > try {
> >// Some operations
> >
> I need to do something like:
>
> public void execute(ActionInvocation invocation) throws
> Exception {
> try {
>// Some operations
> } catch (Exception e) {
>//Send user to a error page
> }
> }
>
> Any idea?
You could write an intercepto
Thanks for reply Vinod, but my class is a Result not a action.
public class CustomResult implements Result {
public void execute(ActionInvocation invocation) throws Exception {
try {
// Some operations
} catch (Exception e) {
//Send user to a error page
Do something like below-
path_to_error.jsp
public void execute(ActionInvocation invocation) throws Exception {
try {
// Some operations
} catch (Exception e) {
//Send user to a error page
return "error";
}
}
Vinod
Here you go:
http://struts.apache.org//struts-doc-1.2.7/userGuide/building_controller.html#exception_handler
As you describe, I think you'll very much like the global exception
handling mechanism.
Frank
bib_lucene bib wrote:
Hi All
In my struts based web application how do I handle ex
9 matches
Mail list logo