Foros del Web » Programación para mayores de 30 ;) » Java »

duda integrando fullcalendar con struts2

Estas en el tema de duda integrando fullcalendar con struts2 en el foro de Java en Foros del Web. Bueno estoy realizando una app web en la que necesito algo asi como google calendar por lo que escogi esta opcion: http://arshaw.com/fullcalendar/ ya he construido ...
  #1 (permalink)  
Antiguo 04/07/2013, 10:42
 
Fecha de Ingreso: abril-2013
Mensajes: 36
Antigüedad: 11 años
Puntos: 0
duda integrando fullcalendar con struts2

Bueno estoy realizando una app web en la que necesito algo asi como google calendar por lo que escogi esta opcion:

http://arshaw.com/fullcalendar/

ya he construido el codigo del calendario, y el feed de eventos en la parte del servidor con su correspondiente json, he utilizado el debugger y el json se genera de manera correcta, el problema que tengo es que no se estan mostrando los eventos lo cual creo que puede ser por dos razones, una que no me este llegando el json al jsp con el calendario o dos que no lo haga con el formato correcto, lei por ahi que los paramentros start y end deben estar en unixtimestamp pero tb lo he probado y nada, por favor alguien podria ayudarme? estoy desesperado y no se que hacer pues al no ser un fallo como tal por mas vueltas que le doy no consigo averiguar porque no muestra los eventos, por aqui dejo el codigo:

Calendario.jsp

Código:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Agenda</title>
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar/fullcalendar.print.css' />
<script type='text/javascript' src='fullcalendar/jquery/jquery-1.9.1.min.js'></script>
<script type='text/javascript' src='fullcalendar/jquery/jquery-ui-1.10.2.custom.min.js'></script>
<script type='text/javascript' src='fullcalendar/fullcalendar/fullcalendar.min.js'></script>
<script>
$(document).ready(function() {

	var date = new Date();
	var d = date.getDate();
	var m = date.getMonth();
	var y = date.getFullYear();
    // page is now ready, initialize the calendar...

    $('#calendar').fullCalendar({    
        header: {
            left:'agendaDay,agendaWeek,month',
            center:'title',
            right:'today, prev, next',
        },
	    buttonText: {
	        prev:     'Anterior', // <
	        next:     'Siguiente', // >
	        prevYear: 'Año Anterior',  // <<
	        nextYear: 'Año Siguiente',  // >>
	        today:    'Hoy',
	        month:    'Mes',
	        agendaWeek:     'Semana',
	        agendaDay:      'Día',
	    },
	    defaultView: 'agendaDay',
	    firstDay:1,
	    titleFormat:{
	    	month: "MMMM 'de' yyyy",
	    	agendaWeek:"dd 'de' MMMM {'— 'dd 'de' MMMM 'de' yyyy}",
	    	agendaDay: "dddd, dd 'de' MMMM 'de' yyyy",
	    },
	    columnFormat:{
	    	agendaWeek:'ddd dd/M',
	    	agendaDay: 'dddd dd/M',
	    },
	    timeFormat:{
	    	agendaWeek:'hh:mm{ - hh:mm}',
	    	agendaDay: 'hh:mm{ - hh:mm}',
	    },
	    monthNames:['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio',
    	 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
    	monthNamesShort:['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul',
 	     'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],	    
 	    dayNames:['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sabado'],
 	    dayNamesShort:['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],	
 	    allDaySlot:false,
 	    axisFormat:'HH:mm',
 	    defaultEventMinutes:60,
 	    firstHour:9,
 	   	minTime:9,
 	    maxTime:24,
		selectable: true,
		selectHelper: true,
		select: function(start, end, allDay) {
			var title = prompt('Event Title:');
			if (title) {
				calendar.fullCalendar('renderEvent',
					{
						title: title,
						start: start,
						end: end,
						allDay: allDay
					},
					true // make the event "stick"
				);
			}
			calendar.fullCalendar('unselect');
		},
		editable: true,

 	   
		events: 'MostrarCalendario.action',

 		
        eventDrop: function(event, delta) {
            alert(event.title + ' was moved ' + delta + ' days\n' +
                '(should probably update your database)');
        },

        loading: function(bool) {
            if (bool) $('#loading').show();
            else $('#loading').hide();
        }
    });
});
</script>
</head>

<body>
<div id='calendar'></div>
</body>
Aqui la accion del struts.xml

Código:
	<action name="MostrarCalendario" class="controlador.acciones.AccionMostrarCalendario" method="Mostrar">
		<result name="success" type="json">
		</result>
	</action>
y aqui la accion:

Código:
package controlador.acciones;

import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.*; 
import modelo.Evento;

import com.google.gson.Gson;
import com.opensymphony.xwork2.ActionSupport;

public class AccionMostrarCalendario extends ActionSupport {
	private static final long serialVersionUID = 1L;
	private List<Evento> eventos = new ArrayList<Evento>();
	private Evento eventoVO = new Evento();
	private String json;
	
	@Override public String execute() throws Exception{
        return SUCCESS;
	}
	
	public String Mostrar() throws Exception{
		
		
		eventoVO = new Evento();
		eventoVO.setId(1);
		eventoVO.setTitle("Evento1");
		eventoVO.setStart("1372854643");
		eventoVO.setEnd("1372861843");
	  	/*eventoVO.setStart(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2013-07-03 12:30:00"));
	  	eventoVO.setEnd(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2013-07-03 14:30:00"));*/
		eventoVO.setUrl(new URL("http://yahoo.com"));
		
		eventos.add(eventoVO);
		
	    json = new Gson().toJson(eventos);
	    
		return SUCCESS;
	}

	public String getJson() {
		return json;
	}

	public void setJson(String json) {
		this.json = json;
	}

	public List<Evento> getEventos() {
		return eventos;
	}

	public void setEventos(List<Evento> eventos) {
		this.eventos = eventos;
	}

	public Evento getEventoVO() {
		return eventoVO;
	}

	public void setEventoVO(Evento eventoVO) {
		this.eventoVO = eventoVO;
	}
}
Muchas gracias de antemano

Etiquetas: fullcalendar, html, jsp, string, struts2
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:39.