File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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(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

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

--Nimchi
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

David
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.


http://www.goodercode.com
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:
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A html:link problem