6 Replies Latest reply on Oct 26, 2005 11:54 AM by bsmithjj

    How do I write Portlets for my Own Portal..

    ikazarno

      Hi,

      Following the instruction from the Topic "How do I write my Own Portal.." I have created my custom portal. It works fine. Then I've added a portlet to the default page. There was still no problem, the portlet is correct displayed! However by clicking a link in the portlet I've got a default portal page instead of the next portlet page. The link ist rendered by the actionURL tag and likes as follows - /portal/index.html?ctrl:id=window.myportal.myportlet&ctrl:type=action. Any ideas how I can solve this problem?

      Thanks

        • 1. Re: How do I write Portlets for my Own Portal..
          ray_lukas

          Well I am just starting to look at this portlet stuff again.. I am not totally sure I understand the question but I will venture an answer and hopefully it will be of some help to you.

          I am looking at a document that I got from the sun web page at http://developer.sun.org called the ?Introduction to JSR 168 ? The Java Portlet Specification?. I am sure that you can google it and find this exact location. In that document they go through the WeatherPorlet example. Which seems like a great example for people starting out, like me..

          In this example they are displaying a link that you can click on and have it render a new ?page? in your portlet. Take a look at page 8 of this document, in the jsp code. It has something like;

          <form method=?post? action=?<portlet:actionURL/>?>
           enter Zip Code:
           <input type=?text? name=?zip? value=??>
           <input type=?submit? name=?submit? value=?Search?>
          </form>


          Is this what you are asking about.. does this help?

          Take a peek at that document. If, and as, I find/discover more things I will post them for you..

          ray


          • 2. Re: How do I write Portlets for my Own Portal..
            ray_lukas

            I looked up that link for you..

            http://developers.sun.com/prodtech/portalserver/reference/techart/university.html

            there are a lot of good resources here and I understand now that the source for that portlet is now there..

            • 3. Re: How do I write Portlets for my Own Portal..
              ikazarno

              After further research I found out that JBoss does handle correctly following link:

              <a href='<portlet:actionURL><portlet:param name='param' value='value'/></portlet:actionURL>'> my action

              However, I need to submit the form data while executing the action. I'm trying to achieve this in the following way, but JBoss fails to process the action and displays a default portal page.

              <a href='javascript:document.<portlet:namespace/>currentStateForm.action=<portlet:actionURL><portlet:param name='param' value='value'/></portlet:actionURL>';document.<portlet:namespace/>currentStateForm.submit()'> my action

              Any idea How I can workaround this problem?

              • 4. Re: How do I write Portlets for my Own Portal..

                Here is an approach I use for dynamically creating form-submit URL's in portlet-JSP pages (Using JSP 2.0 - EL support and JSTL):

                <%-- create a page-scoped var containing the submit URL --%>
                <c:set var="saveChangesURL"><portlet:actionURL><portlet:param name="action" value="saveChanges"/></portlet:actionURL></c:set>
                
                Customize (EDIT) This Portlet<br />
                <form action="${saveChangesURL}" method="POST">
                
                .....
                
                </form>
                ....
                


                The above code is simpler than what you are trying to do with your link code and setting the action property of a DOM object.

                Hope this helps.

                • 5. Re: How do I write Portlets for my Own Portal..
                  ikazarno

                  The problem is that I have several links on the page which point to the different actions but should submit the same form... Therefore I'm setting the form action with javascript and then submitting the form.

                  • 6. Re: How do I write Portlets for my Own Portal..

                    Thanks for the clarification - that's not really a portal, portlet, or even a JSP question at this point then, right?

                    It's more a question of 'how do use javascript to dynamically change a form action based on which link a user clicks?'

                    Cheers!