Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP expression  RSS feed

 
Tina Desai
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a statment like
<input type="hidden" value="<%= 1 %>" in a jsp would it work? Does the expression result into
value="1" ?
what about
<input type="hidden" value="<%= null %>"
Im getting a numberformat exception at the page compile time
The error Im getting in the IDE is print(char[])method not found in JSPWriter.
Thank you for your help.
Tina
 
puma Linus
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<input type="hidden" value="<%= null %>"
It will not work b'coz only variable names can be given in <%= %>
U can simply give as
<input type="hidden" value=null >
for futher help try
http://lists.w3.org/Archives/Public/www-amaya/2002JanMar/0059.html
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will not work b'coz only variable names can be given in <%= %>

Incorrect.
The content of a scriptlet expression can be any Java clause that evaluates to a value.
What are you trying to accomplish by setting the value to null?
hth,
bear
 
Tina Desai
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to insert the 'input' tag programatically. And want the field to have null or constant value. Lets take the example of 1.
I want something like-
<input name= "ONE" type="hidden" value="1"/>
for value="1" this part, I am passing 1 and want it to be the value of ONE as it is.
Tina
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I think I see. You want to be able to make it so that you get a Java null from the input field in some circumstances?
If so, the only way to accomplish that is to omit the input field completely. There is no way to set a value in the "value" attribute that will turn into a Java null. The empty string is as close as you can get.
hth,
bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!