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.