jsp

how does jsp:useBean scope attribute work?

℡╲_俬逩灬. 提交于 2021-01-29 03:25:23
问题 I am trying to understand how exactly scope attribute in jsp:useBean JSP action tag works. In my understanding scope is used to indicate where the bean is located (request,session,application etc.), but after some testing I came across an interesting situation where it's not the case, please consider the following JSP code (I am using scriplets here just for the sake of simplicity): <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import=

How to add data to json using java?

﹥>﹥吖頭↗ 提交于 2021-01-28 22:08:53
问题 I have html form with two input field, which I am adding to json file on button click! JSON File { "data": { "names": [ { "no": 1, "name": "John" }, { "no": 2, "name": "Paul" } ] } } Java File String vNo = ""; String vNAme = ""; JSONParser parser = new JSONParser(); if(request.getParameter("save")!=null) { vNo = request.getParameter("no_form"); vName = request.getParameter("name_form"); JSONObject element = new JSONObject(); element.put("no", vNo); element.put("name", vName); JSONArray names

Can't access CSS and JavaScript files in JSP

≯℡__Kan透↙ 提交于 2021-01-28 19:07:56
问题 I am developing a application in JSP/Servlet using MVC. In this application I want to load index.jsp as welcome page and this page retrieves the data from database. I did it. Now the problem is that when index.jsp page loads it fetches data from database but it shows it on browser as plain text and my CSS is not working for it. I know that during translation phase JSP is converted into servlet and after processing it send output to browser so during that we have to write the relative path of

Java/JSP: How to add WaterMark on Video

天涯浪子 提交于 2021-01-28 18:41:05
问题 I'm trying to add water mark on image and video. For image i got the solution as below Image water marking code Method static void addWatermarkOnImage(String text, File sourceImageFile, File destImageFile) { try { BufferedImage sourceImage = ImageIO.read(sourceImageFile); Graphics2D g2d = (Graphics2D) sourceImage.getGraphics(); // initializes necessary graphic properties AlphaComposite alphaChannel = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f); g2d.setComposite(alphaChannel);

Google Chart Column hide option

為{幸葍}努か 提交于 2021-01-28 18:11:57
问题 I am using Google Chart to show my bubble chart. I used x, y number to locate the bubble, So I don't want to show the xnumber and ynumber column when i put cursor on.. How can I do that? Thanks a lot. enter image description here var options = { title: 'bubble graph', //legend:{position:'none'}, hAxis: { baseline:0, maxValue:200}, vAxis: { baseline:0, maxValue:100}, bubble: {textStyle: {fontSize: 11}}, width : '100%', height : '400px', backgroundColor: "transparent", tooltip: {trigger:

Google Chart Column hide option

こ雲淡風輕ζ 提交于 2021-01-28 18:10:52
问题 I am using Google Chart to show my bubble chart. I used x, y number to locate the bubble, So I don't want to show the xnumber and ynumber column when i put cursor on.. How can I do that? Thanks a lot. enter image description here var options = { title: 'bubble graph', //legend:{position:'none'}, hAxis: { baseline:0, maxValue:200}, vAxis: { baseline:0, maxValue:100}, bubble: {textStyle: {fontSize: 11}}, width : '100%', height : '400px', backgroundColor: "transparent", tooltip: {trigger:

zip a pdf file created using itext

删除回忆录丶 提交于 2021-01-28 15:10:29
问题 response.setHeader("Content-Disposition", "attachment; filename=r.pdf"); Document document1 = new Document(PageSize.A4); PdfWriter pdfWriter=PdfWriter.getInstance(document1, response.getOutputStream()); pdfWriter.setPageEvent(new HeaderAndFooter(name)); try{ document1.open(); XMLWorkerHelper worker1 = XMLWorkerHelper.getInstance(); long seed =123; Random rnd = new Random (seed); Collections.shuffle(arrlist1,rnd); for(int i=0;i<nb;i++){ String str =(String) arrlist1.get(i); worker1.parseXHtml

zip a pdf file created using itext

泪湿孤枕 提交于 2021-01-28 15:03:26
问题 response.setHeader("Content-Disposition", "attachment; filename=r.pdf"); Document document1 = new Document(PageSize.A4); PdfWriter pdfWriter=PdfWriter.getInstance(document1, response.getOutputStream()); pdfWriter.setPageEvent(new HeaderAndFooter(name)); try{ document1.open(); XMLWorkerHelper worker1 = XMLWorkerHelper.getInstance(); long seed =123; Random rnd = new Random (seed); Collections.shuffle(arrlist1,rnd); for(int i=0;i<nb;i++){ String str =(String) arrlist1.get(i); worker1.parseXHtml

Tomcat v9.0 Server at localhost failed to start in Eclipse

折月煮酒 提交于 2021-01-28 13:04:12
问题 I have a problem with Tomcat, it stopped working. I installed Tomcat 3 weeks ago and I have made more than 50 web dynamic projects, maven projects and everythings worked great. And today Tomcat stopped working. For example I make a project in Eclipse and when I try to run it I get this error: Server Tomcat v9.0 Server at localhost failed to start. I can start Tomcat from Windows services, and I can open http://localhost:8080/ page in browser, but I can't start Tomcat in eclipse. Not just for

Tomcat v9.0 Server at localhost failed to start in Eclipse

♀尐吖头ヾ 提交于 2021-01-28 13:03:54
问题 I have a problem with Tomcat, it stopped working. I installed Tomcat 3 weeks ago and I have made more than 50 web dynamic projects, maven projects and everythings worked great. And today Tomcat stopped working. For example I make a project in Eclipse and when I try to run it I get this error: Server Tomcat v9.0 Server at localhost failed to start. I can start Tomcat from Windows services, and I can open http://localhost:8080/ page in browser, but I can't start Tomcat in eclipse. Not just for