aspose file tools*
The moose likes JSP and the fly likes Passing Parameters between the tabs in single JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing Parameters between the tabs in single JSP" Watch "Passing Parameters between the tabs in single JSP" New topic
Author

Passing Parameters between the tabs in single JSP

Shashi karnati
Greenhorn

Joined: Feb 17, 2011
Posts: 3
HI , Here my problem is i am using tabs in jsp,
and i am using the <a href="#another_tab?id=1"></a>
this going to another tab, but in another_tab
trying to get request.getparameter("id") is not writing any return ?
Please help me out.

My code is :
<ol id="toc">
<li><a href="#query_list"><span>Query List</span></a></li>
<li><a href="#query_desc"><span>Compose Query</span></a></li>
<li><a href="#statistic_report"><span>Statistic Report </span></a></li>
</ol>

<div class="content" id="query_list">
<a href="#query_desc?id=-1&page=query_desc">To Compose New Query </a>
</div>
<div class="content" id="query_desc">
<% int id = 0;
if (request.getParameter("id") != null ) {
id = ParamUtil.parseInt(request.getParameter("id"));
}
%>
</div>

Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
As far as I understood you have only one JSP and you are not submitting it, right? So you are not throwing a request and you don't get any value from it, it seems logical to me.

Can you put all your JSP? And please surround your code with [code] [/code] tags
Shashi karnati
Greenhorn

Joined: Feb 17, 2011
Posts: 3
Yes Albert,
you are right, these all present in one jsp,
and Here actually my mistake is passing value through anchor tag sooo.. its making new request.
here i need to use the <forward> method.
kindly help me ..
my code is :

Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
As far as I know, and maybe I am wrong, when you click a link to an anchor in your same page via #myAnchor you don't submit the page, it's just a way of telling the browser that it has to scroll to that place. Maybe I am wrong but I think this is what happends in that situation.
Shashi karnati
Greenhorn

Joined: Feb 17, 2011
Posts: 3
Yes your right... as mentioned earlier my mistake wass...
here it's not creating a request with id, it's just passing control to the next tab.

Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
But you don't 'pass' anything, you have everything in your HTML at that time so you should get a way of getting the id from the link you have clicked in, you can invoke a function in the anchor and set a global js variable with the id, then pick it in the form, but I find this a bit weird, I cannot think now of a cleaner solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing Parameters between the tabs in single JSP
 
Similar Threads
Can't get to the bean methods
Multiple jQuery accordions?
request.getAttribute returning null
Ajax code getting null value
scroll bar down