You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Java Web Development <ja...@verizon.net> on 2008/06/12 02:21:27 UTC

Problem Implementing Threaded Comments

I'm working on implementing threaded comments and I'm pretty much done but
in trying to clean things up I ran into a problem.

I have a form I'm using to submit the reply request.
<form method="post" action="$url.entry($entry.anchor)#comments"
name="commentForm">    
  <input type="hidden" name="method" value="reply" />
  <input type="hidden" name="parentId" value="$comment.id" />
  <input type="submit" class="button" name="reply" value="&nbsp;Reply&nbsp;"
/>
</form>

If I run it as is I get the roller page not found page. I haven't been able
to figure out how to attach the debugger in netbeans yet to help me trace
the problem.

The execution doesn't even get to the CommentServlet doPost method and I
haven't been able to figure out where it's failing.

If I include a hidden input field for content it works.

Anyone know where this might be failing or how to get the debugger to work
in netbeans with roller?

Thanks



RE: Problem Implementing Threaded Comments

Posted by Java Web Development <ja...@verizon.net>.
Ok, I'm going to answer part of my own question.  I kept trying to attach
the debugger using the process id. I switched to shared memory and it worked
right away. So I should be able to track down the problem now.

If in the future anyone is looking for similar information.

Start the tomcat server up in debug mode.
Then go to the Run menu and select Attach Debugger.
For Transport select SharedMemoryAttach
Name is : tomcat_shared_memory_id for tomcat




RE: Problem Implementing Threaded Comments

Posted by Java Web Development <ja...@verizon.net>.
I added the #comments because the link in the theme says "comments [N]" so
it made sense to send the browser to the comments section so they won't have
to scroll down through the entry.

One other user experience thing I came across that I didn't like.  When a
user is done previewing and posts their comment, after the comment is saved
CommentServlet uses a RequestDispatcher to forward back to the entry page. 

I would prefer it to be an HttpServletResponse redirect. You can't just
issue a redirect at that point since it seems some headers have already been
written. Anyone know if there's a method of issuing a redirect? Might be
able to do a forward to the RedirectServlet, then let RedirectServlet do the
redirect but this seems a bit inefficient.

This may be a small thing but on very popular blogs, I have seen users post
their comments and then sit and hit reload every so often to see if there's
been a response.  Doing a redirect would minimize the risk of having the
user submit the same comment twice.

-----Original Message-----
From: Allen.Gilliland@Sun.COM [mailto:Allen.Gilliland@Sun.COM] 
Sent: Thursday, June 12, 2008 5:09 PM
To: dev@roller.apache.org
Subject: Re: Problem Implementing Threaded Comments

ahhh, i know why, it's because we use the servlet path rather than the 
URI, so #comments wasn't included in the servlet path.  either way, you 
don't need that in there.

you are correct that the method must be POST and it must contain a 
request parameter for "content" in order for the request to get passed 
to the CommentServlet.


Java Web Development wrote:
> Actually that wasn't the problem The problem is that The way netbeans
knows
> a comment form is being submitted and needs to be forwarded to the comment
> servlet, is if the http method is post and if there is a "content"
> parameter.  The #comments works fine for me.
> 
> 
> 
> -----Original Message-----
> From: Allen.Gilliland@Sun.COM [mailto:Allen.Gilliland@Sun.COM] 
> Sent: Thursday, June 12, 2008 11:07 AM
> To: dev@roller.apache.org
> Subject: Re: Problem Implementing Threaded Comments
> 
> You probably figured this out already, but the problem you were running 
> into was that you put "#comments" at the end of the forms action url. 
> you don't want to do that.  Just strip that part out and it should work.
> 
> -- Allen
> 
> 
> Java Web Development wrote:
>> I'm working on implementing threaded comments and I'm pretty much done
but
>> in trying to clean things up I ran into a problem.
>>
>> I have a form I'm using to submit the reply request.
>> <form method="post" action="$url.entry($entry.anchor)#comments"
>> name="commentForm">    
>>   <input type="hidden" name="method" value="reply" />
>>   <input type="hidden" name="parentId" value="$comment.id" />
>>   <input type="submit" class="button" name="reply"
> value="&nbsp;Reply&nbsp;"
>> />
>> </form>
>>
>> If I run it as is I get the roller page not found page. I haven't been
> able
>> to figure out how to attach the debugger in netbeans yet to help me trace
>> the problem.
>>
>> The execution doesn't even get to the CommentServlet doPost method and I
>> haven't been able to figure out where it's failing.
>>
>> If I include a hidden input field for content it works.
>>
>> Anyone know where this might be failing or how to get the debugger to
work
>> in netbeans with roller?
>>
>> Thanks
>>
>>
> 
> 



Re: Problem Implementing Threaded Comments

Posted by Allen Gilliland <Al...@Sun.COM>.
ahhh, i know why, it's because we use the servlet path rather than the 
URI, so #comments wasn't included in the servlet path.  either way, you 
don't need that in there.

you are correct that the method must be POST and it must contain a 
request parameter for "content" in order for the request to get passed 
to the CommentServlet.


Java Web Development wrote:
> Actually that wasn't the problem The problem is that The way netbeans knows
> a comment form is being submitted and needs to be forwarded to the comment
> servlet, is if the http method is post and if there is a "content"
> parameter.  The #comments works fine for me.
> 
> 
> 
> -----Original Message-----
> From: Allen.Gilliland@Sun.COM [mailto:Allen.Gilliland@Sun.COM] 
> Sent: Thursday, June 12, 2008 11:07 AM
> To: dev@roller.apache.org
> Subject: Re: Problem Implementing Threaded Comments
> 
> You probably figured this out already, but the problem you were running 
> into was that you put "#comments" at the end of the forms action url. 
> you don't want to do that.  Just strip that part out and it should work.
> 
> -- Allen
> 
> 
> Java Web Development wrote:
>> I'm working on implementing threaded comments and I'm pretty much done but
>> in trying to clean things up I ran into a problem.
>>
>> I have a form I'm using to submit the reply request.
>> <form method="post" action="$url.entry($entry.anchor)#comments"
>> name="commentForm">    
>>   <input type="hidden" name="method" value="reply" />
>>   <input type="hidden" name="parentId" value="$comment.id" />
>>   <input type="submit" class="button" name="reply"
> value="&nbsp;Reply&nbsp;"
>> />
>> </form>
>>
>> If I run it as is I get the roller page not found page. I haven't been
> able
>> to figure out how to attach the debugger in netbeans yet to help me trace
>> the problem.
>>
>> The execution doesn't even get to the CommentServlet doPost method and I
>> haven't been able to figure out where it's failing.
>>
>> If I include a hidden input field for content it works.
>>
>> Anyone know where this might be failing or how to get the debugger to work
>> in netbeans with roller?
>>
>> Thanks
>>
>>
> 
> 

RE: Problem Implementing Threaded Comments

Posted by Java Web Development <ja...@verizon.net>.
Actually that wasn't the problem The problem is that The way netbeans knows
a comment form is being submitted and needs to be forwarded to the comment
servlet, is if the http method is post and if there is a "content"
parameter.  The #comments works fine for me.



-----Original Message-----
From: Allen.Gilliland@Sun.COM [mailto:Allen.Gilliland@Sun.COM] 
Sent: Thursday, June 12, 2008 11:07 AM
To: dev@roller.apache.org
Subject: Re: Problem Implementing Threaded Comments

You probably figured this out already, but the problem you were running 
into was that you put "#comments" at the end of the forms action url. 
you don't want to do that.  Just strip that part out and it should work.

-- Allen


Java Web Development wrote:
> I'm working on implementing threaded comments and I'm pretty much done but
> in trying to clean things up I ran into a problem.
> 
> I have a form I'm using to submit the reply request.
> <form method="post" action="$url.entry($entry.anchor)#comments"
> name="commentForm">    
>   <input type="hidden" name="method" value="reply" />
>   <input type="hidden" name="parentId" value="$comment.id" />
>   <input type="submit" class="button" name="reply"
value="&nbsp;Reply&nbsp;"
> />
> </form>
> 
> If I run it as is I get the roller page not found page. I haven't been
able
> to figure out how to attach the debugger in netbeans yet to help me trace
> the problem.
> 
> The execution doesn't even get to the CommentServlet doPost method and I
> haven't been able to figure out where it's failing.
> 
> If I include a hidden input field for content it works.
> 
> Anyone know where this might be failing or how to get the debugger to work
> in netbeans with roller?
> 
> Thanks
> 
> 



Re: Problem Implementing Threaded Comments

Posted by Allen Gilliland <Al...@Sun.COM>.
You probably figured this out already, but the problem you were running 
into was that you put "#comments" at the end of the forms action url. 
you don't want to do that.  Just strip that part out and it should work.

-- Allen


Java Web Development wrote:
> I'm working on implementing threaded comments and I'm pretty much done but
> in trying to clean things up I ran into a problem.
> 
> I have a form I'm using to submit the reply request.
> <form method="post" action="$url.entry($entry.anchor)#comments"
> name="commentForm">    
>   <input type="hidden" name="method" value="reply" />
>   <input type="hidden" name="parentId" value="$comment.id" />
>   <input type="submit" class="button" name="reply" value="&nbsp;Reply&nbsp;"
> />
> </form>
> 
> If I run it as is I get the roller page not found page. I haven't been able
> to figure out how to attach the debugger in netbeans yet to help me trace
> the problem.
> 
> The execution doesn't even get to the CommentServlet doPost method and I
> haven't been able to figure out where it's failing.
> 
> If I include a hidden input field for content it works.
> 
> Anyone know where this might be failing or how to get the debugger to work
> in netbeans with roller?
> 
> Thanks
> 
>