sephilPJ 21 de nov. de 2007
vc poderia postar um trecho do código?
thiagofsiPJ 21 de nov. de 2007
& lt ; form action = "index.jsp" & gt ;
& lt ; input type = "submit" value = "Next" name = "Back" /& gt ;
& lt ; input type = "submit" value = "back" name = "Next" /& gt ;
& lt ; / form & gt ;
& lt ; img src = "<%session.getAttribute(" valor ").toString().charAt(0);%>.jpg" width = "361" height = "405" /& gt ;
sephilPJ 21 de nov. de 2007
na hora q vc chama a sessao, tenta colocar o sinal de = antes e tira o ‘;’ e use aspas simples dentro de aspas duplas.
<img src="<%=session.getAttribute('valor').toString().charAt(0)%>.jpg" width="361" height="405"/>
se n funcionar tente isso:
vc pode fazer uma pag intermediaria que muda o conteudo da session, e depois retorna para sua pagina… ficaria assim:
& lt ; %
int valor = 1 ;
%>
// tag de javascript
function mudaImg & #40 ; num & #41 ; & #123 ;
if & #40 ; num == 0 & #41 ; & #123 ;
document . img . action = "mudaImg.jsp?acao=mais" ;
document . img . submit & #40 ; & #41 ;;
& #125 ; else & #123 ;
document . img . action = "mudaImg.jsp?acao=menos" ;
document . img . submit & #40 ; & #41 ;;
& #125 ;
& #125 ;
// fecha javascript
& lt ; form name="img" action=""> ;
& lt ; input type = "button" value = "Next" name = "next" onclick = "mudaImg(0);" /& gt ;
& lt ; input type = "button" value = "Back" name = "back" onclick & #58 ; "mudaImg(1);" /& gt ;
& lt ; / form & gt ;
& lt ; img src="< ; %=session.getAttribute('valor').toString().charAt(0)%>.jpg" width="361" height="405"/>
%>
mudaImg.jsp
& lt ; %
String acao = request . getParameter & #40 ; "acao" & #41 ;;
int fig=( ; Integer & #41 ; session . getAttribute & #40 ; "valor" & #41 ;;
if & #40 ; acao . equals & #40 ; "mais" & #41 ; & #41 ; & #123 ;
// aqui vc pode add um if pra ver se existe mais uma foto .
fig + = 1 ;
session . setAttribute & #40 ; "valor" , fig & #41 ;;
& #125 ; else & #123 ;
// aqui vc add um if pra verificar se está é a primeira foto .
fig - = 1 ;
session . setAttribute & #40 ; "valor" , fig & #41 ;;
& #125 ;
response . sendRedirect & #40 ; "index.jsp" & #41 ;;
%>
eu fiz e nem testei… da uma olhada ai pra ver se ta certinho
flw