将来自会话的值传递给字体大小属性

Passing a value coming from a session to font-size attribute

我需要你的帮助来解决一个问题。我需要根据存储到会话中的值来设置字体大小。 我需要写一些类似

的东西
<a href="/chips" style="font-size: (#session.soglia)pt"><s:property value="nome"/></a>

但这行不通!我能怎么做?字体大小存储在会话中,因为它可以动态更改(操作 class 在调用 jsp 页面之前计算它)。谢谢!!!

The font size is stored into a session because it can dinamically change (an action class calculates it before calling the jsp page).

这并没有解释为什么这里需要会话,但是...

要使用 OGNL 访问 Session 属性、Action 属性或其他任何内容,您需要使用 Struts 标签。

<a href="/chips" style="font-size: <s:property value='#session.soglia'/>pt">
    <s:property value="nome"/>
</a>

否则你需要使用 JSP EL。但是不要。

题外话:值得注意的是,今天我们有比点更熟练的方法来处理字体大小,例如。 Viewport Sized typography.