Forums de discussion

how to pass parameter using Resourceresponse from jsp to java page

thumbnail
Rewati Raman, modifié il y a 11 années.

how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 97 Date d'inscription: 24/02/12 Publications récentes
i have to pass two value from jsp to portlet class
using
<aui: input> and <aui:button>
and i want to retreive it in portlet class
as my basic requirement is to download a file as per the submited value on client side i am using resourceresponse
but i couldnt able to pass the value
i can able to pass using actionrequest but i wont able to use resourceresponse and viceversa

so pls give some suggestion im in need
thumbnail
David H Nebinger, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
Resource request does not receive the parameters from forms that the action request gets.

You'll have to manually build your parameters and append them to the resource request url.
thumbnail
Rewati Raman, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 97 Date d'inscription: 24/02/12 Publications récentes
sir,

if u hava any sample for that code then it would be very great for me because im stuggling to solve that issue


how should i use resourse response with action request
so that i could retreive value using actionresponse and and give the downloading popup to jsp page using resourceresponse
thumbnail
David H Nebinger, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
Two separate things. When you're within an action handler, you're not connected to a resource request.

Your page is the one that issues requests, so the page will have the urls for either the action or resource request.
thumbnail
Rewati Raman, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 97 Date d'inscription: 24/02/12 Publications récentes
thanks for response,

but is there any way that i could pass the values from jsp to filter the data and generate the file using resourseresponse
im not getting any solution for that
thumbnail
Amit Doshi, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Liferay Master Publications: 550 Date d'inscription: 29/12/10 Publications récentes
The code that I written above will pass the Value From jsp only.
Now what you need to do in the background, it depends on you. You can filter or Generate the file using I/O .
thumbnail
Amit Doshi, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Liferay Master Publications: 550 Date d'inscription: 29/12/10 Publications récentes
Hi Rewati,

The Below is the code for making the Call for ResourceURL with Javascript


<portlet:resourceurl var="SubmitURL" />
        <input type="text" name="txt1" id="txt1">
	<input type="button" onclick="helpful();" value="Submit">		 


On Button Click Call JavaScript Function as follows


function helpful()
{
var textvalue=document.getElementById('txt1').value;
	 $.ajax ({ 
		
		url:'&lt;%=SubmitURL%&gt;',
		type: 'POST',
		data : ({
			 textVal: textvalue
			 
			 }),
		 success: function()
		 {
			alert('success');
			 
		 }
	});
	
	
}


Now on the ServeResource method you can get the value using below code


final String textValue= resourceRequest.getParameter("textVal");



Your work is done now. You will get the Required Parameter using ajax.

Hope it helps.

Thanks & Regards,
Amit Doshi
thumbnail
Rewati Raman, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 97 Date d'inscription: 24/02/12 Publications récentes
Amit Doshi:
Hi Rewati,

The Below is the code for making the Call for ResourceURL with Javascript


<portlet:resourceurl var="SubmitURL" />
        <input type="text" name="txt1" id="txt1">
	<input type="button" onclick="helpful();" value="Submit">		 


On Button Click Call JavaScript Function as follows


function helpful()
{
var textvalue=document.getElementById('txt1').value;
	 $.ajax ({ 
		
		url:'&lt;%=SubmitURL%&gt;',
		type: 'POST',
		data : ({
			 textVal: textvalue
			 
			 }),
		 success: function()
		 {
			alert('success');
			 
		 }
	});
	
	
}


Now on the ServeResource method you can get the value using below code


final String textValue= resourceRequest.getParameter("textVal");



Your work is done now. You will get the Required Parameter using ajax.

Hope it helps.

Thanks & Regards,
Amit Doshi



thanks for ur response and ill try to implement it
thumbnail
Pradeep Kumar Badhai, modifié il y a 11 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 50 Date d'inscription: 06/09/11 Publications récentes
I am also looking for something similar to this problem: how to pass parameter using Resourceresponse from jsp to java page. I have also the same issue, I tried to mock the input value in JSP, It works. I am using Spring MVC portlet

<portlet:resourceURL var="JSPResourceURL">
<portlet:param name="system" value="APP" />
<portlet:param name="mngmtCo" value="NA" />
<portlet:param name="beginDate" value="01/01/2007" />
<portlet:param name="endDate" value="01/01/2013" />
</portlet:resourceURL>

5th request is in the dropdown list about kind of report, HTML / PDF / EXCEL

This works but this is just test for one set of input, Client cannot input the different record from screen. For this if any solution, Please let me know.

Thanks you in advance
Pradeep
Razeena P, modifié il y a 7 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

New Member Publications: 11 Date d'inscription: 08/08/16 Publications récentes
Hai Mr. Pradeep...

Even I'm facing the same problem . Did u fix this issue? If so can you please help to solve the corresponding.

Thank You in advance
Razeena P
thumbnail
Pradeep Sharma, modifié il y a 7 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

Junior Member Publications: 50 Date d'inscription: 06/09/11 Publications récentes
Hello,

function passParameterUsingResourceURL(parameter1, parameter2){

var pouupUrl = "<%=HtmlUtil.escapeJS( passParameterUsingResourceURL.toString()) %>" +"&<portlet:namespace/>parameter1=" + parameter1;

AUI().use('aui-base','aui-io-plugin-deprecated','liferay-util-window','liferay-portlet-url','aui-dialog-iframe-deprecated',function(A) {
popUpWindow=Liferay.Util.Window.getWindow(
{
dialog: {
centered: true,
constrain2view: true,
modal: true,
resizable: false,
width:860,
height:700,
}
}
).plug(
A.Plugin.IO,
{
autoLoad: false
}).render();
popUpWindow.show();
popUpWindow.titleNode.html("Copy Filter [" + parameter2 + "]" );
popUpWindow.io.set('uri',pouupUrl);
popUpWindow.io.start();
});
}

Hope this will give some idea how to pass parameter using ResourceURL.
Razeena P, modifié il y a 7 années.

RE: how to pass parameter using Resourceresponse from jsp to java page

New Member Publications: 11 Date d'inscription: 08/08/16 Publications récentes
Thanks for your reply....Its working fine