File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes A html:link problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "A html:link problem" Watch "A html:link problem" New topic

A html:link problem

David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
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(
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(
at org.apache.jasper.compiler.ErrorDispatcher.jspError(

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

Nimchi Yung
Ranch Hand

Joined: Jan 27, 2004
Posts: 71
Try to use lower case

David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
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

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
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.
SCJP 1.4
David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Thank you very much Kerry for your reply. You are right, and the same as the suggestion from Ram in another thread:
<a href="javascript:submitIt()">SUBMIT</a>
<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.

I agree. Here's the link:
subject: A html:link problem
It's not a secret anymore!