Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:59:31+00:00 2026-06-16T01:59:31+00:00

I am developing a web application using JSP and Servlets. In that application I

  • 0

I am developing a web application using JSP and Servlets.
In that application I have to show data from database table stud(studID, name, add) in html table, And each row in the table will have a hyperlink associated with it at the last column. After clicking on that hyperlink I wants to get the (studID) from the table…

so far I have done getting the data from database and then putting it into the column and then adding hyperlink for each row.. But I am not able to get the (studID) from the html table associated with hyperlink..

Thanks in advance….

Source code :

<% 
String[][] data = (String[][])request.getAttribute("data"); 
String[] cNames = (String[])request.getAttribute("columnNames"); 
//headings 
%> 
<table> 
<tr> 
<% 
for(int i=0;i<cNames.length;i++) { 
%> 
<th>
<%= cNames[i] %>
</th>
<% 
} 

//data if(data!=null) 
for(int i=0;i<data.length;i++) { 
%>
<tr> 
<% 
for(int a=0;a<3;a++) {
%> 
<td>
<%= 
data[i][a] 
%>
</td> 
<% 
//hyperlink 
if(a==2) { 
%> 
<td>
<a href="PlanProtocol" id=<%=i%> onclick="<% session.setAttribute("ID","p2"); %>" >Edit</a></td> 
<% 
} 
} 
%>
</tr> 
<% } %> 
<tr>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:59:33+00:00Added an answer on June 16, 2026 at 1:59 am

    You can pass the id as a query string in the url. Simply:

      <a href="myservlet?id=<%=stuid%>">My Link</a>
    

    Will work. But if you are using JSTL or another tag library then you can do something like this:

      <c:url value="/myservlet" var="myURL">
         <c:param name="id" value="1234"/>
      </c:url>
    
      <a href="<c:out value="myURL">mylink</a>
    

    And this has its advantages such as url encoding etc.


    So to add the id to the URL in your posted code you can:

      <a href="PlanProtocol?id=<%=i%>" >Edit</a>
    

    And the url will end up like this: PlanProtocol?id=1234.

    In the Servlet you can get the Parameter by:

       request.getParameter("i");
    

    However, as I mentioned above, you probably want to use a tag library like the JSTL rather than placing these scriptlets in your page. There are several advantages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web application using JSP and Servlets. I wants to call
I have 5 years of work experience in developing WEB and WIN application using
I am developing an ASP.Net MVC 3 Web application using Razor Views. I have
I am using Spring Web MVC and Hibernate for developing my application. My login.jsp
I'm developing a web application using c# to send and receive SMS from GSM
I'm developing a java servlet web application that manages information from multiple databases (all
I am developing a web application using zend framework. For select statements I have
we are developing a web application using MVC3 and VS2010. We have some pdf
we are developing a web application using MVC3 and Jquery. we have a situation
We are developing a web application using php/java servlets. i would like to pass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.