开发者

jsp page javabean dialog box

I have this:

<% if (nameBean.getTxnType().equalsIgnoreCase("Update"))
   { %>
    <TD><B>Gender: </B></TD>
    <TD><INPUT TYPE=TEXT NAME="tbGender" 
               VALUE="<%= nameBean.getGender()%>" MAXLENGTH=1 SIZE=3 ></TD>
<% if (nameBean.getGender() == nameBean.setGender())
{ %>

<s开发者_JAVA技巧cript type="text/javascript"> 
alert("Alert Box"); 
</script> 

<% } %>

How can I compare setgender's value to textbox's new gender value and have a dialog box that says gender already exits do you want modify to different one (Y/N) and do the necessary task. How can I make jsp value talk with JavaScript? How is this possible?


You don't need JavaScript. You need to look into JSLT and pass beans so that you can read them by using ${object.Property} notation. This notation will allow you to use for-each loops, conditional statements etc.

Your (nameBean.getGender() == nameBean.setGender() doesn't make sense as getGender() returns true/false and setGender() is a mutator, hence it doesn't return anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜