日期:2014-05-16  浏览次数:20365 次

struts2中js中的值如何传给action急!!
在页面的js中写了一个方法
JScript code

function getRadio(){

    $(document).ready(function(){

    $('#tab input').each(function(){
        var a = $(this).is(':checked');
        if(a){
            var Objmsg = $(this).parent().nextAll('td:first');
            Objmsg.each(function(){
            msgid=$(this).text();
        });
        alert(msgid);
    }
    });
    });
}


在页面的一个from中调用这个function
HTML code

<s:from action="gotoupdate" theme="simple" id="updatemessage">
<s:iterator value="#request.pmlist" status="st" id='listid'>
                        <tr  class="a1" style="border-bottom: 2px solid #9AC3E3;">
                        <td width="21px"><input name="radio" type="radio" value=""/></td>
                        <td width="22px"><s:property value="msg_id"/></td>
                        <td width="80px"> <s:property value="stype"/></td>
                        <td width="80px"><s:property value="lan"/></td>
                        <td width="52px"><s:property value="msg_type"/></td>
                        <td width="250px"><s:property value="question_describe"/></td>
                        <td width="250px"><s:property value="question_analyse"/></td>
                        <td width="275px"><s:property value="answer"/></td>
                        <td width="49.5px"><s:property value="ur_id"/></td>
                        <td width="58.5px"><s:property value="question_type"/></td>
                        <td width="70px"><s:property value="question_person"/></td>
                        <td width="70px"><s:property value="phone"/></td>
                        <td width="60px"><s:property value="begin_time"/></td>
                        <td width="60px"><s:property value="by_person"/></td>
                        <td width="60px"><s:property value="iphone"/></td>
                        <td width="60px"><s:property value="end_time"/></td>
                        <td width="54px"><s:property value="by_system"/></td>                        
                        <td width="58px"><s:property value="question_emergency"/></td>
                        <td width="58px"><s:property value="responsibility"/></td>
                        </tr>    
                    </s:iterator>
                    <input  type="submit"  id="updatemsg"   onclick="getRadio();" 

style="width:80px;position:absolute;top:485px;left:290px" value="处理">
</s:form>            



目的是得到我选中的单选框的那条记录中的第一个值,也就是页面元素msg_id的值。
现在使用这段js代码可以得到,但是我现在要把这个值传入到后台的action里面去处理,请问怎么做!

------解决方案--------------------
<s:from是什么东西?做事认真一点嘛。可以把脚本中的值放到表单隐藏域中一起提交。