Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem Div tag with If()  RSS feed

 
mamidi venkat
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ALL

here unable to use if () in the div tage .can i use if () in the div tage or not.please give me solution for this......here is the code




<%if(Policy.equals>ignoreCase("A&B")){<%;
<div id='CitizenNo' style="display:block">
<table width="90%" border='0' align="center" cellspacing=0 cellpadding=0>
<TR>
<TD class="tColTitle1" style="width:200px" align="right" nowrap>Tape To Be Inserted    : </td><td>
<select class="mediumCombo" name="Inserted" style='width:150px'>

<option value=''></option></select>
</TD>
</TR>


<TR><TD class="tColTitle1" style="width:200px" align="right" nowrap>Edit Bar Codeeee  : </td>
<td><input type="text" name="Barcode" value=""></td>
</TR>



</table>
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that the exact code you are using? If so, looks like you have an error. Along with the missing closing } and closing div tag.

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JSP forum since it is not an HTML issue.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66198
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you encounter an error like this, you can be sure that it has nothing to do with the HTML since to a JSP, that's all just template text.

As Eric pointed out, the first thing to do is to check your syntax.
 
mamidi venkat
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply


My syntax is correct MY Q is can use If() in and Above the div tag
iam getting error div is not working if iam use'g if() there.how to slove this isuue


<%if(){%>
<div id='CitizenNo' style="display:block">

<table width="90%" border='0' align="center" cellspacing=0 cellpadding=0>


<TR>
<TD class="tColTitle1" style="width:200px" align="right" nowrap>Tape To Be Inserted (B)    : </td><td>
<select class="mediumCombo" name="Inserted" style='width:150px'>

<option value=''></option></select>
</TD>
</TR>


<TR><TD class="tColTitle1" style="width:200px" align="right" nowrap>Edit Bar Code (B)  : </td>
<td><input type="text" name="Barcode" value=""></td>
</TR>
<%}%>
</table>
</div>
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, first of all, you're not 'using if in the div tag'. It doesn't matter what you put around the scriptlet as long as the whole JSP can be translated and compiled as a valid servlet with legal Java code.

The text around the scriptlet could simply be plain text without HTML markup and that would also work; it follows the basic syntax of:



The template text could be absolutely anything, it doesn't matter to the scriptlet code.

Now, to your problem. You haven't specified what the problem is, yet. You only say you're unable to use if with the div tag which obviously isn't a problem as explained above. So what do you expect to happen and what actually happens?

And your code that you've posted has changed between the first and second posts which means that you're either modifying the code ( incorrectly ) or you're paraphrasing and not posting the exact code. Please, always copy-paste your original code since if you just type it out you run the risk of hiding your errors and masking mistakes.

As of now, the last code posted has this:


You're closing the <table> and <div> outside of the if block which means that these tags will always be printed. Not that it makes much difference to the page rendering ( unless you have tables/ divs above this level ) but it makes your whole code suspect. So you'll have to be clear with both, the code you're posting as well as your actual problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66198
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mamidi venkat:
My syntax is correct ...

Your syntax is far from correct if what you have posted accurately represents your code. Your JSP syntax is wrong and your HTML is malformed.

If you are not posting your actual code, you are just wasting our time.
[ October 23, 2007: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mamidi venkat:
My syntax is correct MY Q is ....


Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UseRealWords


Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!