Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Forum De Bell Tolls > [java]JSP + Bean
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[java]JSP + Bean

mi date una mano qui?

__________________
http://www.twitter.com/0m4r

22-02-2004 16:49
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Paul
blue-ringed

User info:
Registered: Jul 2002
Posts: 47 (0.01 al dì)
Location: Lodi
Corso: Info
Anno: fuoricorso
Time Online: 7 Days, 4:45:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

credo che le specifiche JavaBean
si aspettino un getter e un setter
che restituisca e imposti un valore dello stesso tipo
del campo relativo.
Siccome start è int, viene chiamato
il metodo setStart(int).. che non esiste nel tuo bean;
in pratica risolvi aggiungendo:

public void setStart(int s){
this.start=s;
}

__________________
..non è un arrivederci, è un addio..

22-02-2004 22:32
Click Here to See the Profile for Paul Click Here to See the Blog of Paul Click here to Send Paul a Private Message Find more posts by Paul Add Paul to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

fantastico...funziona!!!!!

__________________
http://www.twitter.com/0m4r

23-02-2004 00:06
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

avrei bisogno di una mano anche per questo...grazie

(fate finta che il mio inglese sia comprensibile dai...)

__________________
http://www.twitter.com/0m4r

29-02-2004 19:24
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Juventina
@Dublin

User info:
Registered: Dec 2001
Posts: 3334 (0.38 al dì)
Location: Trezzano s/N
Corso: specialistica informatica
Anno: 4 + 3 :/
Time Online: 44 Days, 15:17:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

(si scrive need non nedd) :d

__________________
Don't be evil ;)

29-02-2004 20:51
Click Here to See the Profile for Juventina Click here to Send Juventina a Private Message Find more posts by Juventina Add Juventina to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Juventina
(si scrive need non nedd) :d


Off-Topic:
questa non è ignoranza è il porting della dislessia per la digitazione ;PPP

__________________
http://www.twitter.com/0m4r

29-02-2004 21:18
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

dai raga, non abbandonatemi cosi!

__________________
http://www.twitter.com/0m4r

01-03-2004 10:12
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Paul
blue-ringed

User info:
Registered: Jul 2002
Posts: 47 (0.01 al dì)
Location: Lodi
Corso: Info
Anno: fuoricorso
Time Online: 7 Days, 4:45:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
una possibile soluzione...

..se ho capito bene.
Ho semplificato prendendo il valore da una costante invece che da file (ma l'interfacciamento a file non dovrebbe essere un problema).


allora due jsp:

index.jsp

code:
<%@page import="my.mine.*" %> <% Counter counter=Counter.getReference(); %> <html> <head> <title>Counter</title> </head> <body> <center><a href="click.jsp">counter<%counter.getValue()%> </a> </center> </body> </html>




click.jsp
code:
<%@page import="my.mine.*" %> <% Counter counter=Counter.getReference(); counter.dec(); response.sendRedirect("index.jsp"); %>




e due classi java (in unico file chiamato Counter.java)
code:
package my.mine; public class Counter { private final static int INIT_VALUE = 100; private int count = INIT_VALUE; private static Counter counter = null; private Counter() { new Cleaner(this).start(); } public static Counter getReference() { if (counter == null) { Counter.counter = new Counter(); } return counter; } synchronized public void dec() { this.count--; } synchronized public int getValue() { return count; } synchronized void clean() { this.count = INIT_VALUE; } } class Cleaner extends Thread { private final static int TIMEOUT = 1000000; //in millisecondi Counter counter; Cleaner(Counter counter) { this.counter = counter; } public void run() { try { while (true) { synchronized (this) { wait(TIMEOUT); } counter.clean(); } } catch (InterruptedException e) { } } }



note:

Le due classe opportunamente compilate vanno infilate
come al solito sotto WEB-INF/classes.
La classe Counter realizza il pattern Singleton.
Dovrebbe Funzionare(non ho fatto grossi test)
:)

__________________
..non è un arrivederci, è un addio..

02-03-2004 23:03
Click Here to See the Profile for Paul Click Here to See the Blog of Paul Click here to Send Paul a Private Message Find more posts by Paul Add Paul to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ti ringrazie della risposta, ti faro sapere entro fine settimana se funziona.

P.S.
anche te hai avuto alcuni problemi collegandoti al sito di java in questi giorni?

__________________
http://www.twitter.com/0m4r

03-03-2004 12:17
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Paul
blue-ringed

User info:
Registered: Jul 2002
Posts: 47 (0.01 al dì)
Location: Lodi
Corso: Info
Anno: fuoricorso
Time Online: 7 Days, 4:45:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Mi sono accorto di un errore di copia e incolla
la riga:
<a href="click.jsp">counter<%counter.getValue()%>
va corretta con:
<a href="click.jsp">counter<%=counter.getValue()%>

senno' il numero che decrementa non si vede.

si ieri java.sun.com non andava, oggi sembra tutto ok

__________________
..non è un arrivederci, è un addio..

03-03-2004 12:38
Click Here to See the Profile for Paul Click Here to See the Blog of Paul Click here to Send Paul a Private Message Find more posts by Paul Add Paul to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
0m4r
.grande:maestro.

User info:
Registered: Mar 2002
Posts: 7287 (0.85 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

riguardando meglio il tuo codice mi sono accorto che forse non è proprio quello che cercavo io.
Nel senso che quello di cui necessito è di avere un meccanismo che ogni giorno a mezzanotte resetti il contatore ad un valore che io stabilisco a propri, mentre, se ben ho capito quello che fa la classe che mi hai scritto, tu li ti occupi di decrementare il contatore gestendo la sincronizzazione di questa operazione. Io questo lo faccio gia, quello che mi manca è quanto detto precedentemente...

Dato questo chiarimento, hai suggerimenti?

__________________
http://www.twitter.com/0m4r

04-03-2004 19:43
Click Here to See the Profile for 0m4r Click Here to See the Blog of 0m4r Click here to Send 0m4r a Private Message Find more posts by 0m4r Add 0m4r to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Paul
blue-ringed

User info:
Registered: Jul 2002
Posts: 47 (0.01 al dì)
Location: Lodi
Corso: Info
Anno: fuoricorso
Time Online: 7 Days, 4:45:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

quello che fa la mia classe e' resettare a un valore predefinito
ogni tot secondi il contatore.
Se hai bisogno che cio' avvenga a mezzanote (o a un orario qualsiasi di ogni giorno), puoi modificare la classe in questo modo:

while (true) {
synchronized (this) {
wait(TIMEOUT);
}
if (isMezzanotte()){
counter.clean();
}
}


il metodo isMezzanotte() ovviamente e' da implementare (deve ritornare true se l'orario corrente è mezzanotte o quello che vuoi tu).
A questo punto il campo TIMEOUT diventa i millisecondo ogni
quando si controllo che l'orario sia mezzanotte...

(non sarebbe carino togliere il wait() o mettere a 0 TIMEOUT, in quanto la CPU sarebbe al 100% o quasi a controllare ogni istante che sia mezzanotte)

ultima nota, probabilmente i synchronized sono inutili dal punto di vista pratico.

__________________
..non è un arrivederci, è un addio..

05-03-2004 08:45
Click Here to See the Profile for Paul Click Here to See the Blog of Paul Click here to Send Paul a Private Message Find more posts by Paul Add Paul to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 17:33.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.115 seconds (41.95% PHP - 58.05% MySQL) con 24 query.