简体   繁体   English

如何使用从Javascript函数获得的数据填充JSP中的表单

[英]How do I populate a form in JSP with data obtained from a Javascript function

I have a working Javascript function manipulateData() in a some.js file. 我在some.js文件中有一个运行中的Javascript函数handlerData manipulateData()

I have included that JS file in info.jsp in head and also made it available on body load. 我已经将该JS文件包含在头部的info.jsp中,并且还使其在身体负荷时可用。 Within manipulateData() function, I have another function which returns that data which I want to use to populate that JSP form. manipulateData()函数中,我有另一个函数,该函数返回要用于填充该JSP表单的数据。

How can I invoke the function within a JS function from the JS file, in a JSP. 如何在JSP中从JS文件在JS函数中调用该函数。 Any help is appreciated. 任何帮助表示赞赏。

Not sure if this helps but ... 不确定是否有帮助,但是...

An inner function will only ever exist if its outer function is executed, and each execution of the outer function will create a fresh instance of that inner function. 内部函数只有在执行外部函数后才会存在,并且每次执行外部函数都会创建该内部函数的新实例。

An inner functions will cease to exist when the outer function completes unless a persistent reference to the inner function is kept, either : 除非保留对内部函数的持久引用,否则内部函数完成后,内部函数将不存在:

  • by assignment to a js var (or object property) in the outer function's outer scope (eg by having the outer function return the inner function), or 通过在外部函数的外部范围内分配给js var(或对象属性)(例如,通过使外部函数返回内部函数),或
  • by attachment to a DOM element as an event handler. 通过附加到DOM元素作为事件处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将动态创建的JavaScript表单字段中的表单数据接收到JSP中? - How do i receive form data from the dynamically created JavaScript form fields into JSP? 如何使用javascript将从html表单获取的值发布到URL? - How do I post values obtained from an html form to an URL using javascript? 如何使用 redux 中的数据填充表单字段? - How do I populate a form field with data from redux? 如何使用JSP中的数据填充全局JavaScript对象? - How can I populate a global JavaScript object using data from JSP? 如何使用从数据库中获取的数据填充 javascript 变量? - How do I populate a javascript variable with data fetched from a database? 我已经从我的jsp服务器中的android应用收到了HTTP POST,如何将数据传递到Javascript函数中 - I've received an HTTP POST from an android app in my jsp server, how do I pass that data into a Javascript function 如何使用从Reactjs中的fetch()获得的JSON数据填充引导网格? - How to populate bootstrap grids with JSON data obtained from fetch() in Reactjs? 如何使用jsp中的数据填充js数组 - How to populate js array with data from jsp 我该如何使用 <form> 标签将数据发送到javascript函数? - How do I use the <form> tag to send data to a javascript function? 如何将表单数据从一个jsp页面传递到另一个页面? - how do i pass form data from one jsp page to another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM