• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts action class call from java script

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to call javascipt function to for the pop up to confirm to delet or not basically delete link is there and then need to call action class from java script.

Can anyone give me advice?

Thanks,
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Ajax if you don't want the page to be submitted otherwise you can also submit a form using javascript...
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
May be you can use Confirm dialog box that JavaScript provides to know user response like "Ok" or "Cancel".

Please see this link.


Of course if you still need to open a new browser window and then use some action to display "Ok, Cancel" buttons, you can do that using window.open() and passing the correct action URL as parameter. But unless specifically needed that would be too much for this kind of scenario.

Regards,
Amit

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply.

When we click ok on pop up after that we need call the action.

Could you please give me the solution for this?

Thanks,
Bachi
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dummu Bachi please check your private messages for some administrative matter...
 
Rishi Kanth
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the Struts URL tag.


then use the



 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sorry to ask you like this where can I find struts url tag?

I am new to struts that is why I am asking like this.

Thanks,
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "where can I find it"?

Which version of Struts are you using?
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using struts 1.2.

"where can I find it"?
I mean the uri to include in the JSP page.
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Thanks for your help. I am doing in the following way

function delete(num){

val confirmMessage = confirm("Do you want to delete ?");
if(confirmMessage){
document.form[0].action="/projectName/action.do?do=methodName&id="+num;
document.form[0].submi();
}
}

onclick="javascript:delete(1)"

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic