bruno martins

Greenhorn
+ Follow
since Oct 28, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by bruno martins

hi, i want to now if the metod valueUnbound(HttpSessionBindingEvent se)don�t work ....... i use the metod valuebound and it works but the valueUnbound not work, i want to now if are some other metod to replace valueUnbound metod...
20 years ago
JSP
hi, i need help this is my code :
package com.stardeveloper.web.listener;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class SessionCounter implements HttpSessionListener {
private static int activeSessions = 0;
public SessionCounter(){
}
public void sessionCreated(HttpSessionEvent se) {
activeSessions++;
}
public void sessionDestroyed(HttpSessionEvent se) {
if(activeSessions > 0)
activeSessions--;
}
public static int getActiveSessions() {
return activeSessions;
}
public void setActiveSessions() {
activeSessions--;
}

............
<%-- Sessions.jsp --%>
<%@ page import="com.stardeveloper.web.listener.SessionCounter" %>

<html>
<head>
<title>Active Sessions</title>
</head>
<body>
<p align="center">
<%HSListenerImpl act =new HSListenerImpl();%>

Active Sessions : <%=SessionCounter.getActiveSessions() %>


</p>
</body>
</html>
when i close the browser the session must call the metod sessionDestroyed()
but it not heappen var activeSessions not decrement(--)
20 years ago
JSP
Hi, i have a problem error
org.apache.jasper.JasperException: CounterBean
my code:
<%@ page import="com.bruno.CounterBean" %>
<jsp:useBean id="session_counter" class="CounterBean" scope="session" />
<jsp:useBean id="app_counter" class="CounterBean" scope="application" />
<%
session_counter.increaseCount();
synchronized(page) {
app_counter.increaseCount();
}
%>
<h3>
Number of accesses within this session:
<jsp:getProperty name="session_counter" property="count" />
</h3>
<p>
<h3>
Total number of accesses:
<% synchronized(page) { %>
<jsp:getProperty name="app_counter" property="count" />
<% } %>
</h3>
package com.bruno;
public class CounterBean {
int count;
public int getCount() {
return count;
}
public void increaseCount() {
count++;
}
}
[ December 09, 2003: Message edited by: Bear Bibeault ]
20 years ago
JSP
hi, it�s possible connect mysql whith flash and servlets
20 years ago
no Exceptions,no Errors,but the pdf file that was create don�t show anything
20 years ago
hi, i can�t display my pdf file whith this code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.*;
import java.sql.*;
public class testepdf extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://sb/cmv?user=amd&&password=123";
String n1_ = "";

Connection con1;
Statement sta1;
String sql1 = "SELECT * FROM files";
PrintWriter out = response.getWriter();
response.setContentType("application/pdf");
try {
Class.forName(driver);
con1=DriverManager.getConnection(url);
sta1 = con1.createStatement();
ResultSet rs = sta1.executeQuery(sql1);

response.setHeader("Content-disposition",
"inline; filename=\"Acta.pdf\"");
rs.next();
Blob blob = rs.getBlob(3);
if (blob != null)
{
int iLen = (int)blob.length();
response.setContentLength(iLen);
ByteArrayOutputStream output = new ByteArrayOutputStream(iLen);
output.write(blob.getBytes(1, iLen), 0, iLen);
out.write(output.toString());
}

rs.close();
sta1.close();
con1.close();

}
catch(java.lang.ClassNotFoundException e) {
out.println("ERRO na ClassNotFound: " + e.getMessage());
return;
}
catch(SQLException ex) {
out.println("ERRO na ligacao :" + ex.getMessage());
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
20 years ago
hi, i can�t display my pdf file whith this code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.*;
import java.sql.*;
public class testepdf extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://sb/cmv?user=amd&&password=123";
String n1_ = "";


Connection con1;
Statement sta1;

String sql1 = "SELECT * FROM files";
PrintWriter out = response.getWriter();
response.setContentType("application/pdf");



try {
Class.forName(driver);
con1=DriverManager.getConnection(url);
sta1 = con1.createStatement();

ResultSet rs = sta1.executeQuery(sql1);

response.setHeader("Content-disposition",
"inline; filename=\"Acta.pdf\"");

rs.next();

Blob blob = rs.getBlob(3);

if (blob != null)
{
int iLen = (int)blob.length();
response.setContentLength(iLen);
ByteArrayOutputStream output = new ByteArrayOutputStream(iLen);
output.write(blob.getBytes(1, iLen), 0, iLen);
out.write(output.toString());

}

rs.close();
sta1.close();
con1.close();

}
catch(java.lang.ClassNotFoundException e) {
out.println("ERRO na ClassNotFound: " + e.getMessage());
return;
}

catch(SQLException ex) {
out.println("ERRO na ligacao :" + ex.getMessage());
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
20 years ago
JSP
i want to now how it is possible delete files on apache tomcat jsp/servlets
[ October 28, 2003: Message edited by: Bear Bibeault ]
20 years ago
JSP