portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Winburn" <jwinb...@computerguidance.com>
Subject Double Action problem
Date Mon, 15 Dec 2008 21:40:50 GMT
Hey Guys,

 

When linking back to the portal server in edit mode, I am finding that
doEdit() is called twice.

 

Here is my code for doEdit():

  

public void doEdit(RenderRequest request,RenderResponse response) 

   throws PortletException,IOException {

        

        response.setContentType("text/html");

        PrintWriter out=response.getWriter();

       

        out.print("<form action=" + response.createActionURL() + " >");

 

        String src = (String)request.getParameter("srcText");

        if (src==null){

            src = DEFAULT_SRC;

        } 

        out.print("<input type=\"text\" name=\"srcText\" value=\"" + src
+ "\" >");

        out.print("<br><br>");

        out.print("<input type=\"submit\" name=\"SUBMIT\"
value=\"save\">");         

        out.print("</form>");            

    }

    

When going into edit mode, doEdit() is run.  The form hasn't been
written to the screen yet and getParameter() therefore returns
nothing...as it should.  The form is displayed in the portlet with the
default source.

 

On a click to the submit button, doEdit() is run again, but this time
getParameter() returns whatever it found in the text box.  All well and
good.

 

But a second call to doEdit() is somehow triggered.  This time
getParameter() returns nothing and it is subsequently filled with the
default value....again.

 

My question is, why is doEdit being called that second time?  My guess
is that the first time is a response to the actionURL and the second
time is the system "setting to edit mode" again.

 

Since the second invocation essentially overwrites the fetched "src"
value with the default, it's like I never entered anything in the field.
I was unable to find out why that second doEdit() should be happening
from googly-research.  I was hoping one of you might steer me in.

    

James Winburn  

Computer Guidance Corporation

Scottsdale, AZ

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message