我喜欢view.jsp使用struts2 在页面中拆分字符串。请帮我解决这个问题。我想用逗号分割字符串值languagesKnown,从数据库中获取值。
view.jsp
languagesKnown
例如languagesKnown包含类似的字符串"tamil,English,Malayalam"。所以我喜欢用struts2分割字符串
"tamil,English,Malayalam"
<div class="personal-row1" style="width:90.4%;"> <i class="icon-align-left icon-grey1"> </i> <span class="blue1"> Languages Known: </span> <!--<span class="price free"><span>Free</span></span>--> <span class="lang-tab"> <s:property value="languagesKnown"/> </span> <span class="lang-tab"> Tamil </span> <span class="lang-tab"> Hindi </span> </div>
split在OGNL表达式中使用该方法
split
<s:iterator value='languagesKnown.split(",")'/> <span class="lang-tab"><s:property/></span> </s:iterator>