Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Java EE (J2EE) и Spring > ApplicationResource.properties как обратится


Автор: 4epT 15.12.2010, 00:17
Добрый вечер! В проекте сделал файл с ApplicationResource.properties во всех примерах обращение идет обычно =)) вот пример:

файл ApplicationResource.properties

Код

# -- standard errors --
errors.header=<UL>
errors.prefix=<LI>
errors.suffix=</LI>
errors.footer=</UL>
# -- validator --
errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
errors.range={0} is not in the range {1} through {2}.
errors.required={0} is required.
errors.byte={0} must be an byte.
errors.date={0} is not a date.
errors.double={0} must be an double.
errors.float={0} must be an float.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.short={0} must be an short.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.
# -- other --
errors.cancel=Operation cancelled.
errors.detail={0}
errors.general=The process did not complete. Details should follow.
errors.token=Request could not be completed. Operation is not in sequence.
# -- welcome --
welcome.title=Struts Application
welcome.heading=Struts Applications in Netbeans!
welcome.message=It's easy to create Struts applications with NetBeans.

# -- Buttons --
authorization.registration.toRegistration=Registration

Вот так пытаюсь обратится к ресурсу ... а выводит вот этот полный путь
Код

<html:submit value="authorization.registration.toRegistration" />

Автор: _and 15.12.2010, 06:01
в struts-config.xml нужно прописать 
Код

<message-resources parameter="ApplicationResources" null="false"/>

на страничке писать так
Код

<%@ taglib uri="http://jakarta.apache.org/struts/tags/struts-bean" prefix="bean" %>

...

<html:submit value="<bean:message key="authorization.registration.toRegistration"/>" />

Автор: 4epT 15.12.2010, 10:49
Цитата(_and @ 15.12.2010,  06:01)
в struts-config.xml нужно прописать 
Код

<message-resources parameter="ApplicationResources" null="false"/>

на страничке писать так
Код

<%@ taglib uri="http://jakarta.apache.org/struts/tags/struts-bean" prefix="bean" %>

...

<html:submit value="<bean:message key="authorization.registration.toRegistration"/>" />

спасибо, попробую)

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)