方法举例:如有不明可以Hi我,
$.ajax({
url: 'Default.cs?ID'+12,
type: 'post',
datatype: 'text',
success: function (returnValue) {
var frmData = $.parseJSON(returnValue)
$('#txtModelName').val(frmData.txtModelName)
$('#txtListingDate').val(frmData.txtListingDate)
$('#txtDelistingDate').val(frmData.txtListingDate)
$('#cbDelisting').attr('checked', frmData.cbDelisting == 'True' ? true : false)
}
})
<script type="text/javascript" src="javascript/setTab.js"></script>用这句话引用你的js代码不就看不到啦~ 其实你的问题我没看明白~ 如果你想在
页面中连调用的这句话都看不到 那就很难实现了 可以说是不可能实现了 js代
码放在一个文件里!如果想用到这段js代码~ 那就必需要调用它才行~那就用上面
的方法调用吧
还有一种方法~ 用动态网页做~ 这样源代码就看不到啦 只把执行结果发给了客
户端 其实一般js代码都不用隐藏的~ 不知道楼主的用意是什么...
在我们前端进行表单提交的时候,有时候会出现这种情况:Failed to convert java.lang.String to java.util.List
等等。
例如:
我后台定义一个对象:
examPaper 包含 String userId,Float userScore, MultipartFile examFile 用户id ,试卷分数,试卷文件
对象外面 classPaper有: String classId String className List<examPaper> examPaperList
这个时候,后台接收为 ClassPaper
如果按照平常的 form-data 提交 则应按以下方式提交:
let fd = new FormData()
fd.append("classId ",classId )
fd.append("className ",className )
examPaperList.forEach((item,index) ->{
fd.append("examPaperList["+index+"].userId",item.userId)
fd.append("examPaperList["+index+"].userScore",item.userScore)
fd.append("examPaperList["+index+"].examFile ",item.examFile )
})
以这种方式就可以实现 多附件 一一 对应提交。以避免对象转换错误问题。