Two Laptop Bag*
The moose likes Struts and the fly likes Calling Action method using struts-tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling Action method using struts-tags" Watch "Calling Action method using struts-tags" New topic
Author

Calling Action method using struts-tags

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Could anyone tell me how you can call a specific method from an Action using the struts tags?

I have
<%@ taglib prefix="s" uri="/struts-tags" %>
in my JSP and was looking for something like s:link or s:button to call a specific method from the action (say UserAction.edit() or UserAction.delete()) but can not find anythign that works.

Cheers in advance

KS
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

I think you are using Struts 2. In struts 2, while you define an action in your struts.xml file, you can also give the method that you want to be called. So you can define more than one mapping for your action that will call different methods...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The <s:url> tag has a "method" attribute.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling Action method using struts-tags
 
Similar Threads
How to forward radio button input from one jsp to another?
Benefits of using JSF over struts
how to call a specific action
Getting values from properties in validate-using multiple message-resources in struts
html:submit Vs html:cancel buttons