Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic Variable Declaration or get values

 
Sankar Nadar
Greenhorn
Posts: 3
Chrome Safari Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am New for JSP. I tried some code but it not works.. can you please help me or atleast confirm is that possible or not.




Hope most of them understood my problem.
Actually the issue is i want to get the value "Oldopprice1(10)" instead of "Oldopprice1"..
Is that possible or is there any other way to get that.
Thanks In Advance.

Regards,
Sankar
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are new to JSP you should be made aware that putting Java code into a JSP is an obsolete and discredited practice since 2002 when JSP 2 was introduced. You should be using the JSTL and EL in your pages, not Java scriptlets.

I also recommend that newcomers to JSP read the following articles:
  • The Secret Life of JSPs
  • The Front Man


  • And to answer your question: no you cannot reference scripting variables by creating their names at run-time. This is possible, however, using the more modern EL with scoped variables.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic