问题
I have implemented internationalization in my Struts2 application and it is working fine, but how do I change the cursor position automatically in all the textboxes in all the jsp to RTL when I select Arabic as the language?
If you could give me a simple example it would be very helpful.
回答1:
How about adding dir
attribute to the <html>
tag in JSP-s, using Struts2 <s:if>
tag to check current locale language:
<html <s:if test="locale.language == 'ar'">dir="rtl"</s:if> >
...
</html>
回答2:
Try this one(not tested)
Well its simple. Lets assume that you are storing the current selected language in session with name currlang
. Then on each text-box do
<s:textfield label="Some Test Box" name="nameit" cssStyle="<s:if test="#session['currlang'] == 'arbic'">direction: rtl;</s:if>"/>
来源:https://stackoverflow.com/questions/14973594/in-struts2-internationalization-in-arabic-how-to-automatically-change-cursor-in