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.