PLEASE HELP: Exception handling

2003-11-07 Thread Bard A. Evjen
Can anyone provide me with a complete example of using execption handling in
struts that supports a "nice" message to the user and the actual error
message (displayed on the jsp page)? (I'm using struts 1.1)

I think I've tried everything now (well, obviously not everything since it
is not working), so I would REALLY appreciate the help.

You can either point me to a page where I can download a complete example or
you can send it to me on bardevjen at operamail.com

Thanks a lot!

Regards,
Bard




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Running Multiple actions in one action

2003-10-29 Thread Bard A. Evjen
Forget it, I've solved it.

I added a new parameter in the Login action, and if this is set, it forwards
to the DirectURL action that identifies the action (report) the user wants
to run, does the search and displays the result.

Cheers,
Bard

"Bard A. Evjen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there another way of doing it?
>
> I have this in my struts-config:
>
>  type="com.om.condico.webclient.servlet.SearchAccountsAction"
> name="SearchAccountsForm"
> scope="request"
> validate="true"
> input="/account/index.jsp">
>  key="web.account.jsp.no.records"
> type="java.lang.NullPointerException"
> path="/account/result.jsp"/>
>  key="web.account.jsp.error"
> type="com.om.condico.util.exception.CondicoException"
> path="/account/result.jsp"/>
>  key="web.account.jsp.error"
> type="java.lang.Exception"
> path="/account/result.jsp"/>
> 
> 
>
> I've tried to add a new action:
>
>  type="com.om.condico.webclient.servlet.DirectURLAction">
> 
> 
>
> and call the link
>
http://localhost:8080/DirectURL.do?report=SearchAccounts&companyName=Company
> &accountName=*&reportDate=29/10/2003
>
> In the action for DirectURL I just identify the report to be run, and
> forward to /SearchAccounts. This works ok, but the problem is the logging
in
> and logging out again (that I also has as reparate actions in the
> struts-config-file).
>
> Cheers,
> Bard
>
>
> "Ed King" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Should be doable using filters, only problem with this solution is that
> > the filters will always run for every request being served.
> >
> > Bard A. Evjen wrote:
> >
> > >I need to be able to run a search just by typing in the address (and
> > >searchcriteria) in the URL, like:
> > >
> >
>
>http://localhost:8080/DirectURL.do?report=SearchAccounts&companyName=Compan
> y
> > >&accountName=*&reportDate=29/10/2003
> > >
> > >Before this search is run, I also want to log in the user and log him
out
> > >again after returning the result from the search.
> > >
> > >Does anyone have a solution for this?
> > >
> > >Cheers,
> > >Bard
> > >
> > >
> > >
> > >
> > >
> > >-
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Running Multiple actions in one action

2003-10-29 Thread Bard A. Evjen
Is there another way of doing it?

I have this in my struts-config:








I've tried to add a new action:





and call the link
http://localhost:8080/DirectURL.do?report=SearchAccounts&companyName=Company
&accountName=*&reportDate=29/10/2003

In the action for DirectURL I just identify the report to be run, and
forward to /SearchAccounts. This works ok, but the problem is the logging in
and logging out again (that I also has as reparate actions in the
struts-config-file).

Cheers,
Bard


"Ed King" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Should be doable using filters, only problem with this solution is that
> the filters will always run for every request being served.
>
> Bard A. Evjen wrote:
>
> >I need to be able to run a search just by typing in the address (and
> >searchcriteria) in the URL, like:
> >
>
>http://localhost:8080/DirectURL.do?report=SearchAccounts&companyName=Compan
y
> >&accountName=*&reportDate=29/10/2003
> >
> >Before this search is run, I also want to log in the user and log him out
> >again after returning the result from the search.
> >
> >Does anyone have a solution for this?
> >
> >Cheers,
> >Bard
> >
> >
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Exception handling - please help!

2003-10-29 Thread Bard A. Evjen
Ok, thanks, I'll give it my best shot.

Cheers,
Bard

"Mark Lowe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Its not the best way, but a reasonable and simple way of dealing with
> this stuff is to use a try/catch statement in you action servlet.
>
> try {
>
> //your code that does the search stuff
>
> bla bla
>
> return (mapping.findForward("success"));
>
> } catch (WhatEverExceptionYouWantToThrow e) {
>
> //print expeption to your applicantion log
>
> servlet.log("DOOH",e);
>
> return (mapping.findForward("failure"));
> }
>
> You'll have success and failure defined as forwards in your struts
> config, where you'll be able to choose teh jsp's you want to forward to.
>
> Cheers Mark
>
>
> On Wednesday, October 29, 2003, at 09:47 AM, Bard A. Evjen wrote:
>
> > Thanks for your reply, but public SearchTradesAction extends Action
> > throws
> > Exception does not work.
> >
> > My problem is that I am not really a java programmer and I have found
> > the
> > documentation on this subject to be somewhat "sucky?".
> >
> > Do I need to use an ActionExceptionHandler or is it another way of
> > doing it?
> > I would like to avoid the use of an error.jsp page as I rather display
> > the
> > result (from the search), but with no result and the error message.
> > How do I
> > fix this?
> >
> > Thanks a lot for any help!
> >
> > Cheers,
> > Bard
> >
> > "Pratik Patel" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> =?iso-8859-1?B?QuVyZCBBcnZlIEV2amVu ?= wrote:
> >>> Hi,
> >>>
> >>> I'm trying hard not to rip out hair from my scalp. I cannot get the
> > exception handling in struts to work. What am I doing wrong? Please
> > help me
> > before I go insane...
> >>
> >> You are actually handling the exception in your Action class. You have
> >> to pass the exception up the (method) stack if you want to use the
> >> Struts exception handler.
> >>
> >> The action's method signature should be something like this:
> >>
> >> public SearchTradesAction extends Action throws Exception
> >>
> >> and you must remove the "catch" statements in the Action.
> >>
> >> Also, you will likely need a custom exception handler to populate
> >> ActionError messages.
> >>
> >> Have a look here for some tips for Exception handling with Struts:
> >>
> >> http://www.jroller.com/page/prpatel/20031023
> >>
> >> cheers
> >> Pratik
> >
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Running Multiple actions in one action

2003-10-29 Thread Bard A. Evjen
I need to be able to run a search just by typing in the address (and
searchcriteria) in the URL, like:

http://localhost:8080/DirectURL.do?report=SearchAccounts&companyName=Company
&accountName=*&reportDate=29/10/2003

Before this search is run, I also want to log in the user and log him out
again after returning the result from the search.

Does anyone have a solution for this?

Cheers,
Bard





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Exception handling - please help!

2003-10-29 Thread Bard A. Evjen
Thanks for your reply, but public SearchTradesAction extends Action throws
Exception does not work.

My problem is that I am not really a java programmer and I have found the
documentation on this subject to be somewhat "sucky?".

Do I need to use an ActionExceptionHandler or is it another way of doing it?
I would like to avoid the use of an error.jsp page as I rather display the
result (from the search), but with no result and the error message. How do I
fix this?

Thanks a lot for any help!

Cheers,
Bard

"Pratik Patel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> =?iso-8859-1?B?QuVyZCBBcnZlIEV2amVu ?= wrote:
> > Hi,
> >
> > I'm trying hard not to rip out hair from my scalp. I cannot get the
exception handling in struts to work. What am I doing wrong? Please help me
before I go insane...
>
> You are actually handling the exception in your Action class. You have
> to pass the exception up the (method) stack if you want to use the
> Struts exception handler.
>
> The action's method signature should be something like this:
>
> public SearchTradesAction extends Action throws Exception
>
> and you must remove the "catch" statements in the Action.
>
> Also, you will likely need a custom exception handler to populate
> ActionError messages.
>
> Have a look here for some tips for Exception handling with Struts:
>
> http://www.jroller.com/page/prpatel/20031023
>
> cheers
> Pratik




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How can I get a value and a name that is different on a html:options collection?

2003-07-28 Thread Bard A. Evjen
Thank you very much! I really appreciate your help!

Cheers, Bård A.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How can I get a value and a name that is different on a html:options collection?

2003-07-25 Thread Bard A. Evjen
I have a Form class:

public Collection getMyMonthList() {
 myMonthList = new Vector();
 Calendar cal = Calendar.getInstance();
 cal.setTime(new Date(01012003));
 for (int i = 1; i < 13; i++) {
   String label = monthListFormat.format(zeroTime(cal.getTime(), 
Calendar.MONTH, i));
   LabelValueBean labelBean = new LabelValueBean("i", label);
   myMonthList.add(labelBean);
 }
 return myMonthList;
}

and a jsp-file with:


 

But this returns

LabelValueBean[i,February]
LabelValueBean[i,March]
LabelValueBean[i,April]
LabelValueBean[i,May]
LabelValueBean[i,June]
LabelValueBean[i,July]
LabelValueBean[i,August]
LabelValueBean[i,September]
LabelValueBean[i,October]
LabelValueBean[i,November]
LabelValueBean[i,Desember]
LabelValueBean[i,January]
I want to display the name (eg. january) and the value in the option tag 
(eg. 1).

What have I done wrong?

Cheers,
Bard A.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Problems with logic:iterate (indexId has no effect)

2003-07-07 Thread Bard A. Evjen
Hi,

I have a vector called variationmargins and in it I have a property called 
loadProfile that is either 1 or 2 for all postings. I have tried to use the 
logic:iterate tag to output the result using the loadProfile as an index, 
but it has not effect. It just outputs everything, no matter the indexId. 
Does anyone have a clue what I am doing wrong?










Thanks,
Bard A. Evjen
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]