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
generate tag ids dynamically
Joined: Jan 12, 2013
Jan 12, 2013 05:46:38
I am new Please hellp !!!
can we use something like
y is a variable
out.println(<input type=/'text/' id=/'name"+y+"/'>);
out.println(<input type=/'text/' id=/'name<%=y%>/'>);
Please reply soon. Thanks in Advance
Joined: Nov 21, 2010
Jan 12, 2013 06:08:05
Please do you the code tag when putting any code.
Regarding the question.
out.println("<input type='text' name='t'"+y+ " id='t'"+y + "/>")
OR if using the " (double quotes to given the value to properties) then
out.println("<input type=\"text\" name=\"txt\""+y+ " id=\"txt\""+y + "/>")
Note the use of escape sequence \ (its not /)
If you are wrting in
then you can also use
<input type='text' name='txt<%=y %>' id='txt<%=y %>' />
SCJP 5.0 OCBCD 5.0(Formerly SCBCD)
Author and ninkuma
Joined: Jan 10, 2002
Jan 12, 2013 11:40:31
Why are you using out.println in the first place? That's really strange. The whole point of a JSP is
to have to create HTML in strings! Just put the HTML in template text.
scriptlets in JSPs is an obsolete practice from over 10 years ago! Time to modernize your skills with the JSTL and EL. Please see
this JspFaq entry
Asking smart questions
Books by Bear
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: generate tag ids dynamically
Getting elements by id
unable to get form Parameters
document.getElementById() not working
wrapping a function
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015