2013-06-19 34 views
0

我有一個表格:Struts 2的標籤,不會產生標籤

<!-- Box Start--> 
    <div id="box_bg"> 
     <div id="content"> 
      <h1 class="blue">Edit an exam</h1> 
      <!-- Exam Fields --> 
      <s:form theme="simple" action="editExam"> 
       <div > 
        <s:hidden name="exam.id" /> 
        <s:textfield name="exam.name" cssErrorClass="register error" label="Exam Name" cssClass="register" required="" /> 
        <s:textfield name="exam.minutesAllotted" label="Minutes Allotted" cssErrorClass="register error" cssClass="register" required="" /> 
        <s:textfield name="exam.numQuestions" label="Number Of Questions" cssErrorClass="register error" cssClass="register" required="" /> 
        <sj:datepicker readonly="true" name="exam.startDate" cssClass="register" label="Start Date" displayFormat="mm/dd/yy" required="" /> 
        <sj:datepicker readonly="true" name="exam.endDate" cssClass="register" placeholder="End Date" displayFormat="mm/dd/yy" required="" /> 
       </div> 
       <!-- Blue Button --> 
       <s:submit type="button" cssClass="button blue" value="Edit" /> 
      </s:form> 
     </div> 
    </div> 

與下面的CSS:

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video 
    { 
    margin: 0; 
    padding: 0; 
    border: 0; 
    font-size: 100%; 
    font: inherit; 
    vertical-align: baseline; 
} 

article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section 
    { 
    display: block; 
} 

body { 
    line-height: 1; 
} 

/** Base Body Styles **/ 
body { 
    background: url(../images/body-bg.png); 
    color: #838383; 
    font: 13px "Droid Sans", Arial, Helvetica, sans-serif; 
} 

h1,h2,h3,h4,h5,h6 { 
    font-weight: bold; 
    font-family: 'Droid Sans', sans-serif; 
    color: #434853; 
    text-shadow: 0px 1px 0px #fff; 
    letter-spacing: -0.5px; 
} 

h1 { 
    font-size: 20px; 
    color: #2d932b; 
    padding: 0 0 13px 0; 
    border-bottom: 1px solid #e0e0e0; 
} 

input,textarea { 
    font-family: tahoma, arial; 
    font-size: 12px; 
    color: #57595d; 
} 

p { 
    line-height: 20px; 
} 

#box_bg { 
    border: 1px solid #d5d5d5; 
    background: #f9f9f9; 
    width: 380px; 
    display: block; 
    margin: 50px auto 20px auto; 
    -webkit-border-radius: 10px; 
    -moz-border-radius: 3px; 
    border-radius: 3px; 
    box-shadow: 0px 0px 2px #dadada, inset 0px -3px 0px #e6e6e6; 
    padding-bottom: 50px; 
} 

#content { 
    padding: 23px 28px; 
} 

.blue { 
    color: #2b83b6; 
} 

.button { 
    -webkit-border-radius: 3px; 
    -moz-border-radius: 3px; 
    border-radius: 3px; 
    display: inline-block; 
    float: right; 
    margin-top: 18px; 
} 

.button a { 
    padding: 9px 26px 8px 26px; 
    color: #fff; 
    font-weight: bold; 
    font-size: 14px; 
    display: block; 
} 

.button.blue { 
    background-image: linear-gradient(bottom, #1F7FB6 0%, #4EABE0 100%); 
    background-image: -o-linear-gradient(bottom, #1F7FB6 0%, #4EABE0 100%); 
    background-image: -moz-linear-gradient(bottom, #1F7FB6 0%, #4EABE0 100%); 
    background-image: -webkit-linear-gradient(bottom, #1F7FB6 0%, #4EABE0 100%); 
    background-image: -ms-linear-gradient(bottom, #1F7FB6 0%, #4EABE0 100%); 
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #1F7FB6), 
     color-stop(1, #4EABE0)); 
    -ms-filter: 
     "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4EABE0, endColorstr=#1F7FB6)"; 
    border: 1px solid #2a76a2; 
    border-bottom: 2px solid #215f82; 
    box-shadow: inset 0px 1px 0px #9cd0ee; 
    text-shadow: -1px -1px 0px #246c95; 
    background-color: #3897cd; 
    padding: 9px 26px 8px 26px; 
    color: #fff; 
    font-weight: bold; 
    font-size: 14px; 
    display: block; 
} 

.button.blue:hover { 
    background: #3897cd; 
} 

.button.blue:active { 
    margin-top: 19px; 
} 

/** Register Fields **/ 
.register { 
    font-size: 14px; 
    color: #8e8d8d; 
    font-family: "Droid Sans"; 
    padding: 11px 15px 10px 15px; 
    background-color: #fdfdfd; 
    width: 290px; 
    display: block; 
    border: 1px solid #d8d8d8; 
    margin: 13px 0 -3px 0; 
    -webkit-border-radius: 3px; 
    -moz-border-radius: 3px; 
    border-radius: 3px; 
    box-shadow: inset 2px 2px 4px #f1f1f1; 
} 

.register.error { 
    border: 1px solid #f19d9d; 
    background-color: #ffe0e0; 
    box-shadow: inset 0px 0px 0px #fff; 
    color: #d95e5e; 
} 

#blue { 
    color: #2b83b6 !important; 
} 

#blue:hover { 
    color: #878787 !important; 
} 

對於沒有被生成的標籤有些道理的。當我看到生成的HTML是這樣的:

<input name="exam.id" value="7" id="editExam_exam_id" type="hidden"> 
        <input name="exam.name" value="Physics" id="editExam_exam_name" class="register" required="" type="text"> 
        <input name="exam.minutesAllotted" value="30" id="editExam_exam_minutesAllotted" class="register" required="" type="text"> 
        <input name="exam.numQuestions" value="100" id="editExam_exam_numQuestions" class="register" required="" type="text"> 
        .... 

我如何標記所有這些領域,同時仍保留格式?這是它目前的樣子: http://imgur.com/PSfeHlN

回答

0

"simple"主題不會生成標籤。

您可以使用純HTML標籤字段和<s:text>創建標籤。

或者,如果您要在整個網站中使用此格式,請創建自己的主題並修改模板發出的HTML,以將標籤放置在所需的位置。

也考慮使用"css_xhtml"主題,並使用CSS來重新定位元素,雖然有幾個「陷阱」走這條路線,就像一些模板中不幸的剩餘<br/>標記。

+0

css_xhtml伎倆。 –