Re:struts 2 ajaxa

vc criou uma variavel

private String cod;

com seu GET e SET

criar essa variavel no action que trabalha com a camada de visualização.

assim vc conseguirá pegar a informação.

se já for assim que vc está pegando a informação me avise

camada de visualização que eu falei era o JSP

vc tem varios radios com o mesmo nome não?

pq ele esta dentro de um interator

quando eu faço assim, eu crio um campo HIDDEN

dai com um script eu pego o valor que esta no radio e coloco no hidden

entendeu?

pq o hidden é um único campo, pode ser isso

ou

function aa( valor ){ document.getElementById('campo').value = valor; }

Gente eu estou gerando um formulario onde ele inserer uma tabela através de um div remoto que trabalha com ajax . Gente eu estou gerando essa tabela normalmente .

O unico problema é que nao to conseguindo capturar o valor do radio button …tofa vez passa como nulo !!!

Sera que tem que fazer algo a mais pra eu poder capturalo !?

o código em baixo

   <?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Criar Jogo </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../templates/questionario.css" rel="stylesheet" type="text/css" />
</head>
<s:head theme="ajax"/>
<body>
<s:form action="Questionario!inserir" theme="simple">
 
 <p id="banner"> </p>

 <div id="principal"> </div> 

     <table id="tabela">
          <tr>
             <td> Nome do Questionário : </td>
          </tr>
          <tr>
             <td> <input type="text" size="30"/> </td>             
          </tr>
          <tr>
             <td> <s:submit value="Incluir" notifyTopics="listaQsto" theme="ajax"></s:submit> </td>             
          </tr>
          
      </table>
  
      
         <s:div id="tabela_remota" href="Questionario!listaAll.action" listenTopics="listaQsto" theme="ajax"></s:div> //o div remoto
      
    <div id="rodape"> @2007 - Sophos <br/>
      Sistema Educacional a Distância <br/>
    </div>

</s:form>
</body> 
</html>
<table class="table">
     <caption> Lista de Questionários </caption> 
     <tr>
       <td> Cod. </td>
       <td> Questionário </td>
     </tr>
     
      <s:iterator value="lista" status="listaR">
         <tr>
           <td> 
               <input type="radio" name="cod" value="5555" />    // so na hora de passar esse radio pra action que nao funciona
           </td>
           <td> <s:property value="nomeQuest" /> </td>
         </tr>
      </s:iterator>
  </table>

Como assim que trabalha com a camada de visualização . Mas na verdade eu ja tenho o metodo GET E SET criado tambem .

Aqui vai codigo da minha action .

package pkg.sophos.action;

import java.sql.SQLException;
import java.util.List;

import pkg.sophos.bean.Questionario;
import pkg.sophos.dao.QuestionarioDAO;

import com.opensymphony.xwork2.ActionSupport;


public class QuestionarioAction extends ActionSupport {
	
	private QuestionarioDAO q = new QuestionarioDAO();
	
	private static final long serialVersionUID = 1L;

	private List<Questionario> lista ;
	
	private String cod ;
	
	
	public final String getCod() {
		return cod;
	}

	public final void setCod(String cod) {
		this.cod = cod;
	}

	public final List<Questionario> getLista() {
		return lista;
	}


	public final void setLista(List<Questionario> lista) {
		this.lista = lista;
	}

	public String listaAll() {
	      
        try {
		
        	lista = q.consultar();
		
        } catch (SQLException e) {
			e.printStackTrace();
		}		   
		   
		   return "questionario" ;
			
	}
	
	public void inserir() {
	      
		  System.out.println(cod);
    		
	}
    
	
	
	
}

Vo pode me mostrar um exemplo ?

Pode ser um exemplo bem basico mesmo so pra eu ter noção do que fazer

Ti agradeço mesmo

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <title> Criar Jogo </title>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <link href="../templates/questionario.css" rel="stylesheet" type="text/css" />
</head>
<s:head theme="ajax"/>
<body>
<s:form action="IncluirQuestionario!incluir.action" theme="simple">
 
 <p id="banner"> </p>

 <div id="principal"> </div> 

     <table id="tabela">
          <tr>
             <td> Nome do Questionário : </td>
          </tr>
          <tr>
             <td> <s:textfield name="questionario" size="35"> </s:textfield> </td>             
          </tr>
          <tr>
             <td> <s:submit value="Incluir"  notifyTopics="listaQsto" theme="ajax" align="left"></s:submit> </td>             
          </tr>
          
      </table>
  
      <s:div id="tabela_remota" href="ListaQuestionario!listar.action" listenTopics="listaQsto" theme="ajax"></s:div>
      
   
    

    <div id="rodape"> @2007 - Sophos <br/>
      Sistema Educacional a Distância <br/>
    </div>

</s:form>
</body> 
</html>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Criar Jogo </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
   
    <table class="table">
     <caption> Lista de Questionários </caption> 
     <tr>
       <td> Cod. </td>
       <td> Questionário </td>
     </tr>
   
    <s:iterator value="lista">
     <tr>
       <td> <input type="radio" id="cod_Radio" value="5" /> </td>
       <td> <s:property value="nomeQuest" /> </td>
     </tr>
     </s:iterator>

 </table>

 
</body> 
</html>
public class IncluirQuestionario extends ActionSupport {
	
	
	
	private static final long serialVersionUID = 1L;

	private String codQuest ;
	

	public void incluir()  {
	
		System.out.println("testando radio : " + codQuest);
		
		
	}
	
		public final String getCodQuest() {
			return codQuest;
		}

		public final void setCodQuest(String codQuest) {
			this.codQuest = codQuest;
		}

		
	
	
}

Nao ta passando mesmo o valor desse radio pra minha action incluir …Eu fiz o teste que vc postou aí e nada !!!

Bom o problem foi resolvido por mim mesmo kkkkkkkkkkkkkkk…

Se alguem passar por isso algum dia fala comigo …