Search code examples
htmljspscriptlet

Why is this scriptlet code being shown on HTML page?


enter image description here

For the code given below, I have this value=""> being shown on the HTML page as shown above. Any suggestions on how to fix it?

<td class="data" align="left" valign="middle" width="80%">
    <input type="text" name="CMD" size="20" maxlength="16"
    <% if ( retrieveXMLCommand.cmdNumber.length() > 0 ){%>
        value="<%=retrieveXMLCommand.cmdNumber%>">&nbsp;
    <%}else{%>
        value="">&nbsp;
    <%}%>
</td>

HTML as seen on the page running it

<td class="data" align="left" valign="middle" width="80%">

    <input type="text" name="CMD" size="20" maxlength="16">

    value="">&nbsp;

</td>

I don't know if this has anything to do with different server versions. This code is running on WAS 8.5 server but when it runs on WAS 6.1, the value=""> is not shown on the page. Strange!

Update:

There was nothing wrong with the above code. It was a WebSphere issue which was picking up the older version of the file. Rebuilt and redeployed and it was all good!


Solution

  • In this case there was nothing wrong with the above code. It was a WebSphere issue which was picking up the older version of the file. I rebuilt and redeployed and it was all working fine!