Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SAE4.A02.1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxime Gosselin
SAE4.A02.1
Commits
78f56071
Commit
78f56071
authored
2 months ago
by
Maxime Gosselin
Browse files
Options
Downloads
Patches
Plain Diff
Account gère les erreurs
parent
80522032
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
WEB-INF/src/controleur/Account.java
+11
-1
11 additions, 1 deletion
WEB-INF/src/controleur/Account.java
WEB-INF/vue/error.jsp
+5
-0
5 additions, 0 deletions
WEB-INF/vue/error.jsp
with
16 additions
and
1 deletion
WEB-INF/src/controleur/Account.java
+
11
−
1
View file @
78f56071
...
...
@@ -15,6 +15,13 @@ import modele.dto.User;
public
class
Account
extends
HttpServlet
{
@Override
public
void
service
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
String
username
=
(
String
)
req
.
getSession
().
getAttribute
(
"username"
);
// vérification de l'authentification
if
(
username
==
null
){
resp
.
sendRedirect
(
"index.html"
);
return
;
}
String
action
=
(
String
)
req
.
getParameter
(
"action"
);
HttpSession
session
=
req
.
getSession
();
DaoUser
daoUser
=
new
DaoUser
();
...
...
@@ -25,7 +32,6 @@ public class Account extends HttpServlet{
resp
.
sendRedirect
(
"index.html"
);
break
;
case
"update"
:
String
username
=
(
String
)
session
.
getAttribute
(
"username"
);
String
firstname
=
req
.
getParameter
(
"firstname"
);
String
lastname
=
req
.
getParameter
(
"lastname"
);
...
...
@@ -35,6 +41,10 @@ public class Account extends HttpServlet{
daoUser
.
update
(
user
);
resp
.
sendRedirect
(
"navigation?page=compte"
);
break
;
default
:
req
.
setAttribute
(
"error"
,
"Ne changez pas l'url vous même!"
);
req
.
getRequestDispatcher
(
"/WEB-INF/vue/error.jsp"
);
return
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
WEB-INF/vue/error.jsp
0 → 100644
+
5
−
0
View file @
78f56071
<%@ page
contentType=
"text/html; charset=UTF-8"
%>
<html>
ERREUR :
<%=
request
.
getAttribute
(
"error"
)
%>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment