Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I pass a variable from one jsp to another?  RSS feed

 
Bradly Fackrell
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example: Say I've set the ID of btnDelete equal to the variable custID. When I click btnDelete I'd like to push that variable to the next page.



To shed some light on why I'm not simply using request.getParameter: I'm filling a table with data from a database (Something similar to a data grid in ASP.NET) One of my columns has a 'Delete' button; when I select any given delete button I want to delete that row of data. This is how I've built my table:

So while I build my table I can set the custID variable to something like the id of the 'Delete' button or in a hidden text box.

I don't know, maybe this is all real "Hokey" but it's the best that I can come up with....
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put a hidden input with the value in the form.

Two other things:
  • Putting a button inside a label is really weird.
  • Java in a JSP is a very very poor practice that's been discredited for almost 10 years now. Time to get down with modern techniques...

  •  
    Bradly Fackrell
    Greenhorn
    Posts: 13
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Bear Bibeault wrote:
  • Java in a JSP is a very very poor practice that's been discredited for almost 10 years now. Time to get down with modern techniques...



  • Scarry since that is how my instructor is teaching it....

    Anyway, I've been working on this to the point where I can't think straight. From what I've read; it seems like I should be doing this through a function but I haven't been able to put that together.
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Posts: 65826
    134
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Bradly Fackrell wrote:Scarry since that is how my instructor is teaching it....

    oi!

    Oh well, when you're out on your own, know that things have moved on quite a bit...

    From what I've read; it seems like I should be doing this through a function but I haven't been able to put that together.

    Can't think of any reason that you need anything but a hidden input.
     
    Bradly Fackrell
    Greenhorn
    Posts: 13
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't know why I was fighting the hidden field route. After some sleep I tried that again with success.

    Thanks Bear!
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!