jQuery in Action, 2nd edition*
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 Java 8 in Action this week in the Java 8 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: 60077

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]
subject: How can I struts tag library with in javascript ?
Similar Threads
How to create textboxes dynamically?
Javascript DOM and tapestry 5
dynamic table in java script
Create dynamic input text type in a table
Add a Table Row