403 error with controller via FreeMarker and spring403 Forbidden vs 401 Unauthorized HTTP responsesDownloading a file from spring controllersWhat's the difference between @Component, @Repository & @Service annotations in Spring?Spring MVC - Multiple submit button to a Formcakephp call action through buttonSpring boot + Freemarker + Bootstrap, submit form select option Entity as valueHow to change the base field of an Alfresco ftl (freemarker) control?Springboot+Freemarker: cannot properly send “select - option” value to controller from freemarker pageHow to call a method with a button in Freemarker DropWizardCSRF/Spring Security - 403 Error After Login via AJAX
Do moonless nights cause dim light to become darkness, and bright light (e.g. from torches) to become dim light?
Lower bound for the number of lattice points on high dimensional spheres
What is the most 'environmentally friendly' way to learn to fly?
What is Modern Vipassana?
Unlocked Package Dependencies
What is Albrecht Dürer's Perspective Machine drawing style?
Declaring a visitor to the UK as my "girlfriend" - effect on getting a Visitor visa?
Subtle ways to render a planet uninhabitable
How do people drown while wearing a life jacket?
How to avoid a lengthy conversation with someone from the neighborhood I don't share interests with
coding the arrow's path in flowchart
How was the cosmonaut of the Soviet moon mission supposed to get back in the return vehicle?
(7 of 11: Fillomino) What is Pyramid Cult's Favorite Shape?
How long should I wait to plug in my refrigerator after unplugging it?
Can an unintentional murderer leave Ir Miklat for Shalosh Regalim?
Have you been refused entry into the Federal Republic of Germany?
Does proof-of-work contribute directly to prevent double-spending?
Is it moral to remove/hide certain parts of a photo, as a photographer?
Can I say "Gesundheit" if someone is coughing?
Is an "are" omitted in this sentence
Why adjustbox needs a tweak of raise=-0.3ex with enumitem?
Why does the friction act on the inward direction when a car makes a turn on a level road?
What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?
How to understand "...to hide the evidence of mishandled magic, or else hidden by castle-proud house-elves" in this sentence
403 error with controller via FreeMarker and spring
403 Forbidden vs 401 Unauthorized HTTP responsesDownloading a file from spring controllersWhat's the difference between @Component, @Repository & @Service annotations in Spring?Spring MVC - Multiple submit button to a Formcakephp call action through buttonSpring boot + Freemarker + Bootstrap, submit form select option Entity as valueHow to change the base field of an Alfresco ftl (freemarker) control?Springboot+Freemarker: cannot properly send “select - option” value to controller from freemarker pageHow to call a method with a button in Freemarker DropWizardCSRF/Spring Security - 403 Error After Login via AJAX
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've created page *.ftl with some tags and want to all this work with my specific controller.
I found that code written inside <#list el as set> cant get controller
This works
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
This doesn't
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
Controller code
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
The code from the list is getting and sending the correct id, but i get 403 error. Why?
java spring controller freemarker http-status-code-403
add a comment |
I've created page *.ftl with some tags and want to all this work with my specific controller.
I found that code written inside <#list el as set> cant get controller
This works
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
This doesn't
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
Controller code
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
The code from the list is getting and sending the correct id, but i get 403 error. Why?
java spring controller freemarker http-status-code-403
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53
add a comment |
I've created page *.ftl with some tags and want to all this work with my specific controller.
I found that code written inside <#list el as set> cant get controller
This works
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
This doesn't
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
Controller code
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
The code from the list is getting and sending the correct id, but i get 403 error. Why?
java spring controller freemarker http-status-code-403
I've created page *.ftl with some tags and want to all this work with my specific controller.
I found that code written inside <#list el as set> cant get controller
This works
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
This doesn't
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
Controller code
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
The code from the list is getting and sending the correct id, but i get 403 error. Why?
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" name="deckstatusid" value="$deckstatus1" />
<input type="hidden" value="$deck.id" name="deckId">
<input type="hidden" name="_csrf" value="$_csrf.token" />
<button type="submit">Delete status</button>
</form>
</div>
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
<#list deck_statuses as deck_status>
<div>
<form action="/deckStatusDel" method="post">
<input type="text" value="$deck_status.id" name="deckstatusid">
<span>$deck_status.status</span>
<button type="submit">Delete status</button>
</form>
</div>
<#else>
empty
</#list>
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
@PostMapping("/deckStatusDel")
public String deckStatusDelete(
@RequestParam Long deckstatusid,
@RequestParam("deckId") Deck deck
)
deckStatusesRepo.deleteById(deckstatusid);
return "redirect:/deck/"+deck.getId();
java spring controller freemarker http-status-code-403
java spring controller freemarker http-status-code-403
edited Mar 29 at 5:30
user7294900
29.2k12 gold badges40 silver badges73 bronze badges
29.2k12 gold badges40 silver badges73 bronze badges
asked Mar 27 at 1:16
tkalin.vladimirtkalin.vladimir
82 bronze badges
82 bronze badges
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53
add a comment |
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53
add a comment |
1 Answer
1
active
oldest
votes
In the second form you are missing a csrf token for authentication
<input type="hidden" name="_csrf" value="$_csrf.token" />
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368401%2f403-error-with-controller-via-freemarker-and-spring%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the second form you are missing a csrf token for authentication
<input type="hidden" name="_csrf" value="$_csrf.token" />
add a comment |
In the second form you are missing a csrf token for authentication
<input type="hidden" name="_csrf" value="$_csrf.token" />
add a comment |
In the second form you are missing a csrf token for authentication
<input type="hidden" name="_csrf" value="$_csrf.token" />
In the second form you are missing a csrf token for authentication
<input type="hidden" name="_csrf" value="$_csrf.token" />
edited Mar 27 at 3:59
answered Mar 27 at 3:32
user7294900user7294900
29.2k12 gold badges40 silver badges73 bronze badges
29.2k12 gold badges40 silver badges73 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368401%2f403-error-with-controller-via-freemarker-and-spring%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Thank you so much. I'm so inconsiderate
– tkalin.vladimir
Mar 27 at 2:53