wood burning stoves 2.0*
The moose likes JSP and the fly likes How will I fetch Values textfield values in jsp ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How will I fetch Values textfield values in jsp ?" Watch "How will I fetch Values textfield values in jsp ?" New topic
Author

How will I fetch Values textfield values in jsp ?

subbu grandhi
Greenhorn

Joined: Jun 11, 2013
Posts: 22
Hi All,

might be this is a simple question,but still I didn't figured it out.

I have textfield with value "This is your Friend".I want display that textfield value using JSP inside same page.

I wrote the following code,but it's not working,it showing null



I will use that value in different ways,so I declared on variabale.

I hope,you understood what I faced .

Thanks
Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Hi,

Welcome to Ranch :)

For you to get the text field value in request paramter, the page will need to be submitted after which the container will include it as a request parameter.

What exactly is your flow? Are you submitting the page and expecting the value?


Regards,
Prajakta
subbu grandhi
Greenhorn

Joined: Jun 11, 2013
Posts: 22
I am excepting value without submitting.
Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Thats not possible.
If you are expecting any value while the page is rendered, you will need to have that value set in request scope and then access it in the page. E.g, if your URL is served by a servlet and the servlet forwards the request to JSP, the servlet will need to put that value in request.

subbu grandhi
Greenhorn

Joined: Jun 11, 2013
Posts: 22
@Prajakta Acharya Actually my textfield value defines the another JSP page name.this textfield value dynamically change based on database data.that's why I don't want to communicate with server.

is there any other way?

I tried like this also

t.jsp code



t1.jsp code:



even,this one also not working.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Please read this article to understand how JSP operates and why the JSP code can't get a value that won't be available until the future.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: How will I fetch Values textfield values in jsp ?