Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将参数值从jquery函数传递到struts2 url标记_Jquery_Struts2 Jquery - Fatal编程技术网

如何将参数值从jquery函数传递到struts2 url标记

如何将参数值从jquery函数传递到struts2 url标记,jquery,struts2-jquery,Jquery,Struts2 Jquery,我试图从jquery函数传递参数。 一切正常,但唯一的问题是传递参数值rowObject。themeScreenshot <script type="text/javascript"> function formatLink(cellvalue, options, rowObject) { var para=rowObject.themeScreenshot; //here value is coming fine aler

我试图从jquery函数传递参数。 一切正常,但唯一的问题是传递参数值
rowObject。themeScreenshot

 <script type="text/javascript">
   function formatLink(cellvalue, options, rowObject)
     {    
        var para=rowObject.themeScreenshot; //here value is coming fine 
        alert("Json object value-"+para);  //correctly i am geting the value of para.
        return "<a style='cursor:pointer;' onClick='javascript:openDialog("+cellvalue+")'><img src='<s:url action='ImageAction' namespace='/myimage/secure'><s:param name='imageId'>"+para+"</s:param></s:url>'></a>";
     //this is returning url with empty imagId  output in url:-http://localhost:8080/visionbooks/myimage/secure/ImageAction?imageId=  
   }

函数formatLink(单元格值、选项、行对象)
{    
var para=rowObject.themeScreenshot;//这里的值很好
警报(“Json对象值-”+para);//正确地说,我正在获取para的值。
返回“+para+”“>”;
//这将返回url中带有空imagId输出的url:-http://localhost:8080/visionbooks/myimage/secure/ImageAction?imageId=  
}
我想要的是:-

http://localhost:8080/visionbooks/myimage/secure/ImageAction?imageId=anyvalue

但目前我得到的输出是:

http://localhost:8080/visionbooks/myimage/secure/ImageAction?imageId=“+para+”
变量名作为参数值传递。为什么


请帮助我解决此问题。

Struts 2标记
在第页渲染时进行评估,这远远早于脚本运行

如果您检查页面的源代码,您将看到这些标记已转换为常规html元素。因此,
para
javascript变量不会被计算

您可以尝试将返回行更新为

return "<a style='cursor:pointer;' onClick='javascript:openDialog("+cellvalue+")'><img src='<s:url action='ImageAction' namespace='/myimage/secure'></s:url>" + "?imageId="+para+ "'></a>";
返回“+”?imageId=“+para+””>;