Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

struts radio button alignment

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts radio button is not aligned properly. I have used the below struts tag for radio buttons. But the alignment of male and female radio buttons got jumbled. I don't want to convert this struts tag to input tag for UI design purpose. Please help me............ I have googled a lot but couldn't find a solution. I have attached the part of my jsp view which shows you how the radio buttons got jumbled.

<s:radio label="Gender" name="gender" required="true" list="#{'1':'Male','2':'Female'}" />



Please help ASAP
Radio-Alignment.png
[Thumbnail for Radio-Alignment.png]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the FAQ Why do the form tags put table tags around controls
 
usha kotha
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but i have already tried this. it made no impact.

Joe Ess wrote:See the FAQ Why do the form tags put table tags around controls




 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show us some code?
 
usha kotha
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<s:radio label="Gender" name="gender" required="true" list="#{'1':'Male','2':'Female'}" theme="simple" />


when i put this code the view changed like this..............with no label and more jumbled than before

Joe Ess wrote:Can you show us some code?

RadioAlignment1.png
[Thumbnail for RadioAlignment1.png]
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Usha,

Can you post your whole jsp as i put the line you mention and it worked perfectly. Have you made any changes in default theme provided by struts as you have mention theme="simple" explicitly.

Regards
Jatan bhavsar

 
usha kotha
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is my jsp


<%-- <%
response.setHeader("Pragma", "no-cache");
%>


<%
response.setHeader("Cache-Control", "no-store");
%>
<%
response.setDateHeader("Expires", -1);
%> --%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Candidate</title>
<link href="style2.css" rel="stylesheet" type="text/css" />
<sx:head parseContent="true" />
<script type="text/javascript">
function Checkfiles() {
var fup = document.getElementById('upload_filename');
var fileName = fup.value;
//alert (fileName);
var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
//alert (ext);
if (fileName == "") {
alert("Please select a file to Upload");
return false;
} else if (ext == "doc" || ext == "DOC") {
return true;
} else {
alert("Make sure to upload only .doc files");
fup.focus();
return false;
}
}
</script>
</head>

<body>
<%@ page errorPage="errorpage.jsp" %>
<%@ include file="QuickSearch.jsp"%>

<form name="frm" action="AddCandidate" method="post"
enctype="multipart/form-data">
<%@ include file="MainPage.jsp"%>


<!--Menu ends here-->

<!--Content Starts here-->


<div class="wrapper">

<div class="cont1"></div>

<div class="cont2">
<div class="title">Add Candidate</div>
<div class="centent">
<div class="conbox1">

<div class="fields">
<h1>Identification</h1>

<div class="formbox_in">
<s:textfield label="First Name" name="firstName"
value="%{firstName}" maxlength="25" required="true"
style="border:1px solid #ccc; background:#fff; width:165px;" />

<s:hidden name="userName" value="%{userName}" maxlength="15"
style="border:1px solid #ccc; background:#fff; width:165px;" />
<s:hidden name="roleInfo" value="%{roleInfo}" maxlength="15"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">
<s:textfield label="Middle Name" name="middleInitial"
maxlength="25"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">
<s:textfield label="Last Name" name="lastName"
value="%{lastName}" maxlength="25" required="true"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">

<!-- <label class="label" for="gender">Gender:</label>
<input type="radio" value="1" id="gender1" name="gender" style="float: left; margin-left: 10px; margin-top: 4px;">
<label for="gender1" style="width: 45px; text-align: left; margin-left: 5px;">Male</label>
<input type="radio" value="2" id="gender2" name="gender" style="float: left; margin-top: 4px;">
<label for="gender2" style="text-align: left; width: 50px; margin-left: 5px;">Female</label> -->



<s:radio label="Gender" name="gender" required="true"
list="#{'1':'Male','2':'Female'}" />

</div>

<div class="clear"></div>

</div>

<div class="fields">
<h1>Contact Details</h1>

<div class="formbox_in">
<s:textfield label="Address" name="address" maxlength="30" required="true"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">
<s:textfield label="City" name="city" maxlength="30" required="true"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">
<s:select label="State" name="state" headerKey="Select" required="true"
headerValue="Select" list="states" listKey="value"
listValue="value"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />

</div>

<div class="clear"></div>

<div class="formbox_in">
<s:textfield label="Zip" name="zip" required="true"
maxlength="6"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>


<div class="formbox_in">
<s:select label="Country" name="country" headerKey="United States" required="true"
headerValue="United States" list="countries" listKey="value"
listValue="value"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />

</div>

<div class="clear"></div>


<div class="formbox_in">
<s:textfield label="Home Phone" name="homePhone"
value="%{homePhone}" maxlength="15"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>


<div class="formbox_in">
<s:textfield label="Cell Phone" name="cellPhone"
value="%{cellPhone}" maxlength="15"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>


<div class="formbox_in">
<s:textfield label="Email" name="emailId" value="%{emailId}"
maxlength="50" required="true"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>


<div class="formbox_in">
<s:textfield label="Alternate Email" name="altEmail"
maxlength="50"
style="border:1px solid #ccc; background:#fff; width:165px;" />

</div>

<div class="clear"></div>


</div>
</div>

<div class="conbox2">

<div class="fields">
<h1>Highest Education</h1>

<div class="formbox_in">
<s:select label="Education Level" name="educationLevel"
headerKey="Select" headerValue="Select"
list="{'Doctorate','Masters','Associate','Bachelors','High School'}"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />

</div>

<div class="clear"></div>


</div>


<div class="fields">
<h1>Status</h1>

<div class="formbox_in">
<sx:datetimepicker name="dateAvailable" formatLength="medium"
label="Date" displayFormat="MM/dd/yyyy"
value="%{dateAvailable}" type="date"
cssStyle="border:1px solid #ccc; width:165px;" />

</div>
<div class="clear"></div>

<div class="formbox_in">
<s:select label="Work Permit Type" headerKey="Select" required="true"
headerValue="Select" name="workPermit"
list="{'Citizen','H1','F1-OPT','Other'}"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />

</div>
<div class="clear"></div>

<div class="formbox_in" style="margin-top: 20px;">
<%-- <s:select label="Status" headerKey="-1" headerValue="Any" value="-1"
name="status" multiple="true"
list="listOfStatus" listKey="statusName" listValue="statusName"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" /> --%>
<s:select label="Status" headerKey="-1"
name="status" multiple="true" value="%{statusMultiList}" required="true"
list="listOfStatus" listKey="statusName" listValue="statusName"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />
<%-- <s:select label="Status" headerKey="-1"
name="status" multiple="true" required="true"
list="listOfStatus" listKey="statusName" listValue="statusName"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" /> --%>

</div>
<div class="clear"></div>

<div class="formbox_in" style="margin-top:60px;">
<s:select label="Sourcer" name="sourcer" required="true"
headerKey="Select" headerValue="Select" list="listOfSourcers"
listKey="%{firstName+' '+lastName}"
listValue="%{firstName+' '+lastName}"
style="border:1px solid #ccc; background:#fff; width:165px; margin-left:10px;" />

</div>

<div class="clear"></div>


</div>

<div class="fields">
<h1>Resume</h1>

<div class="formbox_in">
<s:file id="upload_filename" name="upload_filename"
label="Resume " style="border:1px solid #ccc; margin-left:10px;" />

</div>
<div class="clear"></div>



</div>

</div>
<div class="clear"></div>
<div class="conbox">
<div class="formbox" style="width:54px; margin-top:15px;">
<input type="submit" name="submit" align="right" value="Save"
class="title_bg" style="width: 54px;" />
</div>
</div>
</div>

</div>

<div class="cont3"></div>
</div>
</form>
</body>
</html>






jatan bhavsar wrote:Hi Usha,

Can you post your whole jsp as i put the line you mention and it worked perfectly. Have you made any changes in default theme provided by struts as you have mention theme="simple" explicitly.

Regards
Jatan bhavsar

 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic