You need to return "jb" from getUrlName() otherwise you are telling the job
that there is no specific relative URL to your action.
Since your form post is pointing to "jb/save" I'm assuming that is the
url-space you assume for your action.

/B

On Thu, Dec 18, 2014 at 2:54 PM, <[email protected]> wrote:

> Hello,
> I'm developing my first plugin that allows to add comment on project main
> page (specific comment for each job). So far I have class that implements
> Action and floatingbox.jelly with form - textbox and submit button. After
> adding the comment the form should dissapear and the comment should stay on
> this job's project main page. Then I want to add button to delete comment,
> but i still have some problems with doSave function. When I click Submit i
> get an error: HTTP ERROR 404 Problem accessing /job/jobA/jb/save. Reason:
> Not Found
> There is my simplify class (I made everything public but it still no
> working):
>
> public class HelloWorldBuilder implements Action {
>>
>> private AbstractProject ap;
>> public String comment;
>> public boolean checkBool;
>>
>> public HelloWorldBuilder(AbstractProject ap) {
>>     this.ap = ap;
>> }
>>
>> public void doSave(StaplerRequest req, StaplerResponse resp)
>>         throws ServletException, IOException {
>>     String reason = (String) req.getSubmittedForm().get("comment");
>>     reason = this.comment;
>>     checkBool = true;
>>     resp.forwardToPreviousPage(req);
>> }
>>
>> public String getIconFileName() {
>>     return null;
>> }
>>
>> public String getDisplayName() {
>>     return "";
>> }
>>
>> public String getUrlName() {
>>     return "";
>> }
>>
>> @Extension
>> public static final class DescriptorImpl extends
>> TransientProjectActionFactory {
>>
>>     public DescriptorImpl() throws IOException {
>>     }
>>
>>     @Override
>>     public Collection<? extends Action> createFor(AbstractProject target)
>> {
>>         return Arrays.asList(new HelloWorldBuilder(target));
>>     }
>>   }
>>
>> }
>>
>
>
> and floatingBox.jelly file:
>
>> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
>> xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
>> xmlns:f="/lib/form">
>> <h2>Plugin:</h2>
>>     <j:if test="${it.checkBool}">
>>         <h1>${it.comment}</h1>
>>     </j:if>
>>     <j:if test="${!it.checkBool}">
>>         <f:form method="post" action="jb/save" name="save">
>>         <f:entry title="${%Comment}" >
>>             <f:textbox name="site" value="${it.comment}" />
>>         </f:entry>
>>         <f:block>
>>             <f:submit value="${%Submit}" />
>>         </f:block>
>>     </f:form>
>>     </j:if>
>> </j:jelly>
>>
>
>
> The class location is in
> jb\src\main\java\org\jenkinsci\tools\jb\HelloWorldBuilder.java
> The jelly location:
> jb\src\main\resources\org\jenkinsci\tools\jb\HelloWorldBuilder\floatingBox.jelly
>
> Please help me.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/ebefa5b7-3340-4a34-9dc2-180e5b7d5596%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/ebefa5b7-3340-4a34-9dc2-180e5b7d5596%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS0huYmg5-f_GkuJAREKO-5N0pc9R9KcG5mwE4E--6gS6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to