Announcement Announcement Module
No announcement yet.
Spring Portlet MVC, Spring form taglib and Portlet taglib Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Portlet MVC, Spring form taglib and Portlet taglib


    I have a problem which looks not really Spring specific, but more like a general problem with tags in JSPs. I want to put a form into a Portlet and therefore use Spring's <form:form>. I need to set its @action attribute to the <portlet:actionUrl>:

    <form:form action="<portlet:actionURL>
                    <portlet:param name="action" value="myAction"/>
                    <portlet:param name="actionParam" value="${command.myParam}"/>
    Unfortunately, this does not work. From the error message

    org.apache.jasper.JasperException: /html/viewMyActionForm.jsp(17,43) equal symbol expected
            at org.apache.jasper.compiler.DefaultErrorHandler.jspError(
            at org.apache.jasper.compiler.ErrorDispatcher.dispatch(
            at org.apache.jasper.compiler.ErrorDispatcher.jspError(
            at org.apache.jasper.compiler.Parser.parseAttribute(
            at org.apache.jasper.compiler.Parser.parseAttributes(
            at org.apache.jasper.compiler.Parser.parseCustomTag(
            at org.apache.jasper.compiler.Parser.parseElements(
            at org.apache.jasper.compiler.Parser.parse(
    ((17,43) points to the third ") I'd guess it's a general problem putting tags (not directives or similar) into tags. Is there any work around on the JSP level?

    I only know a work around on the HTML level that I do not really like: putting <portlet:actionUrl> into a JS function and setting @action of <form:form> via @onSubmit by calling that JS function.

    Thx in advance,

  • #2
    Looks like a problem with nested quotes. Maybe simply using single quotes in the outside set would so it? More readable: have you tried using c:set to create a variable with value equal to your action, and then putting that in the action= attribute of the form tag?


    • #3
      Yes, indeed, just using single quotes works - to some extent It makes the error going away - but the content gets not evaluated, i.e. I have <portlet:actionURL> and so on in my HTML code.

      2nd try with <c:set> and its @value attribute: same effect.

      3rd try using <c:set> and nested tag <portlet:actionURL>: works! So at the end it looks like:

      <c:set var="portletActionURL">
          <portlet:param name="action" value="myAction"/>
      <form:form action="${portletActionURL}">
      And this is of course also much more readable!

      Thanks David.



      • #4
        This seems a little simpler:

        <portlet:actionURL var="actionURL">
          <portlet:param name="action" value="myAction"/>
        <form:form action="${actionURL}">


        • #5
          This A simple solution but have a doubt in param attributes

          Can someone comment on how <portletaram name="action" value="myAction"/> will be rendered in <portlet:actionURL var="actionURL"> tag and where will it be captured, as I am new to portlet technology, I am using Generic Portlet and according to it this will be captured in processAction() of the class forwarded.

          And my other doubt is, If I need to forward action to another class instead of what specified in the portlet.xml, what I need to do and how can I achieve that.