Re: Struts error handling

2006-03-17 Thread Niall Pemberton
Do you have html-el:errors message=true/ on your jsp? If so remove
the message=true and it should work.

Niall

On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
 I'm trying to convert a Struts app from version 1.1 to the latest
 production version, 1.2.8. The sticking point is reporting errors.

 ActionErrors is now deprecated, soon to disappear, so I've converted
 instances of ActionErrors to ActionMessages. The exception handling
 code looks like this (ex is the exception, request is the
 HttpServletRequest object):

ActionMessages errors = new ActionMessages();
String msg = ex.getMessage();
ActionMessage newError = new
 ActionMessage(error.generic.placeholder, ex.getMessage());
errors.add( ActionMessages.GLOBAL_MESSAGE, newError );
saveErrors( request, errors );
return mapping.findForward(SystemFailure);

 SystemFailure is a page with an html-el:errors/ tag in it.

 My web.xml includes a servlet tag defining the Struts ActionServlet
 and having this init-param tag:

init-param
  param-nameapplication/param-name
  param-valuefreqs/param-value
/init-param

 In the WEB-INF/classes is a file named freqs.properties. Its contents
 are:

 errors.header=BRSTRONG class=error
 errors.footer=/STRONG
 error.generic.placeholder={0}


 When I run this, I get this error:

 javax.servlet.jsp.JspException: Cannot find message resources under
 key org.apache.struts.action.MESSAGE

 It happens during processing of the html-el:errors/ tag. What did I
 do wrong?


 --
 Tim Slattery
 [EMAIL PROTECTED]




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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 Do you have html-el:errors message=true/ on your jsp? If 
 so remove the message=true and it should work.

Nope, just html-el:errors/. 

--
Tim Slattery
[EMAIL PROTECTED]


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



Re: Struts error handling

2006-03-17 Thread Niall Pemberton
Thats very strange because the error your getting is when it looks for
errors under the message key - which happens when message=true is
set - otherwise it should look under the error key. What happens if
you set html-el:errors message=false/?

Also are you sure there are no other html:errors/ or
html-el:errors/ tags on yor page that could be causing this?

Niall

On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
  Do you have html-el:errors message=true/ on your jsp? If
  so remove the message=true and it should work.

 Nope, just html-el:errors/.

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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 Thats very strange because the error your getting is when it 
 looks for errors under the message key - which happens when 
 message=true is set - otherwise it should look under the 
 error key. What happens if you set html-el:errors 
 message=false/?
 
 Also are you sure there are no other html:errors/ or 
 html-el:errors/ tags on yor page that could be causing this?

The errors tag doesn't have a message attribute. I tried this:

html-el:messages message=false id=msg footer=msg.footer
header=msg.header
c:out value=${msg}/
/html-el:messages

And got the same message, regarless of whether the message attribute
was set to  false or omitted.

There's no other errors or messages tag in the page. It's an error
reporting page, very short.

--
Tim Slattery
[EMAIL PROTECTED]


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



Re: Struts error handling

2006-03-17 Thread Niall Pemberton
On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
  Thats very strange because the error your getting is when it
  looks for errors under the message key - which happens when
  message=true is set - otherwise it should look under the
  error key. What happens if you set html-el:errors
  message=false/?
 
  Also are you sure there are no other html:errors/ or
  html-el:errors/ tags on yor page that could be causing this?

 The errors tag doesn't have a message attribute. I tried this:

Sorry yes, getting mixed up with html:messages.

So are you using name=org.apache.struts.action.MESSAGE on your
html:errors tag then? That would cause the same.

Otherwise are you sure that you're not forwarding to a jsp thats
different to the one you think?

Niall

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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
  The errors tag doesn't have a message attribute. I tried this:
 
 Sorry yes, getting mixed up with html:messages.
 
 So are you using name=org.apache.struts.action.MESSAGE on 
 your html:errors tag then? That would cause the same.

No name attribute on the errors tag or the messages tag.

 Otherwise are you sure that you're not forwarding to a jsp 
 thats different to the one you think?

Just put some extra stuff in the error reporting page, so that I could
be sure that the right one is being used. It is the right one.

--
Tim Slattery
[EMAIL PROTECTED]


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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 So are you using name=org.apache.struts.action.MESSAGE on 
 your html:errors tag then? That would cause the same.

Just tried it with the messages loop using 

name=org.apache.struts.action.ERROR

SAME MESSAGE

--
Tim Slattery
[EMAIL PROTECTED]


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



Re: Struts error handling

2006-03-17 Thread Niall Pemberton
On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
   The errors tag doesn't have a message attribute. I tried this:
 
  Sorry yes, getting mixed up with html:messages.
 
  So are you using name=org.apache.struts.action.MESSAGE on
  your html:errors tag then? That would cause the same.

 No name attribute on the errors tag or the messages tag.

  Otherwise are you sure that you're not forwarding to a jsp
  thats different to the one you think?

 Just put some extra stuff in the error reporting page, so that I could
 be sure that the right one is being used. It is the right one.

Do you have message resources configured in your struts-config.xml?

message-resource parameter=MyApplicationResources /

Niall

 --
 Tim Slattery
 [EMAIL PROTECTED]

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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 Do you have message resources configured in your struts-config.xml?
 
 message-resource parameter=MyApplicationResources /

Never used that tag before. I put it in, no difference.

--
Tim Slattery
[EMAIL PROTECTED]


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



Re: Struts error handling

2006-03-17 Thread Niall Pemberton
On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
  Do you have message resources configured in your struts-config.xml?
 
  message-resource parameter=MyApplicationResources /

 Never used that tag before. I put it in, no difference.

Well you need to use it - looks like thats where your problem is -
can't find the message resources. In Struts 1.1 messages resources
defined in the web.xml under application was deprecated and removed
in Struts 1.2.x (see the init-param section in the upgrade notes:

http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

If it didn't make a difference check your logs - maybe you didn't
configure it correctly.

Can you post your srtuts-config showing this entry? Also have you
deployed the message resources to the correct place?

Niall

 --
 Tim Slattery
 [EMAIL PROTECTED]

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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS


 -Original Message-
 From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 17, 2006 11:34 AM
 To: Struts Users Mailing List
 Subject: Re: Struts error handling
 
 
 On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
   Do you have message resources configured in your 
 struts-config.xml?
  
   message-resource parameter=MyApplicationResources /
 
  Never used that tag before. I put it in, no difference.
 
 Well you need to use it - looks like thats where your problem 
 is - can't find the message resources. In Struts 1.1 messages 
 resources defined in the web.xml under application was 
 deprecated and removed in Struts 1.2.x (see the init-param 
 section in the upgrade notes:
 
 http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
 
 If it didn't make a difference check your logs - maybe you 
 didn't configure it correctly.
 
 Can you post your srtuts-config showing this entry? Also have 
 you deployed the message resources to the correct place?

@[EMAIL PROTECTED](*!!! I read the release notes on the web site - didn't say 
a word
about that. I'm not getting any error messages when I deploy the app.

freqs.properties is in /WEB-INF/classes. Here's struts-config.xml:

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration
1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;


struts-config


  !-- == Form Bean Definitions
=== --
form-beans
form-bean 
name=ListBean type=gov.bls.idcf.freqs.struts.ListBean
/form-bean
form-bean  
name=TabBean type=gov.bls.idcf.freqs.struts.TabBean
 /form-bean
/form-beans


!-- == Global Forward Definitions
== --
global-forwards
forward name=Home path=/index.jsp redirect=false/
forward name=SystemFailure path=/content/systemError.jsp
redirect=false/
forward name=SessionTimeOut path=/content/sessionTimeout.jsp
redirect=false/
forward name=InvalidPageRquest
path=/content/invalidPageRquest.jsp redirect=false/
forward name=PopupOpenError  path=/content/PopupOpenError.jsp
redirect=false/
forward name=ClosePopup  path=/content/ClosePopup.jsp
redirect=false/
forward name=Finish  path=/content/Finish.jsp
redirect=false/
/global-forwards


!-- == Action Mapping Definitions
== --
  action-mappings
  
actionpath=/env
   type=gov.bls.idcf.freqs.struts.PickDBAction
   name=ListBean
   scope=request
forward name=collect path=/index.jsp redirect=false/
/action

actionpath=/index
   type=gov.bls.idcf.freqs.struts.HomeAction
   name=ListBean
   input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action

actionpath=/gettable
   type=gov.bls.idcf.freqs.struts.GetTable
   name=ListBean
 input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action   

actionpath=/getfield
   type=gov.bls.idcf.freqs.struts.GetField
   name=ListBean
   input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action   

actionpath=/tabulate
   type=gov.bls.idcf.freqs.struts.Tabulate
   name=ListBean
  scope=request
  input=/index.jsp
  forward name=tabpage  path=/content/tabpage.jsp
redirect=false/
/action
   
  /action-mappings
  
  message_resources parameter=freqs null=false/
 
/struts-config


--
Tim Slattery
[EMAIL PROTECTED]


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



Re: Struts error handling

2006-03-17 Thread Niall Pemberton
Change the DTD declaration at the top of your struts-config.xml to the 1.2
version. Sorry got to run.

Niall
- Original Message - 
From: Slattery, Tim - BLS [EMAIL PROTECTED]
Sent: Friday, March 17, 2006 5:30 PM

 -Original Message-
 From: Niall Pemberton [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 17, 2006 11:34 AM
 To: Struts Users Mailing List
 Subject: Re: Struts error handling


 On 3/17/06, Slattery, Tim - BLS [EMAIL PROTECTED] wrote:
   Do you have message resources configured in your
 struts-config.xml?
  
   message-resource parameter=MyApplicationResources /
 
  Never used that tag before. I put it in, no difference.

 Well you need to use it - looks like thats where your problem
 is - can't find the message resources. In Struts 1.1 messages
 resources defined in the web.xml under application was
 deprecated and removed in Struts 1.2.x (see the init-param
 section in the upgrade notes:

 http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

 If it didn't make a difference check your logs - maybe you
 didn't configure it correctly.

 Can you post your srtuts-config showing this entry? Also have
 you deployed the message resources to the correct place?

@[EMAIL PROTECTED](*!!! I read the release notes on the web site - didn't say 
a word
about that. I'm not getting any error messages when I deploy the app.

freqs.properties is in /WEB-INF/classes. Here's struts-config.xml:

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration
1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;


struts-config


  !-- == Form Bean Definitions
=== --
form-beans
form-bean
name=ListBean type=gov.bls.idcf.freqs.struts.ListBean
/form-bean
form-bean
name=TabBean type=gov.bls.idcf.freqs.struts.TabBean
 /form-bean
/form-beans


!-- == Global Forward Definitions
== --
global-forwards
forward name=Home path=/index.jsp redirect=false/
forward name=SystemFailure path=/content/systemError.jsp
redirect=false/
forward name=SessionTimeOut path=/content/sessionTimeout.jsp
redirect=false/
forward name=InvalidPageRquest
path=/content/invalidPageRquest.jsp redirect=false/
forward name=PopupOpenError  path=/content/PopupOpenError.jsp
redirect=false/
forward name=ClosePopup  path=/content/ClosePopup.jsp
redirect=false/
forward name=Finish  path=/content/Finish.jsp
redirect=false/
/global-forwards


!-- == Action Mapping Definitions
== --
  action-mappings

actionpath=/env
   type=gov.bls.idcf.freqs.struts.PickDBAction
   name=ListBean
   scope=request
forward name=collect path=/index.jsp redirect=false/
/action

actionpath=/index
   type=gov.bls.idcf.freqs.struts.HomeAction
   name=ListBean
   input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action

actionpath=/gettable
   type=gov.bls.idcf.freqs.struts.GetTable
   name=ListBean
 input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action

actionpath=/getfield
   type=gov.bls.idcf.freqs.struts.GetField
   name=ListBean
   input=/index.jsp
  scope=request
  forward name=collect  path=/index.jsp redirect=false/
/action

actionpath=/tabulate
   type=gov.bls.idcf.freqs.struts.Tabulate
   name=ListBean
  scope=request
  input=/index.jsp
  forward name=tabpage  path=/content/tabpage.jsp
redirect=false/
/action

  /action-mappings

  message_resources parameter=freqs null=false/

/struts-config


--
Tim Slattery
[EMAIL PROTECTED]


-
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: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 Change the DTD declaration at the top of your 
 struts-config.xml to the 1.2 version. Sorry got to run.

Did that. Got the same error message. Nothing makes the slightest
difference.

--
Tim Slattery
[EMAIL PROTECTED]


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



RE: Struts error handling

2006-03-17 Thread Slattery, Tim - BLS
 Change the DTD declaration at the top of your 
 struts-config.xml to the 1.2 version. Sorry got to run.

Argghh!! I didn't see the parsing error message that landed on the app
log, not the server console. I had put in:

message_resources parameter=freqs null=false/

Putting an underscore between message and resources instead of a
hyphen. Put the hyphen in, redeployed (no parsing error messages this
time).

Presto! The error messages appear on the error page, where they're
supposed to.

Many thanks for the time you spent on this, Niall. 

--
Tim Slattery
[EMAIL PROTECTED]


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