This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes request.getparametervalues is giving null in JSp page in portlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "request.getparametervalues is giving null in JSp page in portlets" Watch "request.getparametervalues is giving null in JSp page in portlets" New topic
Author

request.getparametervalues is giving null in JSp page in portlets

Malik Ehsanullah
Greenhorn

Joined: Feb 23, 2009
Posts: 2
Hello All I am new to Portlet development

my jsp page is like this

<form action="<portlet:actionURL></portlet:actionURL>"
method="GET">
<input type="button" name="querybutton" value="CE" onclick="fillCEAttribute()"/>

<input type="button" name="querybutton" value="SE" onclick="fillSEAttribute()"/><br><br>

<select multiple="3" size="5" name="attributelist" id="attributelist">
</select><br><br>
<input type="submit" value="Get Attribute" name="name" />
</form>
<%
String list[]=request.getParametervalues("attributelist");
out.print(list[0]);
%>


But it is giving out.print(list[0]) it is giving null please help

Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
What does this one do? Can you post the javascript code for it here?


“Everything should be as simple as it is, but not simpler.” Albert Einstein
Malik Ehsanullah
Greenhorn

Joined: Feb 23, 2009
Posts: 2
<html>
<head>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.io.*"%>
<%-- Uncomment below lines to add portlet taglibs to jsp
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />
<%PortletPreferences prefs = renderRequest.getPreferences();%>
--%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
<script language="JavaScript" type="text/JavaScript" >

var ceattribute= new Array("WorstRespTime","CEAppDir","TotalCPUs","MaxRunningJobs","CE","WaitingJobs","MaxCPUTime","LRMSVersion","MaxTotalJobs","CEStatus","LRMS","CEVOs","AssignedJobSlots","FreeCPUs","RunningJobs","EstRespTime","FreeJobSlots","Cluster","TotalJobs","Priority","CEDefaultSE","JobManager","MaxWCTime","CloseCE","CloseSE","SMPSize","Processor","OSVersion","VMemory","CFP2000","TmpDir","OSRelease","ClockSpeed","LogicalCPU","OutboundIP","OS","Tag","CINT2000","WNTmpDir","CPUVendor","PhysicalCPU","InboundIP","Memory","VORunningJobs","VOTotalJobs","VOWorstRespTime","VOEstRespTime","VOCEVOs","VOFreeJobSlots","VOWaitingJobs");

var seattribute= new Array("AvailableSpace","Path","SEVOs","UsedSpace","SESite","SEType","SEArch","SEName","SE","Protocol");
var buttonselected="ce";
function fillCEAttribute()
{
document.getElementById('attributelist').length = 0;
buttonselected="ce";
for (var i=0; i < ceattribute.length;++i)
{
if(i==0)
addOption(document.getElementById("attributelist"), ceattribute[i], ceattribute[i],true);
else
addOption(document.getElementById("attributelist"), ceattribute[i], ceattribute[i],false);
}
}

function fillSEAttribute()
{
buttonselected="se";
document.getElementById('attributelist').length = 0;
for (var i=0; i < seattribute.length;++i)
{
if(i==0)
addOption(document.getElementById("attributelist"), seattribute[i], seattribute[i],true);
else
addOption(document.getElementById("attributelist"), seattribute[i], seattribute[i],false);
}

}
function addOption(selectbox, value, text,selected)
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
optn.selected=selected;
selectbox.options.add(optn);
}
function showAttribute()
{

}
</script>
</head>

<body onload="fillCEAttribute();">
<!--<form action="<portlet:actionURL><portlet:param name="page" value="Helloworld2.jsp"/></portlet:actionURL>"-->
<form action="<portlet:actionURL></portlet:actionURL>"
method="GET">
<input type="button" name="querybutton" value="CE" onclick="fillCEAttribute()"/>

<input type="button" name="querybutton" value="SE" onclick="fillSEAttribute()"/><br><br>

<select multiple="3" size="5" name="attributelist" id="attributelist">
</select><br><br>
<input type="submit" value="Get Attribute" name="name" />
</form>
<%
String list=request.getParameter("attributelist");
out.print(list);
%>



</body></html>
saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
As far as Lifery is concern . Your Form method should be POST . So just try keeping your form method as Post and try . []

Cheers,
Saumil
 
jQuery in Action, 2nd edition
 
subject: request.getparametervalues is giving null in JSp page in portlets
 
Similar Threads
Problem with multiple variable declaration
Passing data to and from a jsp page
checkbox and select
Scope of Request across jsp pages in a web app
radio button error problem?