This content has been marked as final.
Show 3 replies
-
1. Re: Posting to ActionURL
bsmithjj Jan 4, 2006 12:42 PM (in response to mcaughey)You use the JSR168 portlet tag library to achieve this.
Here is an example using the actionURL tag, some JSTL (<c:set..>) and JSP 2.0 to create a link for a portlet form:<c:set var="editLinkURL"><portlet:actionURL><portlet:param name="action" value="editLink"/></portlet:actionURL></c:set> ... <form action="${editLinkURL}" method="post"> ... </form>
Hope that helps. -
2. Re: Posting to ActionURL
mcaughey Jan 4, 2006 12:53 PM (in response to mcaughey)Thanks for the quick response.
Here's what I did:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <c:set var="listLinkURL"> <portlet:actionURL> <portlet:param name="action" value="PersonList" /> </portlet:actionURL> </c:set> <script> function postPersonForm(id){ document.viewPersonForm.value = id; document.viewPersonForm.submit(); } </script> <form id="view-person" name="viewPersonForm" action="${listLinkURL}" method="POST"> <input type="hidden" name="id" /> </form> <table border="0" width="200"> <tr> <td> Lastname, Firstname </td> </tr> <c:forEach items="${PersonsList}" var="person"> <tr> <td> <a href="javascript:postPersonForm(${person.id});"> <c:out value="${person.lastName}" /> , <c:out value="${person.firstName}" /> </a> </td> </tr> </c:forEach> </table>
I got an error att he top of my JSP in regards to the portlet tag lib, the error doesn't say anything useful but it is related tothe taglib entry. Also I have an erro next to the <portlet:actionURL> tag which indicates that it cannot find the actionURL tag in the portlet TLD.
Thanks,
Michael -
3. Re: Posting to ActionURL
mcaughey Jan 4, 2006 1:02 PM (in response to mcaughey)Well there may be errors on the JSP page, but ti does work.
NOTE that in the example above there was a bug<script> function postPersonForm(id){ document.viewPersonForm.id.value = id; document.viewPersonForm.submit(); } </script>
Just thought i'd note that for the record. It didn;t impact the issue at hand.
So the only question i have is how do I fix the errors tha Eclipse is reporting?
-Michael