方式一:EL表达式
<input type="radio" name="sex" value="男" id="male" ${("男" eq sessionScope.blogger.sex)?"checked":"" } />
<label for="male">男</label>
<input type="radio" name="sex" value="女" id="female" ${("女" eq sessionScope.blogger.sex)?"checked":"" } />
<label for="female">女</label>
方式二:jsp传统方式
<%
Blogger blogger = (Blogger)session.getAttribute("blogger");
String sex = "";
if(blogger != null){
sex = blogger.getSex();
}
%>
<input type="radio" name="sex" value="男" id="male" <%= ("男".equals(sex))?"checked":"" %> />
<label for="male">男</label>
<input type="radio" name="sex" value="女" id="female" <%= ("女".equals(sex))?"checked":"" %> />
<label for="female">女</label>