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 html:link and LookupDispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link and LookupDispatchAction" Watch "html:link and LookupDispatchAction" New topic
Author

html:link and LookupDispatchAction

suc fung
Greenhorn

Joined: Jul 11, 2006
Posts: 4
I have a jsp page which has two buttons and a link.

I am using <html:submit> for the buttons and it works fine
in the action class, which extends LookUpDispatchAction.

Now I want to submit the form when I click on the link.

The action tag in my strutsConfig.xml has an attribute 'parameter= something' for the buttons.

How do I send hidden parameters when I click the link ?
What should I add in strutsconfig for the link ?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You should find the answer to your question in this thread.


Merrill
Consultant, Sima Solutions
suc fung
Greenhorn

Joined: Jul 11, 2006
Posts: 4
Thank you very much for the response. The 'thread' that you were speaking about explains how to use <a href .... > . But I want to use <html:link> and pass a few hidden variables to the action. I DO NOT want to use any java script. My question is..

Is there a way that i can map the link to a method in LookupDispatchAction's getKeyMethodMap(), wherein i can use the hidden parameters from the jsp ?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can substitute <html:link href="" > for <a href=""> if you like. The only difference between the two is that <html:link> performs URL rewriting on the link.

If you restrict yourself from using any JavaScript, your only option is to pass whatever parameters you need in the query string as in:

<html:link href="myAction.do?parm1=abc&parm2=xyz">click here</html:link>

I don't know of a way to send hidden fields on to the URL in a link without using JavaScript.

In my opinion, producing the intuitive and responsive user interfaces that today's users expect without the use of at least some JavaScript is nearly impossible.
suc fung
Greenhorn

Joined: Jul 11, 2006
Posts: 4
Thanks again for your prompt response. You are right about the usage of javascript. I even tried using <a href ="javascript:submit()"> something </a>. But it gives me javascript error. Doesn't specify the error but says object not supported. Im using IE 6 .

Thanks again
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Try changing it to:

<a href="javascript:document.forms[0].submit()">something</a>
[ July 12, 2006: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:link and LookupDispatchAction