This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How will I fetch Values textfield values in jsp ?

 
subbu grandhi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
subbu grandhi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am excepting value without submitting.
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic