File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
author & internet detective

Joined: May 26, 2003
Posts: 33102

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:

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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
I agree. Here's the link:
subject: html options doubt in struts
It's not a secret anymore!