• 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 use value from JSP to scriptlet ?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have JSP with the following content.

<tr>
<td>Please Enter name: <input type = "text" name = "name" value = ""></td>
</tr>

<tr>
<td>Please Enter Place: <input type = "text" name = "place" value = ""></td>
</tr>


I have also scriptlet on the same JSP. I would like to use the value of "name" and "place" within my scriptlet. Basically, to use them as a parameter to call a java function. Could you please let me know how to achieve it?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where will these values come from? Input from the user?

If so, please read this article to find out why that is impossible.

Also, this is 2011 -- scriptlets have been discredited for almost 10 years now. More than passed time to move on and use modern techniques such as the EL and JSTL.
 
John Santy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Thanks for the reply.

I'm a newbie :)

Ok, I will read about EL and JSTL.


Thanks again!


Bear Bibeault wrote:Where will these values come from? Input from the user?

If so, please read this article to find out why that is impossible.

Also, this is 2011 -- scriptlets have been discredited for almost 10 years now. More than passed time to move on and use modern techniques such as the EL and JSTL.

 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's much more than just scriptlets vs. JSTL/EL. Your question shows that you do not understand the lifecycle of a JSP, and it's important that you do. Read the article carefully.
 
reply
    Bookmark Topic Watch Topic
  • New Topic