Thanks for the response. My comments follow yours...

eden wrote:
> 
> Struts gives you the option of planting a trap for that sort of thing (i.e.
> missing resource files ) in the jsp itself, via the logic tag  (present/not
> present),

By this, I assume you mean this sort of thing (which I have already
cut/pasted from the sample struts app):

<logic:notPresent name="org.apache.struts.action.MESSAGE"
scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>

As I indicated, I already have this check in place for the jsp in
question. However, now that I look at the sample page from when I stole
this stuff, I wonder how it could ever work. Note that the above code
follows AFTER this line: <title><bean:message
key="index.title"/></title>. Now, if the application resources are NOT
found, how can this line be resolved? I find that an exception gets
thrown due to failure to get a message with the specified key. In this
case, how does execution ever get to the logic test? Im my case, it does
not.

In addition, I find that if struts does NOT find the application
resources file, a PropertyMessageResources is still associated with the
application scoped variable keyed to org.apache.struts.action.MESSAGE.
However, when I try to access my message via its key, null is returned.
I have no idea what is being placed in the application scope variable
except that it is an instance of the PropertyMessageResources class.
Anyone know what this is?

 or the ever useful ActionErrors object returned from the validate
> method of a class that extends 'ActionForm'.  You can do your resource file
> validation there as well, so the code never executes past the form bean if
> the file isn't in place.

Of course, this is another way to do it. Except that I am simply trying
to access my index.jsp page which is NOT a form.

> 
> Remember, and Application type resource files (like string resource files,
> for eg) must be present in the class path in order to be used.  Use ant to
> copy any resource files into your WEB-INF/Classes dir to make sure you don't
> get any errors.

I have checked and the file ApplicationResources.properties is being
copied into the right place in the war file. I belive that the initial
problem I am having is with JBuilder 5. However, if I explicitly try to
break struts by removing the named resource file from the .war file, I
get the above described behavior and struts just marches merrily on.

Any idea? Do you get the same behavior?

Thanks,

David

> 
> Cheers!
> Melissa
> 
> -----Original Message-----
> From: David White [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 4:21 PM
> To: [EMAIL PROTECTED]
> Subject: What If Resources Are Not Found?
> 
> I am having difficulty running a struts web-app via JBuilder 5. I do not
> seem to be getting my resource file loaded/found. However, this is not
> really a JB question...
> 
> It seems that struts looks for the configured resource file (I see the
> message in the log). However, it does NOT seem to do anything if that
> file is not found. It seems to just march merrily on only to fail later
> when the application asks for a resource and it is not found.
> 
> I have looked a bit at the source code for the action servlet and I
> cannot see anywhere in the resource factory stuff where it will fail if
> the configured file is not found.
> 
> Is this intended?
> 
> Thanks,
> 
> David

Reply via email to