aspose file tools*
The moose likes JSP and the fly likes How to use value from JSP to scriptlet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to use value from JSP to scriptlet ?" Watch "How to use value from JSP to scriptlet ?" New topic
Author

How to use value from JSP to scriptlet ?

John Santy
Greenhorn

Joined: Nov 03, 2011
Posts: 21
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

Joined: Jan 10, 2002
Posts: 61196
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Santy
Greenhorn

Joined: Nov 03, 2011
Posts: 21
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

Joined: Jan 10, 2002
Posts: 61196
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use value from JSP to scriptlet ?