File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sarah Choudhary
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • 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?

 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok then great.
But which technology/framework are you using?

 
Sarah Choudhary
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic