Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 119015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:35:09+00:00 2026-05-11T03:35:09+00:00

Prototype library uses $(‘element-id’) or $F(‘element-id’) to get the element or value of a

  • 0

Prototype library uses $('element-id') or $F('element-id') to get the element or value of a form element. This is very convenient to code in javascript. But in Struts, I find there is no way to define an id attribute for a form element.

Although i can use

<html:xhtml/> 

to define a form tag with id attribute as follows:

<%@ page contentType='text/html;charset=UTF-8' language='java' %> <%@ taglib uri='http://struts.apache.org/tags-bean' prefix='bean' %> <%@ taglib uri='http://struts.apache.org/tags-html' prefix='html' %>  <html:xhtml/>   <html:form action='/Welcome'> ... <html:text property='username' size='16' maxlength='18'/> ... </html:form> 

The above rendered html is like this:

<form id='TestForm' method='post' action='/myapp/Welcome.do'> ... <input type='text' name='username' size='16' maxlength='18'/> ... </form> 

But what i need is to let struts render the

<html:text>  

tag like this:

<input type='text' id='username' name='username' size='16' maxlength='18'/> 

So is it possible in Struts to realize that? Or if not, how can i make it better to code in Prototype lib for Struts application?

I am using Struts 1.3.8; Prototype 1.5.1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:35:10+00:00Added an answer on May 11, 2026 at 3:35 am

    You can use the styleId attribute on most Struts widgets to set the HTML element id:

    <html:text styleId='myId' .../> 

    renders as

    <input type='text' id='myId' .../> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Javascript class based on the Prototype library. This class needs
Same as this question, but Prototype library specific: I've got a Browser class, and
I am working with Magento which uses the prototype javascript library. Unfortunately some of
A clientside javascript library I've developed uses objects as hashes in some areas. It
I'm using Prototype/Scriptaculous library for a featured content slider, it works great but the
I'm trying to use javascript to code up a dynamic form, where elements are
I am using the prototype JavaScript library to read the contents of a text
if i ever write an ${remoteFunction(...)} the library prototype is used - but we
My prototype code no longer works when I load in the jquery library, even
How can I use the Prototype library and create unobtrusive javascript to inject the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.