-
1. Re: Edit Mode problem
peterj Sep 6, 2007 2:02 PM (in response to forgoodorforawesome)You have done pretty much the same that I did in my portlet. The text "edit portlet" should show up.
If you replace edit.jsp with view.jsp, do you see the view.jsp contents when you go into edit mode? Or if you add < p >..< /p > tags around "edit portlet" in edit.jsp, does the text show up?
Have you looked at the html source in the browser when in edit mode? Perhaps the text is there but because of where it located it might not be displayed by the browser.
I assume that you are logged into the portal before going into edit mode. -
2. Re: Edit Mode problem
forgoodorforawesome Sep 6, 2007 3:11 PM (in response to forgoodorforawesome)To answer your question, yes, I login before I go into edit mode.
I've tried replacing edit.jsp with view.jsp to show up, and I had no luck. I also tried replacing the call to show edit.jsp with this:response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.write("Edit Mode!"); writer.close();
That didn't get me anywhere either. I checked the source, and didn't see "Edit Mode" printed anywhere.
Finally, I tried replacing all of that code in the doEdit() with this:throw new RuntimeException("Edit Exception");
thinking I might get an error in that window when I clicked Edit, but I still get nothing. -
3. Re: Edit Mode problem
peterj Sep 6, 2007 3:42 PM (in response to forgoodorforawesome)How strange. If the portal put the edit icon in the title bar of your portlet, then it must know that the portlet has an edit mode. But it appears that either the portal is not calling doEdit, or there is an exception somewhere that prevents the edit mode from running. Oh, another possibility is that your doEdit method is improperly declared. It should be:
@Override protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
If you would post the code for your portlet and your portlet.xml file, I could try it out and see if I can figure out what is wrong. -
4. Re: Edit Mode problem
forgoodorforawesome Sep 6, 2007 4:36 PM (in response to forgoodorforawesome)Ok, here's my portlet.xml file:
<?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0"> <portlet> <portlet-name>EmmiPortlet</portlet-name> <portlet-class>com.rightfield.testing.portlet.EmmiPortlet</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>EDIT</portlet-mode> </supports> <portlet-info> <title>Emmi Portlet</title> </portlet-info> </portlet> </portlet-app>
And here's my Portlet code:import java.io.IOException; import java.io.PrintWriter; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.GenericPortlet; import javax.portlet.PortletException; import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletSecurityException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import com.rightfield.common.EmmiDTO; import com.rightfield.emmimgr.dao.EmmiMgrDAOFactory; import com.rightfield.emmimgr.dao.ReadOnlyEmmiMgrDAO; public class EmmiPortlet extends GenericPortlet { @Override protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/edit.jsp"); prd.include(request, response); } @Override protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException { response.setContentType("text/html"); try{ request.setAttribute("accessCode", "19205679384"); //other attribute settings... PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view.jsp"); prd.include(request, response); }catch(Exception e){ throw new RuntimeException(e); } } @Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException { // TODO Auto-generated method stub super.processAction(request, response); } }
I'm beginning to wonder whether there is an environment issue. I'm not using the bundled distribution, rather I downloaded the binary distribution and followed the instructions so that I could deploy the portal to the installation of jboss I already had. -
5. Re: Edit Mode problem
peterj Sep 6, 2007 4:47 PM (in response to forgoodorforawesome)I don't use the bundled version either, I either use the binary or sometimes I grab the source and compile it myself. So I don't think that is the problem.
I'll try your portlet and let you know. -
6. Re: Edit Mode problem
peterj Sep 6, 2007 5:29 PM (in response to forgoodorforawesome)Hate to say this, but it works for me. I click on the edit button and I get the edit text displayed. And I am using the edit.jsp contents you posted (well, I did change the uri for the "c" tag, and changed the text for view.jsp).
I used a JBoss AS 4.0.5 that I already had, though I did create a fresh server configuration for the portal. I am using PostgreSQL 8.1. And Portal 2.6.1. -
7. Re: Edit Mode problem
peterj Sep 6, 2007 5:55 PM (in response to forgoodorforawesome)Did you, by any chance, originally deploy the portlet with only view mode, and then later add edit mode? If you did that, then the portal is not updating the allowed types for the portlet. You might have to undeploy the portlet, then go into the Management Portlet and make sure that all traces of the portlet and its instances are gone, and then deploy the portlet again.
-
8. Re: Edit Mode problem
forgoodorforawesome Sep 6, 2007 5:56 PM (in response to forgoodorforawesome)Thank you so much for all the help. When you say that you created a fresh server configuration, do you mean you created a new db for it and configured the portal-postgresql-ds.xml file for it?
-
9. Re: Edit Mode problem
peterj Sep 6, 2007 6:05 PM (in response to forgoodorforawesome)That is correct. I have an Ant script that does this for me automatically - just point it to AS, Portal, and database (PostgreSQL or MySQL), and it does the entire configuration.
-
10. Re: Edit Mode problem
forgoodorforawesome Sep 7, 2007 3:16 PM (in response to forgoodorforawesome)I found the problem. I had used an example I had found online as a template, and there were extra jar files in the lib directory which got copied into the war. Once I cleared those out it worked fine.
Again, thanks for all the help!