noijet
asked on
Am I doing this JSP custom tags right ?...
Hi, I am new to JSP Custom Tags and I'd like to know if I am using it correctly. I'd like to converting code#1 into code#2 (code provided below for reference) using JSP custom tags, am I doing it correctly or is there a better way?
Any suggestions or tips would be greatly appreciated!
Thanks, noijet
***** code#1 (Inside a jsp)*****
<%
if(loginBean.isDualLogin() ) {
%>
...Some HTML code....
else{
%>
...Some other HTML code....
<%
}
%>
***** code#2 (Inside a jsp) *** Is this correct ? *****
<control:conditional condition="user.isAdmin">
...Some HTML code....
</control:conditional>
<control:conditional condition="<%=(!user.isAdm in)%>">
...Some other HTML code....
</control:conditional>
***** Java tag handler *****
public int doStartTag() throws JspException {
if(condition) {
return EVAL_BODY_INCLUDE;
}
return SKIP_BODY;
}
Any suggestions or tips would be greatly appreciated!
Thanks, noijet
***** code#1 (Inside a jsp)*****
<%
if(loginBean.isDualLogin()
%>
...Some HTML code....
else{
%>
...Some other HTML code....
<%
}
%>
***** code#2 (Inside a jsp) *** Is this correct ? *****
<control:conditional condition="user.isAdmin">
...Some HTML code....
</control:conditional>
<control:conditional condition="<%=(!user.isAdm
...Some other HTML code....
</control:conditional>
***** Java tag handler *****
public int doStartTag() throws JspException {
if(condition) {
return EVAL_BODY_INCLUDE;
}
return SKIP_BODY;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you searlas. So if I had to include that else condition to that "if" custom tag already existing, I would do it the way I stated above(code#2)?
Thanks so much,
noijet
Thanks so much,
noijet
ASKER
Thank you both for your excellent comments and code !
Thanks again,
noijet.
Thanks again,
noijet.
ASKER
I think:
EVAL_BODY_INCLUDE: Means to evaluate the body
SKIP_BODY: Means to 'done', skip body evaluation.
Thanks so much,
noijet.