I facing a problem with checkbox value that already exists inside the database. so how can I retrieve those value into another database table? The table subject and service below is what I want. But based on the code below the SERVICE TABLE on SUBJECTID COLUMN producing null value. How to remove those null value with subjectid value? I don't understand that well because I am a newbie. SUBJECT TABLE (Values inside subject table already exists) SUBJECTID SUBJECTNAME ----------- ---------------- PT3_ENGLISH ENGLISH PT3_BM BAHASA MELAYU PT3_SC SCIENCE PT3_MATH MATHEMATICS CURRENT SERVICE TABLE IN DB SERVICE TABLE SERVICEID SERVICECATEGORY SERVICETYPE STUDENTID …

Member Avatar
+0 forum 0

I want to learn web programming with Java. I'm using eclipse neon with tomcat 8.5.13. My question is do these tools support asynchronous programming and server push technologies or should I use other tools? Thanks

Member Avatar
Member Avatar
+0 forum 1

Hello all, I have a J2EE application that displays a dropdown of items, in Arabic text. This data is stored in a table in underlying MySQL server. The DB character set is set to utf8 and I have in my JSP the carset encoding as utf8 as well. This works correctly on my workstation that runs windows 10, with my local MySQL db and other components [tomcat7 and httpd]. When I deploy my webapp WAR on the server [Centos7, linux], that has its own MySQL/tomcat7/httpd [all same versions and setups], then the content of my drop-down that's coming from MySQL …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone, I am populating a dropdown list in my webapp, from a MySQL database table. There are around 160,000 records in the table. When I start my webapp and when populating the content of the drop-down, it takes incredible amount of time, and eventually the browser crashes. I am not sure if this is normal for 160k records, or I maybe doing something incorrect? HEre's what I have done. **Note: If I choose to load a small amount of records, say 100, then there's no problem at all. My servlet: protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException …

Member Avatar
Member Avatar
+0 forum 5

Hello everyone, I need to pass some parameters from my servlet to my JSP. I am able to access 2 of my parameters from the request object, but one of them is returning null value. Here's my servlet snipet: request.setAttribute("selectedA", aBook); request.setAttribute("selectedB", bBook); request.setAttribute("book_ref", book_ref); logger.info("book_ref = " + book_ref); // <-- The value for book_ref is correct in my servlet. RequestDispatcher rd = request.getRequestDispatcher("/jsp/book.jsp"); rd.forward(request, response); From my JSP, here's the snipet: The first two parameters are coming back alright. The last one comes back null. In my servlet, I do a printout, and the value of book_ref is …

Member Avatar
Member Avatar
+0 forum 4

Dear Experts When we create table in MS Access we enter description of field in description column. I am able to get the field name and data type from the table but how can I get the description from the table. Here is the code by which I am getting field name public ArrayList<String> fetchtable(String value) { try { makeConnection(); String str1="Select * from "+ value; ResultSet rs = st.executeQuery(str1); rsmd = rs.getMetaData(); NumOfCol= rsmd.getColumnCount(); for(int i=1;i<=NumOfCol;i++) { ColumnName = rsmd.getColumnName(i); System.out.println(ColumnName); columns.add(ColumnName); } //System.out.println("Columns Valuessss is:" +columns); }catch(Exception ae){ ae.printStackTrace(); } return columns; } Kindly refer the image ![4bfe0a317b79c671bff1964504f53eac](/attachments/large/2/4bfe0a317b79c671bff1964504f53eac.JPG …

Member Avatar
Member Avatar
+0 forum 6

Hi, I have linux based hosting. I need to upload and work the jsp/servlet pages. after i uploaded the files into the hosting, when i checked the files , it shows the code itslef. How to fix this. Please help me. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

I have two different format of code for insert query using jsp+servlet+mysql. Code-1 ====== Class.forName(JDBC_DRIVER); // Open a connection out.println("Connecting to a selected database..."); con = DriverManager.getConnection(DB_URL, USER, PASSWORD); out.println("Connected database successfully..."); // Execute a query st = con.createStatement(); sql = "insert into users (name,email,password) values ('" + name + "','" + email + "','" + password + "')"; out.println(sql); int i = st.executeUpdate(sql); if (i > 0) { out.println("Inserted!!"); } Code-2 ====== Class.forName(JDBC_DRIVER); con = DriverManager.getConnection(DB_URL, USER, PASSWORD); PreparedStatement ps; st = con.createStatement(); sql = "insert into users (name,email,password) values (?,?,?)"; ps = con.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); ps.setString(1, name); ps.setString(2, email); …

Member Avatar
Member Avatar
+0 forum 1

hi ! i ve just started doing mysql. i am making a web application in which employees database is reqiured to be shown in the table. i ve made a database name "educrm" and table name is "info", which i ve done in mysql through xampp(phpMyAdmin). i am showing u the page in which code is written. but it is showing me lots of error like full of page... plz help me regarding this. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" import=”java.io.*” errorPage="" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <%@page contentType=”text/html” pageEncoding=”UTF-8″%> <%@ page import="java.io.*,java.util.*,java.sql.*"%> <%@ …

Member Avatar
Member Avatar
+0 forum 4

I am trying to add some text in to a page by using a textarea where text is entered the text gets saved in to a database after clicking on a add button on a page. However, I am unable to achieve this after trying. I have two tables matchreportcomments and fixtures matchreportcomments is where the match reports are supposed to be saved and it has fields id fixtureId as foreign key fixtureId and report where match reports are saved and fixtures table has primary key id . A list of all the classes that are relavent to this are …

Member Avatar
+0 forum 0

I'm trying to use html onclick in java servlets like this; ShoppingCart cart = new ShoppingCart(); out.println(" <h1><button type=\"button\" onclick=\"cart.addBook(b.getIsbn())\">add</button> </h1>"); addBook is a method in ShoppingCart class, and I'm calling it when the button is clicked, but it's not getting called. Please help.

Member Avatar
Member Avatar
+0 forum 2

Hi every body, I tried to search for my own problem, I would think this must be popular issue but unfortunately I found no solution in Google. I tried to use `(boolean) session.getAttribute("IsValidUser")` to get the attribute of Session, but that caused error: org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP PWC6197: An error occurred at line: 8 in the jsp file: /WEB-INF/jsp/index.jsp PWC6199: Generated servlet error: inconvertible types required: boolean found: java.lang.Object So below is my JSP code: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page session="true" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%! boolean IsValidUser = false ; %> …

Member Avatar
Member Avatar
+0 forum 2

Im trying to integrate my website with facebook so that users wont have to sign up. By just using their FB accounts, they can automatically be logged in, but im encountering an error: java.lang.NullPointerException at com.fblogin.CallbackServlet.doGet(CallbackServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) What should I do about it?

Member Avatar
Member Avatar
+0 forum 1

I want to connect my website with Facebook. I'd like my user to be able to login to my site without having to sign up. Jut by clicking the facebook logo, I will be able to fetch the data needed like their email, name, age, etc. I used **restFB** but, I want to use other which functions the same. I downloaded the restFB but there's an error: { "error": { "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.", "type": "OAuthException", "code": 191 } } I am guessing the reason I got the error is I didnt …

Member Avatar
+0 forum 0

Question regarding concurrency. Imagine 10 different doGet() requests from 10 different users around the world called within milliseconds of each other to a servlet called LoginServlet.java. Inside the servlet's doGet() method is a call to DbUtil.getConnection(). The DBUtil class is static and the method getConnection() is also static. What happens here? What are possible race conditions, concurrent issues, etc etc? Can there be corruption between connections or something? Is there a better alternative to this design for connection pooling? @WebServlet("/LoginServlet.secure") public class LoginServletextends HttpServlet { private static final long serialVersionUID = 1L; public LoginServlet() { super(); } protected void doGet(HttpServletRequest …

Member Avatar
Member Avatar
+0 forum 1

I have the following code that prints out something like a database using a velocity engine and the output is printed to a console. Though what I'm asked is to generate HTML code using a Velocity template. The **Velocity Test Class** import java.io.StringWriter; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; public class VelocityTest { public static void main( String[] args ) throws Exception { VelocityEngine ve = new VelocityEngine(); ve.init(); Template t = ve.getTemplate( "hello.vm" ); VelocityContext context = new VelocityContext(); StringWriter writer = new StringWriter(); CarInfo[] car=new CarInfo[10]; car[0] = new CarInfo("BMW", "X","6","red","3.0","200","30","05","2010","manual","diesel","premium"); car[1] = new CarInfo("Seat", "Ibiza", "2","not specified","1.0", …

Member Avatar
Member Avatar
+0 forum 1

Hi , I have a JSP page where i have few checkboxes and i have disabled few of them usign javascript for certain conditions. When i fetch the value from checkbox using `request.getParameterValues("CheckBoxName");` , then do i get the values from disabled checkboxes too or disabled checkboxes are not considered by java when we fetch value? Here is the code , checkbox with id s1 and s2 are dibaled using javascript <form action="booking_cnf" method="post"> <!-- checkbox id is same as the value of SeatNo in the database --> <!-- checkbox with id=1 and id=2 are disabled using javascript --> <input …

Member Avatar
Member Avatar
+0 forum 1

# I want to give a button in my JSP page, which on click of it should store an image in the filesystem. # Following is the code ScreenCapture.java which is a servlet. Purpose: To capture the screen of working area and store it in file system. Problem: - An image file is stored in file system with blank image. ## Please help me to fix what is wrong ## . import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import …

Member Avatar
Member Avatar
+0 forum 1

Hey there guys :) I need to create a page (HTML) which contains some static content, and an `iframe`. The `iframe` is used to contain an external page, so I am trying to 'inject' the source of the page into the document element of the` iframe`. You would ask me, why not directly set the `src` attribute of the `iframe` element? Well, I need to process and alter the HTML of the source page before posting it, so this is out of the question. I should probably add that I am developing an application in Java, so I'm using Servlets …

Member Avatar
Member Avatar
+0 forum 1

I am working on a dynamic project for my own but struggling to create an article. The idea is that one registered user can publish an article with an image . <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <form method="post" action="${pageContext.request.contextPath}/articlecontroller" encType="multipart/form-data"> <input type="file" name="file" value="Select image ..." /> title:<input type="text" name="title"/><br/> content: <textarea name="content" cols="80" rows="15"></textarea> <br/> poster:<input type="file" name="poster"/><br/> <input type="submit" value="Start upload" /> </form> </body> </html> and the servlet …

Member Avatar
Member Avatar
+0 forum 2

How to forward data to jsp from Servlet multiple times using request dispatcher. I have tried with timer in servlet with request dispatcher to forward updated data from databases to jsp page to display result. i laso tried with page refreshing with single jsp page

Member Avatar
Member Avatar
+0 forum 1

Hi, Guys! Actually I want to ask about servlet and ajax. Sorry if I post in wrong room, I have search the room that suitable for my question, but the most suitable is here. I'm developing a push notification for web using servlet + ajax. I have done an tutorial from[ this pages](http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/async-servlet/async-servlets.html). Yes, it is working. But my problem is how to modify the program to push message privately (for specific user). I have searched it, but some tutorial suggest to use websocket. So, by using websocket, I must start from the beginning. Do you have any suggestion to …

Member Avatar
Member Avatar
+0 forum 2

Basically I have a java application that can display the data it outputs onto a webpage. I have a div containing tables, each table representing one java object and its values, after a period of time I want AJAX to refresh that div with the new data. Problem, I'm using a java servlet as certain actions have to be performed on the data before it can be displayed on the page(they are snmp objects so I have to use snmp methods to get the values of their OIDs). It seemed to work at first but I noticed the refresh interval …

Member Avatar
Member Avatar
+0 forum 2

hi what i wan to do is to get the customer ID from the glassfisn database and displaindey it in a drop down box in a jsp page. in the index.jsp page how to i call the servlet so that the the servlet would load the jsp page? i have attached the jsp and the servlet page

Member Avatar
Member Avatar
+0 forum 5

hi i create a jsp and a servlet to get data from the data to be displayed in the jsp page. the code is below ListCustomer.jsp <table id="customerListTable" border="3"> <tr > <th bgcolor=>ID</th> <th bgcolor=>Name</th> <th bgcolor=>Address</th> <th bgcolor=>TelNo</th> <th bgcolor=>Req</th> </tr> <c:forEach var="customer" begin="0" items="${requestScope.customerList}"> <tr> <td>${customer.cusid}&nbsp;&nbsp;</td> <td>${customer.cusname}&nbsp;&nbsp;</td> <td>${customer.cusaddress}&nbsp;&nbsp;</td> <td>${customer.custelno}&nbsp;&nbsp;</td> <td>${customer.cusreq}&nbsp;&nbsp;</td> </tr> </c:forEach> </table> </body> </html> ListCustomerService.servlet protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { int id = Integer.parseInt(request.getParameter("id")); String cname = request.getParameter("cusname"); String address = request.getParameter("address"); int telno = Integer.parseInt(request.getParameter("telno")); String req = request.getParameter("req"); //customerService.createCustomer( cname, address, telno, req); customerService.createCustomer(id, cname, address, telno, req); …

Member Avatar
Member Avatar
+0 forum 7

A web server is used to process http request and send a response back to the client browser. I was wondering how does a client browser send a http request to the web server? Is it done via socket connection? Which socket connection is used to establish a connection with tomcat web server? Is it using Java sockets or the client browser have it's own socket to establish a connection with the Tomcat server? Or does the client browser uses the socket provided by the operating system to establish a connection to the Tomcat server?

Member Avatar
Member Avatar
+0 forum 2

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { int c=0; String u1=request.getParameter("u1"); String e1=request.getParameter("e1"); String user=request.getParameter("user1"); request.setAttribute("u1",u1); request.setAttribute("e1",e1); request.setAttribute("user", user); out.println("welcOme"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("Jdbc:Odbc:db5"); String str = "select * from Table1 where email=?"; out.println("welcOme"); PreparedStatement statement = con.prepareStatement(str); statement.setString(1,user); ResultSet rs=statement.executeQuery(); if(rs.next()) { out.println(rs.getString(1)+" User found!!!!<br>"); out.println("Enter the info you wanna send<br>"); out.println("<input type=text name=inf size=25 /><br>"); out.println("<input type=submit value=\"send\" /><br>"); c++; } else { out.println("Error!!! <a href=mahi6.jsp>Go back to previous page</a>"); } statement.close(); con.close(); RequestDispatcher rd=request.getRequestDispatcher("/mahi8"); rd.forward(request,response); } catch(Exception e) { out.println(e); } finally { out.close(); } } It …

Member Avatar
+0 forum 0

Using Ajax after an year...please tell me what I'm missing: JSP/Ajax File: [CODE]<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script type="text/javascript"> function login() { var xmlhttp; var username = document.getElementById('username').value; var queryString = "username="+username; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); }else{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", "LoginServlet", true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); alert(queryString); xmlhttp.send(queryString); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ alert(xmlhttp.responseText); } }; } </script> </head> <body> <input type="text" name="username" id="username" /> <input type="button" onclick="javascript:login()" value="login" /> </body> </html>[/CODE] Servlet: [CODE]package Servlets; import …

Member Avatar
Member Avatar
+0 forum 4

How can I get parameter from servlet with a specific name in android activity? like in java servlet request.getParameter("name");

Member Avatar
Member Avatar
+0 forum 13

I am creating a program that will do 67,108,864 calculations using Netbeans. But when I run it, there is an error message: java.lang.OutOfMemoryError: Java heap space. I have tried several things to overcome this problem: 1. I changed the setting of VM Options of the Project Properties. I even set the VM Options to -Xmx1024m. 2. I changed the setting of VM Options of the Tomcat Server. Here, I also set the VM Options to -Xmx1024m. 3. I disabled the HTTP Monitor. What I have not tried is changing the content of netbeans.conf file since my computer does not allow …

Member Avatar
Member Avatar
+0 forum 3

The End.