Reputation: 31
I am new to wicket. I am trying to run someone else's code in my local machine which is working in production. I have java code and html code in same folder. I have wicket id "instructions" defined for corresponding java id but still I'm getting resouce not found error.
ERROR - XYZApplication - Unable to find resource: instructions for component: instructions [class=org.apache.wicket.markup.html.basic.Label]
//java file
ResourceModel instructionsModel = new ResourceModel("instructions");
instructions = new Label("instructions", instructionsModel);
add(instructions);
html file
<div wicket:id="instructions" class="instructions"></div>
Can you please help me solve this issue?
Upvotes: 2
Views: 1417
Reputation: 4013
A ResourceModel
is used for internationalization, so it's looking for an entry in one of your resource bundles with the name instructions
, but can't find it.
Resource bundles follow the same naming conventions as your HTML and Java files, so if you have MyPanel.java
and MyPanel.html
, the resource bundle could be named MyPanel.properties
(there are more options though).
A resource file generally looks like this:
my.label=Hi, I'm a label
my.description=This is a description
In your case, an entry like this should be present:
instructions=To use this form, you need to enter data
It could also be the case that a bundle is defined at the application level, so if you have MyApplication.java
, your resource bundle will be in the same package and called MyApplication.properties
.
You can read more about how internationalization works in wicket on the Wiki.
If these files are already present and contain the correct entry, then what might be the case is that your .properties
files aren't being bundled into the application on your local machine. In that case you need to check both your build tool settings (Maven's pom.xml
or Gradle's build.gradle
, for instance) as well as your IDE's settings.
Upvotes: 3