Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confirm message in JSP

 
nuthan kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to write a JSP code for the follwoing logic

int count = get from database
if(count <0)
{
show confirm message
if(true)
do something 1
else
do something 2
}

I tried like this
if( (mlMCOList != null) && (mlMCOList.size()>0) )
{
%>
<SCRIPT language=JavaScript>
var answer;
answer = confirm('Are you sure?');
alert(answer);
if(answer == true){
<%
System.out.println("yes");
%>
}
<%
}

but it is not working .. can any help me in this ..?

Thanks in advace
Nuthan
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't mix Java and Javascript in a JSP like that and expect it to act serially.

Please read this article to find out why.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic