Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Conditional HTML in a JSP page?

207910Jul 28 2003 — edited Jul 28 2003
I've been scouring the help and web for about 2 hours and haven't found a way to do this yet.

What I'm trying to do is to conditionally generate attributes to a html tag via JSP, but everything I've tried (even stuff that's valid JSP) won't pass the JDeveloper HTML checks and it won't compile the JSP page.

Specifically, I'm trying to add a bgcolor attribute to a <tr> tag if conditions are met in data in the row, but everything I've tried to get the added data in the tag results in some error.

I've tried something like this in the HTML:

<tr <%= color %> >

and this from the java side:

if (rowCont > 20) {
out.prinln("<tr bgcolor=\"#c0c0c0\">);
}
else {
out.prinln("<tr>");
}

Both methods result in lots and lots of HTML errors and JDeveloper won't even compile the page. The hmtl way resutls in "name expected" errors, and the java way results in a bunch of "end tag doesn't match start tag" errors.

Any clues on ways to do this?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2003
Added on Jul 28 2003
2 comments
425 views