This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes problem with html:form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with html:form" Watch "problem with html:form" New topic

problem with html:form

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228

I have this code in my JSP page. I need to have name = "questionList" for the form becoz i am using java script
if(document.questionList.yesno1.options[1].selected)... in the JSP page.

<html:form action = "/" name="questionList" type="gov.osc.vendrep.webapp.form.impl.QuestionForm" >

but i get Attribute name invalid for tag form according to TLD error.
Please help me...

Thanks in advance,
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
Hello cs Reddy,

You need not mention the name attribute at all. This is what you can do:
1)Your struts config will be something like this:

2)now in your jsp you can do something like this:

3)in your javascript you can do this:
document.loginForm.blah.blah = blah;

The form name is automatically taken to be loginForm which is what you mentioned in your struts-config.xml.

Hope this solves your problem.
[ February 22, 2006: Message edited by: dnyan ginde ]
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Thanks dnyan for your reply. I have another question

If i am using simple html tags then i do
<input type="radio" name="radiobtns" value="abc" onklik="show('layer1')"<
which works fine.
but if i want to use struts html tags and if i use
<html:radio property = "radio" value = "<=%qvalue%<" onklik="show('layer1')"/<
Then it throws this error

Attribute onClick invalid for tag radio according to TLD

I am not sure how to call javascript onClick of radio btn. Please help me.

Thanks in advance,
Stefan Evans

Joined: Jul 06, 2005
Posts: 1016
The attribute is not "onClick". it is "onclick" (note lower case c)

Case doesn't matter when you are dealing with HTML tags.
It DOES matter when dealing with custom tags in JSP.

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Thanks a Lot!!!
It worked
subject: problem with html:form
Similar Threads
Help:client validation on struts multi-page
Multipage form validation
unable to include a html:form tag in body of tiles layout
Automatic Validation does not work