• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set table values as parameters (present on one page) and pass it into another jsp

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi


I'm getting list of values from database and printing this list in a table on a jsp like this


courseId CourseName GPA


part of the code is:




Now, I want to add 'edit functionality' for course instructor. A hyperlink with text 'edit' will be present on this page while the edit functionality will be on another page. If instructor wants to edit a particular record, he may click on it and he will be redirected to a new page where the clicked record's values will be automatically shown through get parameter. e.g. a student has taken several courses and the instructor want to edit the record of a particular course, when he clicks on that record, all the three parameters should be set and get into the next jsp.

can anybody help me in this regard?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For implementing edit functionality you shouldn't pass params from one page to another. Its bad programming.
Infact you should create new jsp for editing record and new action for edit and just pass id of the entity which needs to be edited.

Which technology/framework are you using?

Refer to some CRUD operation sample before you proceed ahead with your application. That will help you.

Thanks,
Ashwini Kashyap | www.infocepts.com
 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashwini Kashyap wrote:For implementing edit functionality you shouldn't pass params from one page to another. Its bad programming.
Infact you should create new jsp for editing record and new action for edit and just pass id of the entity which needs to be edited.


| www.infocepts.com



I am trying to do the same thing. There is a new jsp for editing the record. I just want to get id and gpa of that student which is clicked by the instructor. That's what I want to get.



 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok then great.
But which technology/framework are you using?

 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashwini Kashyap wrote:Ok then great.
But which technology/framework are you using?



Actually, This code is the part of webservice and JSPs are basically built on servlets.


I am using NetBean IDE 7.2 for this.
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.
Create action of your edit hyperlink and make use of query string like:
editActionName?studentId=--&gpa=--

Thanks,
Ashwini
 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashwini Kashyap wrote:Ok.
Create action of your edit hyperlink and make use of query string like:
editActionName?studentId=--&gpa=--

Thanks,
Ashwini




Ok, I have tried but I am getting error. As I have mentioned earlier that parameters will be set from the table row which is clicked.

The error is on the "edit.jsp", it returns null value. I think, the problem lies in the setting the attributes. Since I am printing the ArrayList through iterator so string query is unable to understand which row data is clicked.
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In that case, what you can do is:
With the help of JavaScript or JQuery, on the click of that edit link, pass the id and so on params and then submit the form to the server.

Go through some examples of JSP, Servlets and JavaScript/Jquery CRUD examples it will help you.

Thanks,
Ashwini Kashyap | www.infocepts.com

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic