• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use value from JSP to scriptlet ?

 
John Santy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64719
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64719
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic