struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanderson <jeanderso...@gmail.com>
Subject Re: Unable to find keys located in .properties file
Date Thu, 12 Mar 2015 13:50:28 GMT
I didn't mentioned that I'm running on Tomcat 7, sorry about that.
Yep, Tomcat and Eclipse might be trolling me.

I tried running with Jetty. I noticed that it seems ignores the
"welcome-file-list" property from "web.xml" because
I got an exception when accessing "localhost:8080/message_resource".

I just added an index action pointing to "/index.jsp" so you can see the
dummy form.
The register action just points to "thankyou.jsp" in case of a successful
result.
The "thankyou.jsp" doesn't use the .properties file.

I pushed my changes into my hotfix branch. Maybe you could try clonning
again the project [1] and see if the form from index.action
displays correctly.

[1]
https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource

Jeanderson Barros Cândido
http://jeandersonbc.github.io

2015-03-12 10:15 GMT-03:00 Lukasz Lenart <lukaszlenart@apache.org>:

> Just cloned your repo and started the app with mvn jetty:run and
> pointed browser to http://localhost:8080/message_resource/register -
> everything looks good :)
>
> I think Eclipse is cheating you ;-)
>
> 2015-03-12 13:50 GMT+01:00 Jeanderson <jeandersonbc@gmail.com>:
> > Hi Lukasz,
> >
> > Actually the resource file is located in an action folder as the
> > documentation suggests:
> >
> > * Register.properties -
> >
> https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource
> > */src/main/resources/lab_struts/tutorial/message_resource/action*
> > * Register.java -
> >
> https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource
> > */src/main/java/lab_struts/tutorial/message_resource/action*
> >
> > However, I tried renaming Register.properties to package.properties, as
> you
> > suggested, but I'm still getting errors
> >
> > 2015-03-12 09:37:23,181  WARN
> > (com.opensymphony.xwork2.util.LocalizedTextUtil:64) - Missing key
> > [formBean.firstName] in bundles [[org/apache/struts2/struts-messages,
> > com/opensymphony/xwork2/xwork-messages]]!
> > 2015-03-12 09:37:23,227  WARN
> > (org.apache.struts2.components.ServletUrlRenderer:60) - No configuration
> > found for the specified action: 'register' in namespace: ''. Form action
> > defaulting to 'action' attribute's literal value.
> >
> > It's a bit frustrating to get stuck with this kind of issue but I think
> it
> > could be some problem hidden somewhere.
> > Both .java and .properties files are in the place they're supposed to be.
> > Just a random guess, isn't there any sort of configuration missing in any
> > xml file?
> >
> > Thanks for your time and attention,
> >
> > Regards,
> >
> > Jeanderson Barros Cândido
> > http://jeandersonbc.github.io
> >
> > 2015-03-12 2:44 GMT-03:00 Lukasz Lenart <lukaszlenart@apache.org>:
> >
> >> Almost gut
> >>
> >> your action is in:
> >> src/main/java/lab_struts/tutorial/message_resource/action
> >>
> >> but the related properties file in:
> >> src/main/resources/lab_struts/tutorial/message_resource/
> >>
> >> so they differ on the last part - "action" and that's why message
> >> cannot be found. You have two options here:
> >> - rename Register.properties to package.properties then it will be
> >> used for all actions in this package and below
> >> - create subdirectory "action" and move Register.properties there
> >>
> >> It's explained here
> >> http://struts.apache.org/docs/localization.html
> >>
> >>
> >> 2015-03-11 21:58 GMT+01:00 Jeanderson <jeandersonbc@gmail.com>:
> >> > Hello Lukasz Lenart,
> >> >
> >> > Thank you for your message. I imagined that working with a directory
> tree
> >> > generated by Eclipse could be a problem.
> >> > I started a new project based on Maven [1], however, if you run my
> code,
> >> > you will get again a warning:
> >> >
> >> > "
> >> > 2015-03-11 17:48:00,316  WARN
> >> > (com.opensymphony.xwork2.util.LocalizedTextUtil:64) - Missing key
> >> > [formBean.firstName] in bundles [[org/apache/struts2/struts-messages,
> >> > com/opensymphony/xwork2/xwork-messages]]!
> >> > 2015-03-11 17:48:00,340  WARN
> >> > (org.apache.struts2.components.ServletUrlRenderer:60) - No
> configuration
> >> > found for the specified action: 'register' in namespace: ''. Form
> action
> >> > defaulting to 'action' attribute's literal value.
> >> > "
> >> >
> >> > It is not clear for me what is wrong, it is like the framework can't
> find
> >> > the properties files for some reason.
> >> > Any idea of what am I missing?
> >> >
> >> > [1]
> >> >
> >>
> https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource
> >> >
> >> > Best regards,
> >> > Jeanderson Barros Cândido
> >> > http://jeandersonbc.github.io
> >> >
> >> > 2015-03-11 16:10 GMT-03:00 Lukasz Lenart <lukaszlenart@apache.org>:
> >> >
> >> >> 2015-03-11 18:09 GMT+01:00 Jeanderson <jeandersonbc@gmail.com>:
> >> >> > Hi everyone,
> >> >> >
> >> >> > I am a beginner in Struts 2 and so far, I've been working with
the
> >> >> official
> >> >> > tutorials to get started with the framework. Also, I'm using
> Eclipse.
> >> >> >
> >> >> > In the "Message Resource Files" [1], the framework can't find
the
> key
> >> >> > located in the .properties file although it is placed in the same
> >> package
> >> >> > of its related action class.
> >> >> >
> >> >> > Since I'm using Eclipse to create every Struts 2 project and
> knowing
> >> that
> >> >> > Struts 2 is a "convention over configuration" framework, I wonder
> if
> >> I'm
> >> >> > having this problem because the generated directory tree is not
the
> >> same
> >> >> as
> >> >> > the one created using Maven.
> >> >> >
> >> >> > Is there any recommended way to start a Struts 2 project? My code
> is
> >> >> hosted
> >> >> > at Github [2] and maybe someone could give me a hint of what is
> wrong
> >> >> with
> >> >> > it. I did everything as suggested in the tutorial and that's why
I
> >> >> believe
> >> >> > the issue is having a different directory tree.
> >> >> >
> >> >> > [1] http://struts.apache.org/docs/message-resource-files.html
> >> >> > [2]
> >> >> >
> >> >>
> >>
> https://github.com/jeandersonbc/labs-struts2/tree/master/tutorial/message_resource
> >> >>
> >> >> Your project [2] is a bit messy, you're using Maven (pom.xml) but you
> >> >> don't follow standard layout structure for Maven projects. If you
> want
> >> >> to use Maven to build your Struts2 project it's far better to start
> >> >> with Maven Archetypes, read this
> >> >>
> >> >>
> >> >>
> >>
> http://struts.apache.org/docs/struts-2-maven-archetypes.html#Struts2MavenArchetypes-Quickstart
> >> >>
> >> >> and basically use this
> >> >>
> >> >> mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/
> >> >>
> >> >>
> >> >> Regards
> >> >> --
> >> >> Łukasz
> >> >> + 48 606 323 122 http://www.lenart.org.pl/
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message