473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

when i click on each of the links i want it to traverse to the same jsp page but sho

Hey dude...

need one help plz...

I have one jsp page and a html page.
in a html page there are 3 different links.
when i click on each of the links i want it to traverse to the same jsp page but should display different values.

i.e. when i click on 1st link it should fetch some value from database and display it on the jsp page, Similarly when clicked on 2nd link it should fetch some different value from database and display it on the same jsp page...


how do I do this????? plz help.. plz..
Dec 25 '10 #1
2 1902
AutumnsDecay
170 100+
You could have your HTML pages have variables in the link location, example:

Expand|Select|Wrap|Line Numbers
  1. <a href="page.jsp?action=1" target_self">First link</a>
On your JSP page, using javascript you could have a link this:

Expand|Select|Wrap|Line Numbers
  1. function gup( name )
  2. {
  3.   name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  4.   var regexS = "[\\?&]"+name+"=([^&#]*)";
  5.   var regex = new RegExp( regexS );
  6.   var results = regex.exec( window.location.href );
  7.   if( results == null )
  8.     return "";
  9.   else
  10.     return results[1];
  11. }
  12.  
Then all you would have to do is tell the script to look for the 'action' variable in the url. This is achieved by doing:

Expand|Select|Wrap|Line Numbers
  1. var action = gup( 'action' );
  2.  

If you want to use a bit of PHP, you could simply use the $_GET function. Example:

Expand|Select|Wrap|Line Numbers
  1. $action = $_GET['action'];
  2.  
  3. if($action == "1"){
  4.     $query = "SELECT.........";
  5.     MORE CODE
  6. }
  7.  
  8. else if($action == "2"){
  9.     $query = "SELECT.........";
  10.     MORE CODE
  11. }
  12.  
  13. else if ($action == "3"){
  14.     $query = "SELECT.........";
  15.     MORE CODE
  16. }
  17.  
Dec 25 '10 #2
Thnaks a lot for your help. It worked perfectly.

I need another help.

I have a database where I have stored images and I am retreiving them using jsp and displaying on a webpage.
But the problem is I am not getting how to set the size of the image. Plz help.
Jan 1 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: msnews.microsoft.com | last post by:
Hello! I'm Jim by asp How can show "abc" in textbox when click one botton?
1
by: Erik | last post by:
Hello, I have a page with about 100 links in the form of thumb nails that open a small html page. It took a lot of time to define each link and I sure do not want to go though that again. I...
1
by: Scott Navarre | last post by:
Hello, I have noticed that when using JavaScript to create a page, the sizes of the text input form elements come out bigger than the size I am trying to set them to. I don't know if it...
33
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but...
4
by: Sarvesh997 | last post by:
Hi, I have one problem regarding search & search results page in IE & Firefox. A code in both pages written in Php & database in MySQL Problem : When i selected one or more checkbox &...
1
by: rkvausi | last post by:
Hi All, Is anybody can help me to find out relation between click once application and web page? I opened one window application from my web page and i want that as soon as I closed that application...
1
by: =?Utf-8?B?TmFt?= | last post by:
ASP.NET 1.1.4322 Server1: Windows Server Enterprise Ed 2003 – SP2 Server2: Same as Server 1. IE 6.0 –SP2 After we migrated our website from server1 to server2 everything works fine accept...
1
by: ahmurad | last post by:
Dear Brothers / Xperts, I need to count time of a page upto click submit. When the user just enter the page the timer / start time is tracked . When the user submit the form then the end time is...
2
by: Alexander Vasilevsky | last post by:
How programmatic to click the button on the page? http://www.alvas.net - Audio tools for C# and VB.Net developers
0
by: abdulazees | last post by:
when click button i want to print autometicaly reportveiwer data, i not need to show reportviewer.
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.