Reputation: 10530
i have below code snippet in my jsp but it does not call addCustomer function.
<s:a href="javascript:addCustomer()">Add Customer</s:a>
Am i missing something in using s:a tag?
The html code generated coressponding to s:a tag is
<a href="javascript:addCustomer();" tabindex="-1">Add Customer</a>
Though when i use below code snippet javascript function gets executed. I am not getting whats the issue in using s:a tag?
<a href="#" onclick = "addCustomer();">Add Custome</a>
Upvotes: 3
Views: 6694
Reputation: 20741
try this..
<a href="#" onclick = "myfunction(12);">Click</a>
javascript function
function myfunction(var1)
{
var params =var1; //values for passing to struts if any
var resultStringX = $.ajax({
type: "POST",
url:"mystruts2action.action", // struts2 action call
data: params,
async: false
}).responseText;
resultStringX=$.trim(resultStringX); // the returning result will be stored in resultStringX variable
}
Upvotes: 1
Reputation: 2077
Try like these three..
1.
<s:url value="http://www.mkking.com" var="mkyongURL" />
<s:a href="%{mkyongURL}">J2EE web development tutorials</s:a>
2.
<s:a href="http://www.google.com">Google search engine</s:a>
3.
<s:url action="aTagaAction.action" var="aURL" />
<s:a href="%{aURL}">aTagAction</s:a>
Upvotes: 1