How to set struts ActionForm attributes using <html:link>?

2.1k views Asked by At

I need to do the thing like this (setting ActionForm attribute):

<html:form action="Link.do?method=editNews">
   <html:hidden property="idNews" value="${news.newsMessage.idNews}" />
   <html:submit value="EDIT"/>      
</html:form>

But in <html:link> or regular a-href tag. So I don't want this parameter to apear in my link as a request parameter. Is it possible?


P.S. idNews is the parameter in my ActionForm class and it has setter and getter.

1

There are 1 answers

1
JB Nizet On BEST ANSWER

No, it's not possible. A link performs a GET request, and the only way for a GET request to send information to the server is to use request parameters, which appear in the URL.

The only thing you can do is to have your link invoke a JavaSCript function which submits a hidden form using POST. But it's ugly.

Why do you fear by making the parameter visible in the URL? Are you aware that anybody can view the source of your HTML page and see the hidden field here?