Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Tip
titleAdding New FAQs

Each FAQ should be cross-referenced from a relevant page in one of the guides. (If a relevant page in the guide is missing, then we probably need to create one!) Each question should be a new page. Answers should be concise and focused. If an answer seems long, or seems like it could relate to more than one section, then the question might be addressing more than one concern.

FAQs can also be "mini-HOWTOs". As long as the question and answer are focused on a single concern, length is not an issue.


...


<validators>
    <field name="name">
        <field-validator type="requiredstring">
            <message key="template.name.errors.required">A default message in case the key is not found</message>
        </field-validator>
    </field>
</validators> 

...

Java class (thanks Drew McAuliffe):

...


public class WebworkGlobalMessagesListener implements ServletContextListener {
    private static Logger log = Logger.getLogger(WebworkGlobalMessagesListener.class);
    private static final String DEFAULT_RESOURCE = "global-messages";

    /**
     * Uses the LocalizedTextUtil to load messages from the global
     message bundle.
     * @see
     javax.servlet.ServletContextListener#contextInitialized(javax.servlet.Servle
     tContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
        log.info("Loading global messages from " + DEFAULT_RESOURCE);
        LocalizedTextUtil.addDefaultResourceBundle(DEFAULT_RESOURCE);
        log.info("Global messages loaded.");
    }

    /**
     * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {

        // do nothing
    }

}

web.xml:
(under listeners section)

...


<listener>
<listener-class>mypackagename.WebworkGlobalMessagesListener</listener-class>
</listener> 

...

Excerpt

Migrating

General

HOWTO

Configuration

Accessing Resources

Per-Page Settings

Interceptors

Validation

Localization

...

Type Conversion

Value Stack

Tags

POJOs

Spring

Velocity

Ajax/Dojo

Issues in Specific Environments

Extensions

Portlet Support(JSR168)

Migrating


Errata?

Tip

To suggest a change or a correction to any part of the documentation, log in and leave a comment on the appropriate page. We are always looking for help with the documentation!

Next: Cookbook

Q. What i need to do to put values in a combobox. If I am using webwork2?
If i have :

Code Block

#tag(Select "label='xxx '" "name='xxx'" "list=?")
or 
#tag(combobox "label='Prioridade'" "name='inavis.avisTpPrioridade'" "list=?")

the values in this combobox, what i need to do?
Exemple:

Code Block

html tag i use to do:

<select..>
  <otpion value="" selected>XXX</option>
</selct>

so...i need to do this using Webwork2 tags from Velocity...how can i do this??

Q. How do I add I18N to a WW2 Tag, like ww:textfield?

Code Block

<ww:textfield label="'i18n.label'" name="'label1'" value="''">

???

Code Block

<ww:textfield label="getText('i18n.label')" name="'label1'" value="''">

...