Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrive hidden value in a JSP variable of the same page?

Status
Not open for further replies.

Ajith2002

Programmer
Jul 16, 2002
30
US
Hello Guys,

In a jsp page, I have a hidden text box. I need to retrive that hidden value in a jsp variable.
Can anybody pls tell me how to do that, without submitting the form (or either method =post).

I tried using

request.getParameter("variable name");

But didnt worked out since, the page was not submitted.

Please HELP.

Thanks in advance.
Ajith
 
Try using a JavaBean, and then use the setPropety and getProperty methods.
 
Hi,

I have a hidden field called "hRank". And in "selectChange" function i am passing the index as a parameter, which is stored in "intSelectedValIndex" and storing it in "hRank", as shown in the function below.
Please tell me how to retrive that "hRank" value.
So that i can use that value instead of "3" which now i have hardcoded.
I dont want to reload the page.

"CaseType = CaseTypeLevel1List.getItem(3)"

I have pasted the same code below.

Regards,
Tina.


function selectChange(intSelectedValIndex,controlToPopulate)
{
window.document.form1.hRank.value=intSelectedValIndex;
var intRank = intSelectedValIndex;
var myEle;

<%
//String fid = request.getParameter(&quot;hRank&quot;);
//int id = Integer.parseInt(fid);


CaseType = CaseTypeLevel1List.getItem(3);
CaseTypeLevel2List = CaseType.getChildChoiceList();
if(CaseTypeLevel2List != null)
{
for(int nLevel2 = 1; nLevel2<= CaseTypeLevel2List.getCount(); nLevel2++)
{
%>

myEle = document.createElement(&quot;option&quot;) ;
myEle.value = &quot;<%=nLevel2 %>&quot;
myEle.text = &quot;<%=CaseTypeLevel2List.getItem(nLevel2).getTitle()%>&quot;
controlToPopulate.add(myEle) ;
<%
}
}
%>

}
 
I presume you're setting this attribute in the request prior to loading this jsp page. If you are then try using the request.getAttribute() method to read it. You don't need a hidden field unless you want to re-submit the value again via the next request.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top