servlets

Is JSF using JSP?

夙愿已清 提交于 2020-08-22 09:37:08
问题 I am learning JSF and I have some questions regarding it. I know JSF is a UI framework for making pages and I am using it at the moment and successfully been able to make zome. However I don't understand if JSF is built on JSP, so to write your own components you need to know JSP. Or is this a completly another technology? I have not a strong foundation in Servlet/JSP programming and I wonder if I need to read anout that first? What are the best places to learn apart from the Core

HttpServletResponse#sendError How to change ContentType

匆匆过客 提交于 2020-08-06 12:45:55
问题 I'm now creating a simple Servlet to answer a form submition. This servlet receive POST request and should response Application/JSON datas. This is working well. I want now to add errors managment to my servlet: If the servlet receive bad request parameters, I want it to answer the client a 400 — "Bad Request" response with a simple {"error":"ERROR MESSAGE"} JSON response. I'm using the HttpServletResponse#sendError(int,String) to correctly send the error but the ContentType of the response

HttpServletResponse#sendError How to change ContentType

佐手、 提交于 2020-08-06 12:44:58
问题 I'm now creating a simple Servlet to answer a form submition. This servlet receive POST request and should response Application/JSON datas. This is working well. I want now to add errors managment to my servlet: If the servlet receive bad request parameters, I want it to answer the client a 400 — "Bad Request" response with a simple {"error":"ERROR MESSAGE"} JSON response. I'm using the HttpServletResponse#sendError(int,String) to correctly send the error but the ContentType of the response

HttpServletResponse#sendError How to change ContentType

不打扰是莪最后的温柔 提交于 2020-08-06 12:44:36
问题 I'm now creating a simple Servlet to answer a form submition. This servlet receive POST request and should response Application/JSON datas. This is working well. I want now to add errors managment to my servlet: If the servlet receive bad request parameters, I want it to answer the client a 400 — "Bad Request" response with a simple {"error":"ERROR MESSAGE"} JSON response. I'm using the HttpServletResponse#sendError(int,String) to correctly send the error but the ContentType of the response

HttpServletResponse#sendError How to change ContentType

六月ゝ 毕业季﹏ 提交于 2020-08-06 12:43:33
问题 I'm now creating a simple Servlet to answer a form submition. This servlet receive POST request and should response Application/JSON datas. This is working well. I want now to add errors managment to my servlet: If the servlet receive bad request parameters, I want it to answer the client a 400 — "Bad Request" response with a simple {"error":"ERROR MESSAGE"} JSON response. I'm using the HttpServletResponse#sendError(int,String) to correctly send the error but the ContentType of the response

Sending data from servlet to jsp?

梦想与她 提交于 2020-07-16 07:56:10
问题 I have a form in a jsp from which i am retrieving data to servlet via doPost method, suppose username and password now there is an empty textarea field inside the same form where i want to send the username from servlet,how do i do it? 回答1: I don't really understand your case. But there're 2 common ways to send data from servlet to JSP: Request attributes : you can use this if data is transferred along a same request. request.setAttribute("username",obj); request.getRequestDispatcher("url")

Sending data from servlet to jsp?

大城市里の小女人 提交于 2020-07-16 07:56:05
问题 I have a form in a jsp from which i am retrieving data to servlet via doPost method, suppose username and password now there is an empty textarea field inside the same form where i want to send the username from servlet,how do i do it? 回答1: I don't really understand your case. But there're 2 common ways to send data from servlet to JSP: Request attributes : you can use this if data is transferred along a same request. request.setAttribute("username",obj); request.getRequestDispatcher("url")

Prevent downloading videos in temp folder while watching videos in web browser

允我心安 提交于 2020-06-29 08:35:30
问题 I created a web application using Java and html5. I have uploaded few videos in tomcat server war folder.Say my war file name is "web". Then my videos are inside /opt/Apache/WebApps/web/videos/sample.mp4". I am using html5 video tag for playing the videos.Most of the video size is more than 100mb. My video tag is like <video src="/videos/sample.mp4"></video> Whenever I played the video, automatically download inside our temp folder of my c drive. My system RAM size is 128mb. So when I watched