Check-in [4b8eccaca6]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:registro cliente, sale error
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4b8eccaca6edc7617a853d066c9a97daea80f891
User & Date: malcon 2015-01-11 11:12:22
Context
2015-01-11
11:46
persintencia reserva check-in: c77a94e144 user: malcon tags: trunk
11:12
registro cliente, sale error check-in: 4b8eccaca6 user: malcon tags: trunk
2015-01-10
09:45
logica registrar cliente check-in: 871017974d user: malcon tags: trunk
Changes

Changes to WebContent/WEB-INF/tiles.xml.

72
73
74
75
76
77
78








79
80
81
	<definition name="d_crucero_web" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/crucero.jsp"/>	
	</definition>
	
	<definition name="d_contactenos_web" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/contactenos.jsp"/>	
	</definition>








		

</tiles-definitions>







>
>
>
>
>
>
>
>



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	<definition name="d_crucero_web" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/crucero.jsp"/>	
	</definition>
	
	<definition name="d_contactenos_web" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/contactenos.jsp"/>	
	</definition>
	
	<definition name="d_registroCliente" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/cliente/registro.jsp"/>
	</definition>
	
	<definition name="d_edicionCliente" extends="d_plantilla">
		<put-attribute name="contenido" value="/WEB-INF/website/cliente/edicion.jsp"/>
	</definition>
		

</tiles-definitions>

Added WebContent/WEB-INF/website/cliente/edicion.jsp.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<%@ page language="java" contentType="text/html; charset=US-ASCII"
    pageEncoding="US-ASCII"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>edicion cliente</title>
</head>
<body>

</body>
</html>

Added WebContent/WEB-INF/website/cliente/registro.jsp.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

<%@taglib prefix="s" uri="/struts-tags" %>


<link href="<s:url value='/css/formoid-solid-blue.css'/>"  media="all" rel="stylesheet" type="text/css"/>
 <link href="<s:url value='/js/formoid-solid-blue.js'/>" rel="javascript"/>


	<s:form action="edicionCliente"  namespace="/cliente" method="post" cssClass="formoid-solid-blue" cssStyle="background-color: #ffffff; font-size: 13px; font-family: 'Lucida Sans Unicode','Lucida Grande',sans-serif; color: #34495E; max-width: 600px; min-width: 350px">
    <s:hidden name="cliente.codigo" />
    
        <div class="title">
            <h2>Registro</h2>
        </div>
        <div class="element-separator">
            <hr>
            <h3 class="section-break-title">Información Personal</h3>
        </div>
        <div class="element-name">
            <label class="title"></label>
            <span class="nombre">
                <input placeholder=" Nombre" type="text" size="8" name="cliente.nombres"><span class="icon-place"></span></span>
        </div>
        <div class="element-name">
            <label class="title"></label>
            <span class="nameFirst">
                <input placeholder=" Apellido Paterno" type="text" size="8" name="cliente.ap_paterno"><span class="icon-place"></span></span><span class="nameLast">
                <input placeholder=" Apellido Materno" type="text" size="14" name="cliente.ap_materno"><span class="icon-place"></span></span>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="cliente.dni" placeholder="DNI"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="cliente.ruc" placeholder="RUC"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-phone">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="tel" pattern="[+]?[\.\s\-\(\)\*\#0-9]{3,}" maxlength="24" name="cliente.telefono" placeholder="Celular" value=""><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="cliente.direccion" placeholder="Dirección"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-separator">
            <hr>
            <h3 class="section-break-title">Información de Usuario</h3>
        </div>
        <div class="element-email">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="email" name="cliente.email" value="" placeholder="Email"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-password">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="password" name="password" value="" placeholder="Contraseña"><span class="icon-place"></span>
            </div>
        </div>
        
        <div class="submit">
            <input type="submit" value="Registrarme">
        </div>
  </s:form>

Changes to WebContent/WEB-INF/website/login.jsp.

18
19
20
21
22
23
24
25
26
    <div class="element-password">
        <label class="title"></label>
        <div class="item-cont">
            <input class="large" type="password" name="password" value="" placeholder="Contraseña" /><span class="icon-place"></span></div>
    </div>
    <div class="submit">
        <input type="submit" value="Iniciar Sesión" /></div>
       <span class="registrar">No estas registrado ? Haga click <a href="registro.html">Aqui</a></span>
</form>







|

18
19
20
21
22
23
24
25
26
    <div class="element-password">
        <label class="title"></label>
        <div class="item-cont">
            <input class="large" type="password" name="password" value="" placeholder="Contraseña" /><span class="icon-place"></span></div>
    </div>
    <div class="submit">
        <input type="submit" value="Iniciar Sesión" /></div>
       <span class="registrar">No estas registrado ? Haga click <a href="<s:url action="registroCliente"  namespace="/cliente"/>">Aqui</a></span>
</form>

Deleted WebContent/WEB-INF/website/registro.jsp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75


<link href="../content/formoid1/formoid-solid-blue.css" rel="stylesheet">
<script src="../content/formoid1/formoid-solid-blue.js"></script>

    <form class="formoid-solid-blue" style="background-color: #ffffff; font-size: 13px; font-family: 'Lucida Sans Unicode','Lucida Grande',sans-serif; color: #34495E; max-width: 600px; min-width: 350px" method="post" novalidate="novalidate">
        <div class="title">
            <h2>Registro</h2>
        </div>
        <div class="element-separator">
            <hr>
            <h3 class="section-break-title">Información Personal</h3>
        </div>
        <div class="element-name">
            <label class="title"></label>
            <span class="nombre">
                <input placeholder=" Nombre" type="text" size="8" name="name[first]"><span class="icon-place"></span></span>
        </div>
        <div class="element-name">
            <label class="title"></label>
            <span class="nameFirst">
                <input placeholder=" Apellido Paterno" type="text" size="8" name="name1[first]"><span class="icon-place"></span></span><span class="nameLast">
                <input placeholder=" Apellido Materno" type="text" size="14" name="name1[last]"><span class="icon-place"></span></span>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="input" placeholder="DNI"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="input1" placeholder="RUC"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-phone">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="tel" pattern="[+]?[\.\s\-\(\)\*\#0-9]{3,}" maxlength="24" name="phone" placeholder="Celular" value=""><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-input">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="text" name="input2" placeholder="Dirección"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-separator">
            <hr>
            <h3 class="section-break-title">Información de Usuario</h3>
        </div>
        <div class="element-email">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="email" name="email" value="" placeholder="Email"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-password">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="password" name="password1" value="" placeholder="Contraseña"><span class="icon-place"></span>
            </div>
        </div>
        <div class="element-password">
            <label class="title"></label>
            <div class="item-cont">
                <input class="large" type="password" name="password" value="" placeholder="Repita su contraseña"><span class="icon-place"></span>
            </div>
        </div>
        <div class="submit">
            <input type="submit" value="Registrarme">
        </div>
    </form>

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Changes to src/action/ClienteAction.java.

1
2
3
4
5
6
7


8

9
10
11
12
13
14
15
16
17

18
19

20
21
22
23
24
25
26
..
34
35
36
37
38
39
40

41








42
43
44
45
46
47
48
package action;

import java.util.List;

import util.Constantes;
import negocio.ClienteService;
import negocio.ClienteServiceDAO;


import model.Cliente;


import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class ClienteAction extends ActionSupport implements Preparable{

	private static final long serialVersionUID = 1L;
	private List<Cliente> clientes;
	private Cliente cliente=new Cliente();

	
	private ClienteService clienteService = new ClienteServiceDAO();

	
	
	public Cliente getCliente(){
		return cliente;
	}
	public void setCliente(Cliente cliente){
		this.cliente = cliente;
................................................................................
	
	public String buscar() throws Exception {
		clientes= clienteService.buscar(cliente);
		return SUCCESS;
	}
	
	public String editar() throws Exception{

		if(cliente.getCodigo()==null){








			clienteService.registrar(cliente);
			String[] params = new String[]{getText(Constantes.MODULO_CLIENTE)};

			addActionMessage(getText(Constantes.MENSAJE_INSERT_OK,params));
		} else {
			clienteService.actualizar(cliente);
			String[] params=new String[]{







>
>

>









>


>







 







>

>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package action;

import java.util.List;

import util.Constantes;
import negocio.ClienteService;
import negocio.ClienteServiceDAO;
import negocio.UsuarioService;
import negocio.UsuarioServiceDAO;
import model.Cliente;
import model.Usuario;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class ClienteAction extends ActionSupport implements Preparable{

	private static final long serialVersionUID = 1L;
	private List<Cliente> clientes;
	private Cliente cliente=new Cliente();
	private Usuario usuario = new Usuario();
	
	private ClienteService clienteService = new ClienteServiceDAO();
	private UsuarioService usuarioService = new UsuarioServiceDAO();
	
	
	public Cliente getCliente(){
		return cliente;
	}
	public void setCliente(Cliente cliente){
		this.cliente = cliente;
................................................................................
	
	public String buscar() throws Exception {
		clientes= clienteService.buscar(cliente);
		return SUCCESS;
	}
	
	public String editar() throws Exception{
		System.out.println("action cliente" + cliente.getEmail());
		if(cliente.getCodigo()==null){
			
			usuario.setUsuario(cliente.getEmail());
			usuario.setAdmin(false);
			usuario.setWeb(true);
			usuario.setClave(cliente.getClave());
			usuarioService.registrar(usuario);
			Usuario usuario_new = usuarioService.obtener(cliente.getEmail());
			cliente.setUsuario(usuario_new);
			clienteService.registrar(cliente);
			String[] params = new String[]{getText(Constantes.MODULO_CLIENTE)};

			addActionMessage(getText(Constantes.MENSAJE_INSERT_OK,params));
		} else {
			clienteService.actualizar(cliente);
			String[] params=new String[]{

Changes to src/model/Cliente.java.

13
14
15
16
17
18
19

20
21
22
23
24
25
26
..
43
44
45
46
47
48
49






50
51
52
53
54
55
56
	private String ap_materno;
	private String dni;
	private String ruc;
	private String email;
	private String direccion;
	private String telefonos;
	private Usuario usuario;

	
	public Integer getCodigo() {
		return codigo;
	}
	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}
................................................................................
		this.ap_materno = ap_materno;
	}
	public String getDni() {
		return dni;
	}
	public void setDni(String dni) {
		this.dni = dni;






	}
	public String getRuc() {
		return ruc;
	}
	public void setRuc(String ruc) {
		this.ruc = ruc;
	}







>







 







>
>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	private String ap_materno;
	private String dni;
	private String ruc;
	private String email;
	private String direccion;
	private String telefonos;
	private Usuario usuario;
	private String clave;
	
	public Integer getCodigo() {
		return codigo;
	}
	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}
................................................................................
		this.ap_materno = ap_materno;
	}
	public String getDni() {
		return dni;
	}
	public void setDni(String dni) {
		this.dni = dni;
	}
	public String getClave() {
		return clave;
	}
	public void setClave(String clave) {
		this.clave = clave;
	}
	public String getRuc() {
		return ruc;
	}
	public void setRuc(String ruc) {
		this.ruc = ruc;
	}

Changes to src/model/Usuario.java.

9
10
11
12
13
14
15


16
17
18
19
20
21
22
..
46
47
48
49
50
51
52
53
54
55
	 */
	private static final long serialVersionUID = 1L;
	private Integer codigo;
	private String usuario;
	private String nombre;
	private String clave;
	private Boolean web;


	
	public Integer getCodigo() {
		return codigo;
	}
	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}
................................................................................
	}
	public Boolean getAdmin() {
		return admin;
	}
	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}
	private Boolean admin;

}







>
>







 







<
|

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
48
49
50
51
52
53
54

55
56
	 */
	private static final long serialVersionUID = 1L;
	private Integer codigo;
	private String usuario;
	private String nombre;
	private String clave;
	private Boolean web;
	private Boolean admin;

	
	public Integer getCodigo() {
		return codigo;
	}
	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}
................................................................................
	}
	public Boolean getAdmin() {
		return admin;
	}
	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}

	
}

Changes to src/negocio/ClienteServiceDAO.java.

23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
	@Override
	public void actualizar(Cliente cliente) throws Exception {
		SqlSession session=MyBatisUtil.getSqlSessionFactory().openSession();
		ClienteMapper clienteMapper=session.getMapper(ClienteMapper.class);
		clienteMapper.actualizar(cliente);
		session.commit();
		session.close();
		
		
	}

	@Override
	public void registrar(Cliente cliente) throws Exception {

		SqlSession  session=MyBatisUtil.getSqlSessionFactory().openSession();
		ClienteMapper clienteMapper = session.getMapper(ClienteMapper.class);
		clienteMapper.insertar(cliente);
		session.commit();
		session.close();
		
	}







|
<




>







23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
	@Override
	public void actualizar(Cliente cliente) throws Exception {
		SqlSession session=MyBatisUtil.getSqlSessionFactory().openSession();
		ClienteMapper clienteMapper=session.getMapper(ClienteMapper.class);
		clienteMapper.actualizar(cliente);
		session.commit();
		session.close();
	

	}

	@Override
	public void registrar(Cliente cliente) throws Exception {
		System.out.println("registrar cliente" + cliente.getCodigo());
		SqlSession  session=MyBatisUtil.getSqlSessionFactory().openSession();
		ClienteMapper clienteMapper = session.getMapper(ClienteMapper.class);
		clienteMapper.insertar(cliente);
		session.commit();
		session.close();
		
	}

Changes to src/negocio/UsuarioService.java.

2
3
4
5
6
7
8
9
10

import model.Usuario;

public interface UsuarioService {
	
	public String isCredencialValida(Usuario usuario) throws Exception;
	public void registrar(Usuario usuario) throws Exception;
	public void actualizar(Usuario usuario) throws Exception;
}







|

2
3
4
5
6
7
8
9
10

import model.Usuario;

public interface UsuarioService {
	
	public String isCredencialValida(Usuario usuario) throws Exception;
	public void registrar(Usuario usuario) throws Exception;
	public Usuario obtener(String email) throws Exception;
}

Changes to src/negocio/UsuarioServiceDAO.java.

1
2
3
4

5
6

7
8
9
10
11
12
13
..
17
18
19
20
21
22
23
24
25





26
27
28
29
30
31







32
33
34
35
package negocio;

import org.apache.ibatis.session.SqlSession;


import persistencia.mybatis.mapper.UsuarioMapper;
import util.MyBatisUtil;

import model.Usuario;

public class UsuarioServiceDAO implements UsuarioService{

	@Override
	public String isCredencialValida(Usuario usuario) throws Exception {
		// TODO Auto-generated method stub
................................................................................
		session.close();
	          
		return rs;
	}

	@Override
	public void registrar(Usuario usuario) throws Exception {
		// TODO Auto-generated method stub
		





	}

	@Override
	public void actualizar(Usuario usuario) throws Exception {
		// TODO Auto-generated method stub
		







	}
	

}




>


>







 







|
<
>
>
>
>
>



|


>
>
>
>
>
>
>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package negocio;

import org.apache.ibatis.session.SqlSession;

import persistencia.mybatis.mapper.ClienteMapper;
import persistencia.mybatis.mapper.UsuarioMapper;
import util.MyBatisUtil;
import model.Cliente;
import model.Usuario;

public class UsuarioServiceDAO implements UsuarioService{

	@Override
	public String isCredencialValida(Usuario usuario) throws Exception {
		// TODO Auto-generated method stub
................................................................................
		session.close();
	          
		return rs;
	}

	@Override
	public void registrar(Usuario usuario) throws Exception {
		System.out.println("registrar usuario" + usuario.getUsuario());

		SqlSession  session=MyBatisUtil.getSqlSessionFactory().openSession();
		UsuarioMapper usuarioMapper = session.getMapper(UsuarioMapper.class);
		usuarioMapper.insertar(usuario);
		session.commit();
		session.close();
	}

	@Override
	public Usuario obtener(String email) throws Exception {
		// TODO Auto-generated method stub
		
			
			SqlSession session=MyBatisUtil.getSqlSessionFactory().openSession();
			UsuarioMapper usuarioMapper = session.getMapper(UsuarioMapper.class);
			Usuario usuario= usuarioMapper.obtener(email);
			session.close();
			return usuario;
		
	}
	

}

Changes to src/persistencia/mybatis/config/config.properties.

1
2
3
4
5
6
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost/agenciadb
username=root
password=123



|




1
2
3
4
5
6
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/agenciadb
username=root
password=123


Changes to src/persistencia/mybatis/config/mybatis-config.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE configuration 
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
	<properties resource="persistencia/mybatis/config/config.properties"/>
	
	<settings>
		<setting name="defaultStatementTimeout" value="2"/>
	</settings>
	
	<typeAliases>
		<typeAlias type="model.Cliente" alias="cliente"/>







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE configuration 
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
	  <properties resource="persistencia/mybatis/config/config.properties"/>
	
	<settings>
		<setting name="defaultStatementTimeout" value="2"/>
	</settings>
	
	<typeAliases>
		<typeAlias type="model.Cliente" alias="cliente"/>

Changes to src/persistencia/mybatis/mapper/ClienteMapper.xml.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 	<update id="actualizar" parameterType="cliente">
 		UPDATE cliente
 		SET nombres=#{nombres},
 			ap_paterno=#{ap_paterno},
 			ap_materno=#{ap_materno},
 			dni=#{dni},
 			ruc=#{ruc},
 			email=#{email},
 			telefono=#{telefono},
 			direccion=#{direccion}
 			WHERE id=#{codigo}
 	</update>
 
 
 </mapper>







<







50
51
52
53
54
55
56

57
58
59
60
61
62
63
 	<update id="actualizar" parameterType="cliente">
 		UPDATE cliente
 		SET nombres=#{nombres},
 			ap_paterno=#{ap_paterno},
 			ap_materno=#{ap_materno},
 			dni=#{dni},
 			ruc=#{ruc},

 			telefono=#{telefono},
 			direccion=#{direccion}
 			WHERE id=#{codigo}
 	</update>
 
 
 </mapper>

Changes to src/persistencia/mybatis/mapper/UsuarioMapper.java.

1

2
3
4
5
6
7


8
9
package persistencia.mybatis.mapper;


import model.Usuario;

public interface UsuarioMapper {
	
	String getAccess(Usuario usuario);



}

>






>
>
|
<
1
2
3
4
5
6
7
8
9
10
11

package persistencia.mybatis.mapper;


import model.Usuario;

public interface UsuarioMapper {
	
	String getAccess(Usuario usuario);
	void insertar(Usuario usuario);
	Usuario obtener(String email);
}

Changes to src/persistencia/mybatis/mapper/UsuarioMapper.xml.

8
9
10
11
12
13
14
15





















16
 
  <select id="getAccess" resultType="string" parameterType="usuario">
	  	SELECT usuario
	  	FROM usuario
	  	WHERE usuario= #{usuario}
	  	AND clave = #{clave}
   </select>
 





















 </mapper>







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
  <select id="getAccess" resultType="string" parameterType="usuario">
	  	SELECT usuario
	  	FROM usuario
	  	WHERE usuario= #{usuario}
	  	AND clave = #{clave}
   </select>
   
   <insert id="insertar" parameterType="usuario">
 		INSERT INTO usuario(usuario, nombre, clave, web, admin)
 		values (#{usuario},#{nombre},#{clave},#{web},#{admin})
 	</insert>
 	
 	 <resultMap type="usuario" id="rmUsuarioByUsuario">
        <id column="id" property="codigo"/>
        <result column="usuario" property="usuario"/>
        <result column="nombre" property="nombre"/>
        <result column="clave" property="clave"/>
        <result column="web" property="web"/>
        <result column="admin" property="admin"/>
    </resultMap>
 	
 	
 	<select id="obtener" resultMap="rmUsuarioByUsuario" parameterType="string">
 		SELECT usuario, nombre, clave, web, admin
 			FROM usuario 
 			WHERE usuario = #{email}
 	</select>
 
 </mapper>

Changes to src/struts-cliente.xml.

10
11
12
13
14
15
16










17
18
19
		<action name="inicializarCliente">
			<result type="tiles">d_listadoCliente</result>
		</action>
		
		<action name="inicializarLibroReclamaciones">
			<result type="tiles">d_listadoLibroReclamaciones</result>
		</action>











	</package>
</struts>







>
>
>
>
>
>
>
>
>
>



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
		<action name="inicializarCliente">
			<result type="tiles">d_listadoCliente</result>
		</action>
		
		<action name="inicializarLibroReclamaciones">
			<result type="tiles">d_listadoLibroReclamaciones</result>
		</action>
		
		<action name="registroCliente" class="action.ClienteAction">
			<result type="tiles">d_registroCliente</result>
		</action>
		
		<action name="edicionCliente" class="action.ClienteAction" method="editar">
			<result type="tiles">d_login_web</result>
			<result name="input" type="tiles">d_edicionCliente</result>
		</action>
		

	</package>
</struts>

Changes to src/struts.xml.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	<package name="demo" extends="struts-default">
		<result-types>
			<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"></result-type>
		</result-types>
		
		<interceptors>
			<interceptor name="cronometro" class="interceptor.CronometroInterceptor"/>
			<interceptor name="SesionAdmin" class="interceptor.SesionAdminInterceptor" />
			<interceptor-stack name="pitStack">
				
				<interceptor-ref name="cronometro"/>
				<interceptor-ref name="SesionAdmin"/>
				<interceptor-ref name="defaultStack">
					<param name="prepare.excludeMethods">buscar,eliminar</param>
				</interceptor-ref>
				
			</interceptor-stack>
			
	
		</interceptors>
		
		<default-interceptor-ref name="pitStack" />
		







|

<

|
<
<
<
|







16
17
18
19
20
21
22
23
24

25
26



27
28
29
30
31
32
33
34
	<package name="demo" extends="struts-default">
		<result-types>
			<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"></result-type>
		</result-types>
		
		<interceptors>
			<interceptor name="cronometro" class="interceptor.CronometroInterceptor"/>
			 <interceptor name="SesionAdmin" class="interceptor.SesionAdminInterceptor" />
			<interceptor-stack name="pitStack">

				<interceptor-ref name="cronometro"/>
				<!-- <interceptor-ref name="SesionAdmin"/> -->




			</interceptor-stack>
			
	
		</interceptors>
		
		<default-interceptor-ref name="pitStack" />