Posts

Showing posts with the label jsp

How do i get input value to jquery in JSP?

Image
Clash Royale CLAN TAG #URR8PPP How do i get input value to jquery in JSP? I am doing a calendar where users are required to select multiple dates which are checkboxes. As they check each box, the counter will increase. For them to select the values on the next month, they would have to go through a submit button and the counter will be stored in a session in the servlet and it will bring them back to the same JSP page (if they did not select the maximum number of dates) retrieved using session as well. However, my problem is whenever they go onto the next month, the counter will be set back to 0 but the value does show the number of checked boxes previously when I <%System.out.println("class taken="+session.getAttribute("selectedClass")); %> <%System.out.println("class taken="+session.getAttribute("selectedClass")); %> Input value (JSP): No of Classes selected: <b><input type="text" id="count-class" name=...

Setting Up Fine Uploader using Java

Image
Clash Royale CLAN TAG #URR8PPP Setting Up Fine Uploader using Java how to set up an endpoint in Fine Uploader using java and servlet? how to set up an endpoint in Fine Uploader using java and servlet? – Christophe Resurreccion 18 mins ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Wait_timeout in a tomcat app

Image
Clash Royale CLAN TAG #URR8PPP Wait_timeout in a tomcat app I'm building an app in a tomcat server (JSP+Servlet+Hibernate(MYSQL)), but when I test this app, when have passed 24 hrs, I recieve this error. The last packet successfully received from the server was 59,480,937 milliseconds ago. The last packet sent successfully to the server was 59,480,937 milliseconds ago. is longer than the server configured value of 'wait_timeout'. How can I solve it? Should add I wait_timeout on hibernate conf file? Should change I something on my DB? Thanks :) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

where can i write in the code to avoid duplicate byyer registration using database using jsp . i mean no multiple entries in database with same name

Image
Clash Royale CLAN TAG #URR8PPP where can i write in the code to avoid duplicate byyer registration using database using jsp . i mean no multiple entries in database with same name <% String date="NO"; String uname= request.getParameter("uname"); String fname= request.getParameter("fname"); String lname= request.getParameter("lname"); String password= request.getParameter("pass"); String email= request.getParameter("email"); String phoneno=request.getParameter("phoneno"); String photo=request.getParameter("photo"); try { ResultSet rs=null; int id=0; int i=0; String str="USR00"; Connection con=databasecon.getconnection(); Statement st=con.createStatement(); String qry="select max(id) from user"; rs=st.executeQuery(qry); if(rs.next()) { i=rs.getInt(1); i++; uid=str+i; System.out.println(uid); } //sConnection con=databasecon.getconnection(); Prepar...

How to make use of string variables in a query in jsp

Image
Clash Royale CLAN TAG #URR8PPP How to make use of string variables in a query in jsp I have 2 string variables name and password. Now I have to use these variables in a query in where condition. How should I do it. Suppose I want to execute a query- "SELECT * FROM students WHERE students.name=name and student.pass=password" I'm not able to do it. What is the right syntax for this query statement? what you are using jdbc or hibernate framework for database connection.? – Tejal 29 mins ago 1. don't put such code in JSPs. JSPs are view components, supposed to generate HTML from objects stored into request attributes, and nothing else. Learn about MVC, and put the data access code into Java classes. 2. Learn JDBC. Google for Java JDBC tutorial. Specifically, learn about prepared statements. ...

If a model attribute does not exist, when used with JSTL c:when test for a boolean value, does it always evaluate to false?

Image
Clash Royale CLAN TAG #URR8PPP If a model attribute does not exist, when used with JSTL c:when test for a boolean value, does it always evaluate to false? So for example, if in a jsp we put: <c:choose> <c:when test="${missingAttribute}"> ...do something </c:when> <c:otherwise> ...something else </c:otherwise> </c:choose> If 'missingAttribute' does not exist, will the otherwise block always be executed? In other words, do missing attributes evaluate to false? 2 Answers 2 Yes it will evaluate to false. EL expression specified in an attribute value is processed differently depending on the attribute's type category defined in the TLD. In core when tag, it should evaluate to boolean. In core out tag to String, etc., In your scenario, you need to have c:choose tag enclosing c:when and c:otherwise. <c:if test...

How do i store getParameterValues(“”) into an Array List using for loop in Servlet?

Image
Clash Royale CLAN TAG #URR8PPP How do i store getParameterValues(“”) into an Array List using for loop in Servlet? There is a for loop to display the days on my "calendar" and users are able to select multiple days, as there will be a checkbox beside each day as shown below. JSP: <td class="day_cell"> <%=days[i][j]%> <input type="checkbox" value="<%=days[i][j]%>/<%=monthName%>/<%=intYear%>" name="date"> </td> The following are the codes in my Servlet. I get the dates from multiple check boxes. How can I save the dates into an arraylist? Servlet: Calendar cal = new Calendar(); cal.setDate(request.getParameterValues("date")); String results = request.getParameterValues("date"); for (int i = 0; i < results.length; i++) { System.out.print(results[i]); } try { DBAO myDatabase = new DBAO(); myDatabase.updateDate(cal, results); request.getRequestDispatc...