aspose file tools
The moose likes JSP and the fly likes generate tag ids dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "generate tag ids dynamically" Watch "generate tag ids dynamically" New topic
Author

generate tag ids dynamically

Utkarsh Jauhari
Greenhorn

Joined: Jan 12, 2013
Posts: 2
I am new Please hellp !!!

can we use something like
y is a variable
out.println(<input type=/'text/' id=/'name"+y+"/'>);
or
out.println(<input type=/'text/' id=/'name<%=y%>/'>);

Actually i want to generate tag id's dynamically for form inputs(which are generating dynamically too) for further value retrieval through javascript.
as

var temp=document.getElementById("name1").value;
var temp1=document.getElementById(name2).value;

Please reply soon. Thanks in Advance
Vijay Vishwa
Greenhorn

Joined: Nov 21, 2010
Posts: 28
Hi Utkarsh,

Please do you the code tag when putting any code.
Regarding the question.



OR if using the " (double quotes to given the value to properties) then


Note the use of escape sequence \ (its not /)

If you are wrting in JSP then you can also use




SCJP 5.0 OCBCD 5.0(Formerly SCBCD)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56155
    
  13

Why are you using out.println in the first place? That's really strange. The whole point of a JSP is not to have to create HTML in strings! Just put the HTML in template text.

Also, using Java 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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: generate tag ids dynamically
 
Similar Threads
document.getElementById() not working
Getting elements by id
problem javascript
unable to get form Parameters
wrapping a function