jakarta-ee

request getParameter is always null when using enctype=“multipart/form-data”

痴心易碎 提交于 2020-06-05 06:33:52
问题 I am performing validation of inputted data such as email, password, name, etc. But I am already stuck on the first stage of validation which is to check if User entered nothing. I already added enctype="multipart/form-data" as mentioned here but now it is always recognizing email as null and I can't forward to the login page in case of success (when email is not null). Code signup.jsp <form method="POST" action="signup" enctype="multipart/form-data"> <input type="email" name="email"

request getParameter is always null when using enctype=“multipart/form-data”

懵懂的女人 提交于 2020-06-05 06:32:13
问题 I am performing validation of inputted data such as email, password, name, etc. But I am already stuck on the first stage of validation which is to check if User entered nothing. I already added enctype="multipart/form-data" as mentioned here but now it is always recognizing email as null and I can't forward to the login page in case of success (when email is not null). Code signup.jsp <form method="POST" action="signup" enctype="multipart/form-data"> <input type="email" name="email"

Spring annotations : form validation of a bean internal object attribute using thymeleaf

混江龙づ霸主 提交于 2020-05-15 10:34:57
问题 is there a way in Thymeleaf to validate an attribute in object property of a bean? Consider that we do have a Departement class as below : public class Departement { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idDept; @NotEmpty private String name; } And another Employee class as follow public class Employee{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idEmp; @NotEmpty @Size(min = 5, message="At least five characters needed") private String

Spring annotations : form validation of a bean internal object attribute using thymeleaf

心不动则不痛 提交于 2020-05-15 10:34:22
问题 is there a way in Thymeleaf to validate an attribute in object property of a bean? Consider that we do have a Departement class as below : public class Departement { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idDept; @NotEmpty private String name; } And another Employee class as follow public class Employee{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idEmp; @NotEmpty @Size(min = 5, message="At least five characters needed") private String

One Servlet per path or handle multiple paths in a Servlet?

☆樱花仙子☆ 提交于 2020-05-13 07:48:56
问题 I'm wondering what is the best practice in handeling servlets when dealing with a many pages in a website. Most GET requests in servlets simply return a new jsp page. I had thought of two approaches: Assign a servlet for each path in the webiste e.g a homeservlet for home page, registerservlet for registration page, loginservlet for login page etc. Have a small number of servlets that process multiple paths and handle them accordingly e.g. A UserServlet that could do the job of registration

One Servlet per path or handle multiple paths in a Servlet?

社会主义新天地 提交于 2020-05-13 07:48:11
问题 I'm wondering what is the best practice in handeling servlets when dealing with a many pages in a website. Most GET requests in servlets simply return a new jsp page. I had thought of two approaches: Assign a servlet for each path in the webiste e.g a homeservlet for home page, registerservlet for registration page, loginservlet for login page etc. Have a small number of servlets that process multiple paths and handle them accordingly e.g. A UserServlet that could do the job of registration

Java project with Gradle and building jar file in Intellij IDEA - how to?

对着背影说爱祢 提交于 2020-05-10 04:09:20
问题 Is there anywhere a tutorial on how to create Java project with Gradle and then build the jar file? I'm running into various problems with that. When I create Java project and then add Gradle with File -> New -> Module -> Gradle -> ... then I get some errors about Java EE websocket's not available (I'm using Ultimate Edition) but nevermind about that, I managed to create that project by selecting File -> New -> Project... -> Gradle -> ... and now I have my Java project with Gradle working

Client call to EJB error: javax.naming.NoInitialContextException

强颜欢笑 提交于 2020-04-30 08:45:31
问题 Calling my EJB from class Main: MyService myService = (MyService) ctx.lookup(MyService.class.getName()); Gives error: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) at javax.naming.InitialContext

Spring-Security PasswordEncoder returns null

蓝咒 提交于 2020-04-11 16:26:11
问题 I have implemented Spring security on my struts2 application and it perfectly works, but it runs into error java.lang.NullPointerException on line 3. Although it seems passwordEncoder configuration works as by adding those I cant login with a plain text password any more. <authentication-manager> <authentication-provider> <password-encoder ref="passwordEncoder"/> <jdbc-user-service data-source-ref="dataSource" users-by-username-query=" select username,password,enabled from Users where

What's the default scope for a bean created by a @Produces method without a scope annotation?

荒凉一梦 提交于 2020-04-10 08:01:26
问题 I've got a method with a @Produces annotation that creates an Apple . When I use it with @ApplicationScoped like this public class AppleProducer { @ApplicationScoped @Produces public Apple createApple() { return new Apple(); } } then the Apple gets created only once for the whole application. When I use it with @RequestScoped like this public class AppleProducer { @RequestScoped @Produces public Apple createApple() { return new Apple(); } } then it gets created for every request. But what if