Versions Compared

Key

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


note
Tip
titleAdding New FAQs

Each question FAQ should be cross-referenced from a new page. Typically answers should link to content in the Reference. If the answer isn't in the Reference, then it should probably be added there and then linked to from the FAQ. Also note that some of the questions are current'y too verbose and should be broken down given that they have already been categorized (ie: Validation, Internationlization, etc).

General

Tags

Inversion of Control

Validation

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.


Excerpt

Migrating

General

HOWTO

Configuration

Accessing Resources

Per-Page Settings

Interceptors

Validation

...

Localization

Type Conversion

...

How do I get the latest version of Webwork and XWork from CVS?
cvs -d :pserver:guest@cvs.dev.java.net:/cvs login
(Use an empty password, just hit enter..)
cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout webwork
cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout xwork

Note: WebWork from the CVS does not compile with the latest 1.5 J2sdk. Use the stable J2sdk 1.4.2.

How do I build the latest versions XWork and Webwork?
Just go into the XWork or WebWork directories and run 'ant' (you must have ant installed and have the jars of junit and clover inside $ANT_HOME/lib)

Once you have built the xwork.jar copy it into the webwork/lib/core folder, and delete the old one.

How do I use messages from within the validator?

...


<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> 

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

How do I set a global resource bundle?
How do I change the error message for invalid inputted fields?
You need to create a message for that field, for example if you have a user.dob field you would use this in your messages file (see above for example on setting a global messages file):
invalid.fieldvalue.user.dob=Please enter Date of Birth in the correct format.

How can I use the IOC container to initialize a component in another object that isnt an action?
Obtain the ComponentManager from the request: ComponentManager cm = (ComponentManager) ServletActionContext.getRequest().getAttribute("DefaultComponentManager");
then you need to initialize it using: cm.initializeObject(Object)

How do I decouple XWork LocalizedTextUtil global resource bundle loading from serlvets (ServletContextListener)?
If you're using XWork outside a Web context, then use whatever startup hooks you have in that context (i.e. application start for a desktop app) to add the global resource bundle. This is a startup activity, so use whatever mechanisms are provided in the context you're running in.

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 Webwork tags from Velocity...how can i do this??

How do I add I18N to a UI tag, like ww:textfield?

Code Block

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

This will get the localized text message for the key "i18n.label" and put it in the label.

Code Block

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

Alternatively, you could modify controlheader.vm and copy it to /template/xhtml. There you could make it so that it automatically does a call to $stack.findValue("getText($parameters.label)"), making the first example actually work for i18n.

...