• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A html:link problem

 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, there:

I want to use hyper link instead of submit button in my form to submit it. And this is what I did:



it gives me:
10:44:44.376 WARN!! Exception for /euwi/pages/login.jsp
org.apache.jasper.JasperException: /pages/login.jsp(150,49) Attribute onClick invalid according to the specified TLD
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186)

However, if I using <html:submit/> instead, everything works fine. Anything wrong I did?

Highly appreciated if any suggestion or comments from you.
Thanks a lot in advance

David
 
Nimchi Yung
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to use lower case
"onclick"

--Nimchi
 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Nimchi for immediately reply. It's exactly the problem. I'm so stupid to use capital 'C'. Thanks a lot again.
However, by using hyperlink instead of html:submit, now I have the problem to populate form fields.

It seems not populate the form fields at all, in myAction class I checked actionForm, all fields are null.
However, if using <html:submit /> instead, all form fields are sent correctly without any problem.
can you Nimchi, or anyone help me on that?

Thanks a lot again for your help

David
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the standard html Anchor tag. the problem is the rendered html:link tag has an action, so it will automatically be a link to that action.
 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Kerry for your reply. You are right, and the same as the suggestion from Ram in another thread:
both:
<a href="javascript:submitIt()">SUBMIT</a>
or
<html:link href="javascript:submitIt()">SUBMIT<html:link>
will work in my case. However it will not populate form fields if using:
<html:link action="login" onklick="javascript: submitIt()">SUBMIT</html:link>
the reason is just as you said. Thanks a lot again.

David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic