Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to use HTML values in JSP

 
Jon Pepe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a problem using a HTML value in my jsp page.

It doesn't work. I tried to do this before:

But I can't use parseInt like this. Can somebody help me?

I have a list ("nodoak") object where I have my "nodo" objects, with some atributes. I want use that HTML value to show a nodo or another. And then I want to change the value of the HTML node and reload the page.
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you send the the value of your html element to your servlet via a get request and build your list there? Then display the list in the next view without conditional statements?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't do that. JSP knowns nothing about HTML or JavaScript which are interpreted on the browser after the generated page is formatted and sent to the client, So how could JavaScript be used on the server in the JSP code before it even exists?

Please read this article to understand how JSP operates and why that can never happen.

Then you can come back and describe what you are trying to accomplish (rather than how) and we can address how to best get it done.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic