This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes html options doubt  in struts 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 "html options doubt  in struts" Watch "html options doubt  in struts" New topic

html options doubt in struts

Phanindra varma

Joined: Jul 29, 2005
Posts: 14
Hi All,
Please help me out from this situation.
I wrote a code like this.

<html:select property="entity">
<html ptions name="entityValue"/>

Here i am able to populating the values from collection. I wrote a javascript function for moving the values from left select area to right select area for that if i select any value from the options it should return true or false based on that only i will move that value from left to right.

Ex in Javascript :

if (from.options[i].selected) {
// Here i am writing the actual code
The above code is working if i am using HTML options but how will i write the equalent code when i am using STRUTS HTML options.

Please Help me.... I am eagerly waiting for the reply.
Thanks in Advance.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30138

The code is the same idea. Note that the name of the form element is the name of the property and the name of the form is in the struts config file's form defintion.

So you have:

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When writing javaScript for a Struts application it's important to remember two things:

1 - A struts JSP with it's html:xxx tags is a server-side technology that translates your instructions into pure html and then sends that html back to the browser. The browser then interprets the html and causes the page to be displayed.

2- JavaScript is a client-side technology that acts upon the pure html that is sent to the browser, not on the jsp tags themselves.

As long as you bear in mind these two things, javaScript programming for Struts is no different than javaScript for any other web application. I find that it's helpful to make frequent use of my browser's "view source" function so that I can see the actual html that is being displayed on the page. Once I know this, it's relatively easy to write javaScript for that page.

Consultant, Sima Solutions
Consider Paul's rocket mass heater.
subject: html options doubt in struts
Similar Threads
Ajax with Struts - Loading the lookup values in drop down
implementing dependent select boxes in struts1.2.9 and netbeans6.5
additional values in the dropdown
Dependent drop down list using Struts 1.2 with Ajax DWR
how to populate dependent <html:select >