Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

rafael muneton

+ Follow
since Aug 16, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by rafael muneton

Thank you Rob and Tim.
I will follow your recommendations, will replace scriplets with JSTL tags and later i will go for a controller servlet.

Anyway i will keep you posted.

Thank you guys.

1 year ago
I don't know if this is the right place for my question, if this is not, please redirect me to the right one.

From some place in the web i copied the stuff to connect to Mysql using a DataSource and tried to adapt to my application.
It doesn't work.
I am using Tomcat 9.0.10, Mysql 5.7.

The problem is i am receiving 2 errors and i think they are the result of a bad connection.

Here are the errors:

25-Aug-2018 06:30:22.756 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/agenda] threw exception [Unable to compile class for JSP:

An error occurred at line: [17] in the jsp file: [/validate.jsp]
rsAgenda cannot be resolved
14:      <sql:param value = "${password}" />
15: </sql:query>  
17: <% if (rsAgenda.size() != 1) { %>
18:   <ora:redirect page="login.jsp" >
19:    <ora:param name="errorMsg" value="Clave de Usuario y/ Password son invalidos" />
20:   </ora:redirect>

An error occurred at line: [25] in the jsp file: [/validate.jsp]
rsAgenda cannot be resolved
22: <%--
23: Crea una userJavaBean y la guarda en session scope.
24: --%>
25: <% Row oneRow = (Row) rsAgenda.firstElement(); %>
26: <jsp:useBean id="validUser" scope="session" class="com.ora.jsp.userJavaBean" >
27: <jsp:setProperty name="validUser" property="usuario" value='<%= oneRow.getString("usuario") %>' />
28: <jsp:setProperty name="validUser" property="password" value='<%= oneRow.getString("password") %>' />

Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:

And here is the validate.jsp  program:

The context.xml:[/u]

<Resource name="jdbc/Mysql1" auth="Container" type="javax.sql.DataSource"
              maxTotal="100" maxIdle="30" maxWaitMillis="10000"
              username="root" password="root" driverClassName="com.mysql.jdbc.Driver"

[b]The web.xml:[/b]

<web-app xmlns="";
 <description>MySQL Agenda App</description>
     <description>DB Connection</description>

Any ideas?
Any help is welcome.


1 year ago
OK guys:

I got the point I will try to stick to JSTL and ETL. I'll keep you posted.
Thanks anyway.

4 years ago
Hello guys:

I agree with you, the book i am reading is from the year 2001 and surely is obsolete, but for starters what can i do?
I wil try to drop of the java code from the JSP's and see what happens.

Thanks a lot.

4 years ago
Hello everyone:

I am trying to develop a small app just to learn Jsp and I have being stopped by a problem:

The error message I receive is :

An error occurred at line: 13 in the jsp file: /validate.jsp
equiposLog cannot be resolved
10: <ora:sqlStringValue param="password" />
11: </ora:sqlQuery>
13: <% if (equiposLog.size() > 0) { %>
14: <jsp:forward page="mainmenu.html" />
15: <% } else { %>
16: <jsp:forward page="login.jsp" />

It seems to be very simple, but not for me.
Here is the login.jsp program:

<%@ page language="java" contentType="text/html" %>
<%@ page import="com.ora.jsp.util.*" %>
<%@ taglib uri="/orataglib" prefix="ora" %>
<title>Proyecto LigaMX</title>
<h2>Proyecto LigaMX </h2>
<body bgcolor="#cccccc">
<img src="tareas02.jpg" height="80" width="40" align="center"/>

<jsp:useBean id="errorMessages" scope="request" class="java.util.Vector" />

<%-- Errores reportados, si los hay. --%>
<font color="red">
<ora:loop name="errorMessages" loopId="msg" className="String" >
<li> <%= msg %>

<B>Por favor teclee clave de Usuario y Password:</B>
<%-- Output form with submitted values --%>
<form action="validate.jsp" method="post">
<td><input type="text" name="usuario"
value='<%= StringFormat.toHTMLString(request.getParameter("usuario")) %>' >
<td><input type="password" name="password"
value='<%= StringFormat.toHTMLString(request.getParameter("password")) %>' >
<td colspan=2><input type="submit" value="Continuar"></td>
<td><input type="button" value="Atras" onClick="history.go(-2)"></td>


And here is the validate.jsp program:

<%@ page language="java" contentType="text/html" %>
<%@ page import="com.ora.jsp.util.*" %>

<jsp:useBean id="errorMessages" scope="request" class="java.util.Vector" />

<ora:sqlQuery id="equiposLog" dataSource="jdbc/mysql2" scope="request">
SELECT nombre FROM usuario
WHERE user = ? and password = ?
<ora:sqlStringValue param="usuario" />
<ora:sqlStringValue param="password" />

<% if (equiposLog.size() > 0) { %>
<jsp:forward page="mainmenu.html" />
<% } else { %>
<jsp:forward page="login.jsp" />
<% } %>

As you can see the first program(login.jsp) is asking user and password.
The second program(validate.jsp) tries to find this data in a Database. If positive, the control will go to mainmenu.html otherwise will return to login.jsp.
I am using Tomcat 6 as a container and MySQL as Database.

I am stucked at this point and any help would be very welcome.

4 years ago