Discussions
Categories
- 196.7K All Categories
- 2.2K Data
- 234 Big Data Appliance
- 1.9K Data Science
- 449.7K Databases
- 221.5K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 549 MySQL Community Space
- 477 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 532 SQLcl
- 4K SQL Developer Data Modeler
- 186.8K SQL & PL/SQL
- 21.2K SQL Developer
- 295.3K Development
- 17 Developer Projects
- 138 Programming Languages
- 292K Development Tools
- 104 DevOps
- 3.1K QA/Testing
- 645.9K Java
- 27 Java Learning Subscription
- 37K Database Connectivity
- 153 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 17 Java Essentials
- 157 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 203 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 387 LiveLabs
- 37 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.6K Other Languages
- 2.3K Chinese
- 170 Deutsche Oracle Community
- 1K Español
- 1.9K Japanese
- 230 Portuguese
Inserting data into MySQL database

908365
Member Posts: 3
Hi Everyone!
Over here, I'm creating a non-members registration page. my homework consists of a table with the following fields, mid,name, pword (namely members ID, name and password respectively) in a MySQL database.
Right now, I'm stuck with the controller jsp especially the part where the output confirmation goes.
Please take note that the output confirmation part is from another homework so there might be some confusion.
it actually compares data from two different tables but i'm working on a solo one currently.
Can you guys help me with the problem?
Please feel free to provide me with your suggestions and comments.
Thanks in advance and sorry I'm clear in my explanation.
Here's my requestJoin.jsp
Over here, I'm creating a non-members registration page. my homework consists of a table with the following fields, mid,name, pword (namely members ID, name and password respectively) in a MySQL database.
Right now, I'm stuck with the controller jsp especially the part where the output confirmation goes.
Please take note that the output confirmation part is from another homework so there might be some confusion.
it actually compares data from two different tables but i'm working on a solo one currently.
Can you guys help me with the problem?
Please feel free to provide me with your suggestions and comments.
Thanks in advance and sorry I'm clear in my explanation.
Here's my requestJoin.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Fantasy Football</title> </head> <body> <h1>Joining the league</h1> <form action="requestQuery.jsp" method="post"> Enter your name: <input type="text" name="name" value="${param.name}" /> <c:if test="${empty param.name && param.submitted}"> <span style="color:red"> * please fill in field</span> </c:if> <br /> Enter your password:<br /> <textarea name="password" rows="6" ><c:if test="${!empty param.password}">${param.password}</c:if></textarea> <c:if test="${empty param.password && param.submitted}"> <span style="color:red"> * please fill in field</span> </c:if> <br /> <input type="hidden" name="submitted" value="true" /> <p /> <input type="submit" value="SUBMIT" /> </form> </body> </html>Then the requestQuery.jsp (controller)
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %> <c:choose> <c:when test="${empty param.name || empty param.password}"> <%-- empty so go back to form --%> <jsp:forward page="requestJoin.jsp" /> </c:when> <c:otherwise> <%-- insert new data into table --%> <sql:update> insert into member (mid,name,pword) values (null,?,?) <sql:param value="${dbd}" /> <sql:param value="${fn:toLowerCase(param.name)}" /> </sql:update> <%-- output confirmation --%> <sql:query var="dbResult" scope="request"> select * from drequest,degree where drequest.did=degree.did and name = '${fn:toLowerCase(param.name)}' </sql:query> <jsp:forward page="requestResult.jsp" /> </c:otherwise> </c:choose>Finally, my requestResult.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!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=UTF-8"> <title>JSP Confirm Page</title> </head> <body> <h1>Confirmation!</h1> <%-- display data held in query ran in requestQuery --%> Thank you ${dbResult.rows[0].name} for your registration <br /> </body> </html>
Answers
-
>Right now, I'm stuck with the controller jsp especially the part where the output confirmation goes.Do you mean that the requestResult.jsp page does not display the result correctly? Didn't you get any exception thrown?
-
Hi,
Thanks for your reply!
No worries I have got it settled by removing the output confirmation.
Cheers!
This discussion has been closed.