CSS不适用于Struts 2表单页面

时间:2013-04-10 10:46:51

标签: java css jsp struts2 struts-validation

在我的Struts 2应用程序中,我试图添加CSS样式但它没有显示在页面上。但是当我单击提交时,但两次显示验证错误后才显示CSS。请告诉我这个问题的简历是什么,我的表格在这里

<%@ page language ="java" contentType ="text/html; charset=ISO-8859-1" pageEncoding ="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %> 
 <html>
    <head>
       <sx:head/>
    <script type="text/javascript"  src ="script.js"></script>
   <link rel="stylesheet" type="text/css" href="css/emp.css">

    </head>  

<body>

        <div id ="did" align="center"> <h1 style="color: red">  ENPLOYEE REGISTRATION FORM</h1>

   <s:form  action="emplogin"  method="post" >

      <s:textfield name="firstname" label="Employee Firstname"/>
      <s:textfield name ="lastname" label ="Last name"/>  
      <s:textfield name ="id"  label="Id"/>
      <s:radio name ="gender"   list="{'male', 'female'}" label = "Gender"/>
    <sx:datetimepicker name="dob" displayFormat="dd-MMM-yyyy"  label="DOB"></sx:datetimepicker> 
      <s:radio  name ="maritalstatus" list="{'singale','married'}" label="Marital Status" />

      <s:textfield name ="email" label ="Email" />
 <sx:datetimepicker name ="joiningdate" displayFormat="dd-MMM-yyyy" label="Joining Date" ></sx:datetimepicker>

      <s:textfield name= "designation" label = "Designation"/>
      <s:textarea name ="address" label ="Address" />
      <s:textfield name = "country" label ="Country" />     
      <s:textfield name  ="state" label = "State" />
      <s:textfield name  ="city" label ="City"/> 
      <s:textfield name ="pincode" label ="Pincode"/>
      <s:textfield name ="mobileno" label="Mobile No"/>
      <s:select   name ="groups" list="{'group 1', 'group 2', 'group 3'}"  label ="Group"  />
     <tr><td>&nbsp;</td></tr>
        <tr>
    <td>&nbsp;</td>
      <s:submit align="center"></s:submit>
      </s:form>
       </div>
    </body>
 </html>

CSS文件是:

#did
{background-color:#6495ed;}

#trasition
{
transition: width 2s;
-webkit-transition: width 2s; 
} 

1 个答案:

答案 0 :(得分:1)

你错误地使用了style属性的语法

你应该替换这个

cssStyle="{width:184px"

cssStyle="width:184px;"

自2.1版以来,struts2中也不推荐使用dojo标记库。请改用struts2-jquery