我正在使用 Struts 2 创建一个 Web 应用程序。我有几个具有多个文本字段的表单。我想将文本字段定位到四个块中,但由于 struts 标签无法识别 div 标签,因此我无法使用 CSS 定位。我知道我可以使用 cssClass 但是定位每个 Struts 文本字段标签似乎非常费力!
<div id="updateMedicalInfoForm">
<s:form action="editNewUser">
<img src="images/icaremark.jpg" alt="">
<h1>Travel <br>Companion</h1>
<div id="spacer"></div>
<div id="spacer2"></div>
<div id="medInfoEdit">
<h2>Medical Information</h2>
<s:textfield label="Doctor Name" name="medicalInfo.doctorName" size="20" />
<s:textfield label="PracticeName" name="medicalInfo.practiceName" size="20"/>
<s:textfield label="Contact Number" name="medicalInfo.practiceNumer" size="20"/>
<s:textfield label="Allergies" name="medicalInfo.allergies" size="20"/>
<s:textfield label="Medication(s)" name="medicalInfo.medications" size="20"/>
</div>
<div id="surgeryAddressEdit">
<h2>Surgery Address</h2>
<s:textfield label="Name / No." name="medicalInfo.address.houseName" size="20" />
<s:textfield label="Address line 1" name="medicalInfo.address.addressLine1" size="20"/>
<s:textfield label="Address line 2" name="medicalInfo.address.addressLine2" size="20"/>
<s:textfield label="City" name="medicalInfo.address.City" size="20"/>
<s:textfield label="Postcode" name="medicalInfo.address.postcode" size="20"/>
<s:textfield label="Country" name="medicalInfo.address.country" size="20"/>
</div>
<div id="emergencyContactEdit">
<h2>Emergency Contact</h2>
<s:textfield label="Title" name="medicalInfo.nextOfKin.title" size="20" />
<s:textfield label="First Name" name="medicalInfo.nextOfKin.fName" size="20"/>
<s:textfield label="Last Name" name="medicalInfo.nextOfKin.lName" size="20"/>
<s:textfield label="Contact Number" name="medicalInfo.nextOfKin.contactNum" size="20"/>
<s:textfield label="Email" name="medicalInfo.nextOfKin.email" size="20"/>
<s:textfield label="Relationship" name="medicalInfo.nextOfKin.relationship" size="20"/>
</div>
<div id="emergencyContactAddressEdit">
<h2>Emergency Contact Address</h2>
<s:textfield label="House Number / Name" name="medicalInfo.nextOfKin.address.houseName" size="20" />
<s:textfield label="Address 1" name="medicalInfo.nextOfKin.address.addressLine1" size="20"/>
<s:textfield label="Address 2" name="medicalInfo.nextOfKin.address.addressLine2" size="20"/>
<s:textfield label="City" name="medicalInfo.nextOfKin.address.City" size="20"/>
<s:textfield label="Postcode" name="medicalInfo.nextOfKin.address.postcode" size="20"/>
<s:submit name="update" id="redButton" value="%{getText('button.update')}"/>
</div>
</s:form>