1

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>

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?

EDIT:

I am using bootstrap css. The class ="MyStyle" was just to make the question simple. The html source code generated for the page looks like this

<ul class="nav navbar-nav navbar-right"> <li> Hi! Akash </li> <li><a href="/Project/logout.action"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li> </ul>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Akash Pandey
  • 121
  • 1
  • 6

1 Answers1

0

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>

Note: The bootstrap plugin project is moved to GitHub.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • Well I had already added struts-bootstrap-plugin jar and I added <%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %> and . Orientation of an image in my page changed but the remaining things remained as it is – Akash Pandey Aug 22 '15 at 18:34
  • The link above include a page to update the plugin to proper bootstrap version. – Roman C Aug 22 '15 at 19:08