Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes How can I struts tag library with in javascript ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How can I struts tag library with in javascript ?" Watch "How can I struts tag library with in javascript ?" New topic

How can I struts tag library with in javascript ?

Srinivas Kasani

Joined: Sep 26, 2008
Posts: 22
I'm trying to create a table dynamically using javascript(onClick). The table needs to have a drop down values. I need to populate the dropdown list with struts tag library, Is this possible ?.
Here is the code snippet of javascript.

function addRow(id)
var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR");
var td1 = document.createElement("TD");
S1 = document.createElement("select");
var oOption = document.createElement("option");
var t = document.createTextNode("");
How can I insert struts tag library
<html ptions collection="availableprofilesources" property="name" labelProperty="name"/> in the javascript above.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60785

Sorry, nope. As with all JSP custom actions, Struts tags are executed on the server in order to produce HTML markup to send to the browser. Once at the browser, no JSP activity can take place in JavaScript.

It's be easiest just to deal with straight-forward HTML, but if you need to get clever you could probably piece together an Ajax solution.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How can I struts tag library with in javascript ?
Similar Threads
Create dynamic input text type in a table
Javascript DOM and tapestry 5
How to create textboxes dynamically?
dynamic table in java script
Add a Table Row