Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/420.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
Javascript 无刷新页面的portlet jsp自动提交表单_Javascript_Jsp_Portlet - Fatal编程技术网

Javascript 无刷新页面的portlet jsp自动提交表单

Javascript 无刷新页面的portlet jsp自动提交表单,javascript,jsp,portlet,Javascript,Jsp,Portlet,在jsp页面中,我有以下表单: <form name ="form1" id="form1" method="post" action=portlet:actionURL name=acao input type="text" name="data" id="2"> 我正在使用document.getElementById(“1”).submit();要自动提交表单,但它会自动刷新所有页面,但我的目的是在不刷新所有页面的情况下自动提交。在提交时,您需要进行Ajax调用,并在port

在jsp页面中,我有以下表单:

<form name ="form1" id="form1" method="post" action=portlet:actionURL name=acao
input type="text" name="data" id="2">

我正在使用document.getElementById(“1”).submit();要自动提交表单,但它会自动刷新所有页面,但我的目的是在不刷新所有页面的情况下自动提交。

在提交时,您需要进行Ajax调用,并在portlet类中覆盖ServerSource

在jsp或java脚本中,您可以通过以下方式获取资源url

<portlet:resourceURL var="resourceURL">  
 </portlet:resourceURL> 
<portlet:resourceURL var="resourceURL">  
 </portlet:resourceURL> 
@Override  
          public void serveResource(ResourceRequest resourceRequest,  
                    ResourceResponse resourceResponse) throws IOException,  
                    PortletException {  


     // do your stuff here

     }