样式属性标记在Struts 2 [英] styling property tag in Struts 2

查看:266
本文介绍了样式属性标记在Struts 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Struts2属性标签来获取这样的用户名。

I am making use of the Struts2 property tag to get the user name like this.

<div class="MyStyle">
<p> Hi! <s:property value="#session.firstName"/></p>
</div>



现在我想要这个div采用类MyStyle中定义的样式,但它不会采取任何风格。
可以做什么?

Now I want this div to take the style defined in class MyStyle, but it wont take any style. What can be done regarding this?

推荐答案

有一个 Struts2的bootstrap插件。所有你需要在head标签中定义< sb:head /> ,并在类路径中定义include插件。这是一个典型的用法

There's a bootstrap plugin for Struts2. All you need to define <sb:head/> in the head tag and include plugin on the classpath. This is a typical usage


<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    ...
    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <sb:head/>
</head>
<body>
...
</body>
</html>







注意:引导插件项目已移至 GitHub


Note: The bootstrap plugin project is moved to GitHub.

这篇关于样式属性标记在Struts 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆