Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drag and drop dynamic elements

 
Stevenson Anderson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to coding. I am working for a production of reporting tool. So in a web page the left panel displays all the available tables in the database. The user must drag any one of the tables,then it must display the columns available in the dragged table. I could able to display the tables from database. For drag n drop, I have used jquery. The script code I have used is given below.

This is the java code written in body.

Here '#makeMeDraggable' is the division where the table names are displayed and '#makeMeDroppable' is the division where the user drop the table. tables is an arraylist variable which contains the table names.
The problem here is after all excuting this, I could able to drag only one table name (the top in the list) and the variable 'str' always contains the last table name only.How can i make all the individual table names draggable and 'str' store only the table name which is being dragged.
I am 'sorry' for the lengthy code but i just want to let you know what i am doing.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. str is a server-side JSP scripting variable and doesn't even exist anymore after the page has been sent to the browser.

You should read this article to understand how JSP works and why this is impossible.

P.S. Putting Java code in a JSP has not been an accepted practice for almost 10 years now.
 
Stevenson Anderson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear!The article was great.
But suggest me the ways how can I make it possible?(Hope you understand what I need to do, from the previous post of mine)

Thanks again.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, sorry. But I do not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic