Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with html:form

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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 = "/questions.do" 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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1777
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The attribute is not "onClick". it is "onclick" (note lower case c)
http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#radio

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

Cheers,
evnafets
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Lot!!!
It worked
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic