File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Joined: Jun 29, 2009
Jun 29, 2009 02:01:53
This code is working ok. But when I replace int with
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<input type="text" id="aa" onclick="alert(<%=i%>);" />
// <input type="text" id="aa" onclick="alert(<%=str%>);" /> this is not working
This code is working ok . But when I replace i with str [for eg alert(<%=str%>)] this shows str is not defined. But this code is working ok with i [integer value]
Joined: Apr 22, 2006
Jun 29, 2009 03:50:26
In the case of Integer, you are passing the int value which is a number.
In the case of String, you are passing the runtime value which is some text representation.
The alert() function doesn't know how to interpret the text value unless its a String,
However to get it to work you will have to enclose the value in single quotes.
You can investigate this further by viewing the source of the JSP file from within the browser.
Joined: Sep 29, 2008
Jun 29, 2009 05:44:24
Don't get me started about those stupid
Sending checkbox value to two different servlet page
Get Rows from a Table
how to create a table through ajax dynamically
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015