This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Missing message for key

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying an example from Jakarta Struts Live book.
My application isnt able to read the application.properties file or not able to refence the key values and I end up with errors like "Missing message for key .."

In struts-config.xml I have
<message-resources parameter="application" />
when application.properties is kept directly under the source folder.

Inside application.properties I have message and key pairs as :

userRegistration.firstName.problem=The first name was blank.
userRegistration.firstName=First Name.
userRegistration.lastName=Last Name.
userRegistration.username=Username.

Inside my JSP form I have

<bean:message key="userRegistration.firstName"/>
to reference the value from the resource file.

I see errors like 2005-03-18 17:01:20 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exceptionjavax.servlet.jsp.JspException: Missing message for key "userRegistration.username" at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:235)

when I am trying to deploy the app.

It deploys fine, but when I try to access the JSP, it shows me an error javax.servlet.ServletException: Missing message for key "userRegistration.firstName"

I tried changing the location of application.properties, to no avail.
Using Netbeans 4.1 , J2SE 1.5 , copied latest struts lib from Apache.

Could you advise ?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have it in your struts-config? If so, please post your message-resources tag.
 
Manzar Zaidi
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for looking this up Marc.

In struts-config.xml I have
<message-resources parameter="application" />
when application.properties is kept directly under the source folder.

<message-resources parameter="resources.application" />
when application.properties is kept under a folder names resources under the source folder.
 
Everybody's invited. Even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic