开发者

Struts2 + Internationalization + Arabic + English + {RTL or LTR}

I am still struggling with formatting (LTR or RTL) the output with respect to language English or Arabic.

Lets take simple one tag of "struts-tag" library:

<s:textfield key="_do._toTime" value="00:00" maxlength="5"/>

Now I want that when locale is "English" it should print "LTR" but when locale is "Arabic" it should print "RTL".

I read some where that its possible but couldn't find an开发者_JAVA技巧y concrete example that how to achieve this?

Any idea?

BR SC


I see that you were on the right track in your previous question: Struts2 + Internationalization + Java

The easiest way to adapt BalusC's example is to add a getDirection() method to your action which returns either "ltr" or "rtl".

public String getDirection() {
    return getText("this.direction");
}

Then, in your JSP:

<html dir="${action.direction}">

That will trigger the getDirection() method on your action, which will return the value of this.direction in your bundle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜