Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Building a School Schedule Web Application problem
Building a School Schedule Web Application problem [message #146034] Thu, 03 November 2005 07:58 Go to next message
test is currently offline testFriend
Messages: 51
Registered: July 2009
Member
Once i click add course i get HTTP method POST is not supported by this
URL. In my weblogic console these errors appear:

< [ServletContext(id=6702945,name=SchoolSchedule,context-path= /SchoolSchedule)]
Servlet failed with Exception
java.lang.IllegalStateException: Cannot forward a response that is already
committed

my jsp is :


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<FORM action="/SchoolSchedule/Schedule" method="post">

Course Name: <INPUT type="text" name="title" size="35"><BR>
Course Time:
Sun<INPUT type="checkbox" name="day" value="sun">
Mon<INPUT type="checkbox" name="day" value="mon">
Tue<INPUT type="checkbox" name="day" value="tue">
Wed<INPUT type="checkbox" name="day" value="wed">
Thu<INPUT type="checkbox" name="day" value="thu">
Fri<INPUT type="checkbox" name="day" value="fri">
Sat<INPUT type="checkbox" name="day" value="sat">
<SELECT name="starttime">
<OPTION value="8">8:00am</OPTION>
<OPTION value="9">9:00am</OPTION>
<OPTION value="10">10:00am</OPTION>
<OPTION value="11">11:00am</OPTION>
<OPTION value="12">12:00pm</OPTION>
<OPTION value="13">1:00pm</OPTION>
<OPTION value="14">2:00pm</OPTION>
<OPTION value="15">3:00pm</OPTION>
<OPTION value="16">4:00pm</OPTION>
<OPTION value="17">5:00pm</OPTION>
<OPTION value="18">6:00pm</OPTION>
<OPTION value="19">7:00pm</OPTION>
<OPTION value="20">8:00pm</OPTION>
<OPTION value="21">9:00pm</OPTION>
</SELECT>
to
<SELECT name="endtime">
<OPTION value="9">9:00am</OPTION>
<OPTION value="10">10:00am</OPTION>
<OPTION value="11">11:00am</OPTION>
<OPTION value="12">12:00pm</OPTION>
<OPTION value="13">1:00pm</OPTION>
<OPTION value="14">2:00pm</OPTION>
<OPTION value="15">3:00pm</OPTION>
<OPTION value="16">4:00pm</OPTION>
<OPTION value="17">5:00pm</OPTION>
<OPTION value="18">6:00pm</OPTION>
<OPTION value="19">7:00pm</OPTION>
<OPTION value="20">8:00pm</OPTION>
<OPTION value="21">9:00pm</OPTION>
<OPTION value="22">10:00pm</OPTION>
</SELECT>
<BR>
<BR>
<INPUT type="submit" name="Submit" value="Add Course">
</FORM>

<TABLE border="1" cellspacing="0">
<TBODY>
<TR>
<TH align="center" valign="middle" width="80"></TH>
<TH align="center" valign="middle" width="100">Sunday</TH>
<TH align="center" valign="middle">Monday</TH>
<TH align="center" valign="middle">Tuesday</TH>
<TH align="center" valign="middle">Wednesday</TH>
<TH align="center" valign="middle">Thursday</TH>
<TH align="center" valign="middle">Friday</TH>
<TH align="center" valign="middle">Saturday</TH>
</TR>
<c:forEach begin="8" end="21" step="1" var="time">
<TR>
<TD align="center" valign="middle" width="80">
<c:choose>
<c:when test="${time == 12}">
<c:out value="${time}" />:00pm
</c:when>
<c:when test="${time > 12}">
<c:out value="${time - 12}" />:00pm
</c:when>
<c:otherwise>
<c:out value="${time}" />:00am
</c:otherwise>
</c:choose></TD>
<c:forEach begin="0" end="6" step="1" var="day">
<TD align="center" valign="middle" width="100">
<c:forEach items="${schoolschedule.classes}" var="clazz">
<c:if test="${clazz.startTime <= time
&& clazz.endTime > time
&& clazz.day == day}">
<c:out value="${clazz.title}" />
</c:if>
</c:forEach>
</TD>
</c:forEach>
</TR>
</c:forEach>
</TBODY>
</TABLE>

</body>
</html>
Re: Building a School Schedule Web Application problem [message #146043 is a reply to message #146034] Thu, 03 November 2005 08:05 Go to previous messageGo to next message
test is currently offline testFriend
Messages: 51
Registered: July 2009
Member
servlet code:

package org.eclipse.wtp.sample.classschedule;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ScheduleServlet extends HttpServlet {

/* (non-Javadoc)
* @see
javax.servlet.http.HttpServlet#doPost(javax.servlet.http.Htt pServletRequest,
javax.servlet.http.HttpServletResponse)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
// TODO Auto-generated method stub
super.doPost(request, response);
String title = request.getParameter("title");
int starttime = Integer.parseInt(request.getParameter("starttime"));
int endtime = Integer.parseInt(request.getParameter("endtime"));
String[] days = request.getParameterValues("day");

SchoolSchedule schedule =
(SchoolSchedule)request.getSession(true).getAttribute("schoolschedule ");
if(schedule == null)
{
schedule = new SchoolSchedule();
}

if(days != null)
{
for(int i = 0; i < days.length; i++)
{
String dayString = days[i];
int day;
if(dayString.equalsIgnoreCase("SUN")) day = 0;
else if(dayString.equalsIgnoreCase("MON")) day = 1;
else if(dayString.equalsIgnoreCase("TUE")) day = 2;
else if(dayString.equalsIgnoreCase("WED")) day = 3;
else if(dayString.equalsIgnoreCase("THU")) day = 4;
else if(dayString.equalsIgnoreCase("FRI")) day = 5;
else day = 6;
SchoolClass clazz = new SchoolClass(title, starttime, endtime, day);
schedule.addClass(clazz);
}

request.getSession().setAttribute("schoolschedule", schedule);

getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request,
response);

}


}




}
Re: Building a School Schedule Web Application problem [message #146052 is a reply to message #146043] Thu, 03 November 2005 08:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvdb.ibl-software.nl

Remove the call to super.doPost(request, response) ?

Mvgr,
Martin

Kano wrote:
> servlet code:
>
> package org.eclipse.wtp.sample.classschedule;
>
> import java.io.IOException;
>
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> public class ScheduleServlet extends HttpServlet {
>
> /* (non-Javadoc)
> * @see
> javax.servlet.http.HttpServlet#doPost(javax.servlet.http.Htt pServletRequest,
> javax.servlet.http.HttpServletResponse)
> */
> protected void doPost(HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
> // TODO Auto-generated method stub
> super.doPost(request, response);
> String title = request.getParameter("title");
> int starttime =
> Integer.parseInt(request.getParameter("starttime"));
> int endtime = Integer.parseInt(request.getParameter("endtime"));
> String[] days = request.getParameterValues("day");
>
> SchoolSchedule schedule =
>
> (SchoolSchedule)request.getSession(true).getAttribute("schoolschedule ");
> if(schedule == null)
> {
> schedule = new SchoolSchedule();
> }
>
> if(days != null)
> {
> for(int i = 0; i < days.length; i++)
> {
> String dayString = days[i];
> int day;
> if(dayString.equalsIgnoreCase("SUN")) day = 0;
> else if(dayString.equalsIgnoreCase("MON")) day = 1;
> else if(dayString.equalsIgnoreCase("TUE")) day = 2;
> else if(dayString.equalsIgnoreCase("WED")) day = 3;
> else if(dayString.equalsIgnoreCase("THU")) day = 4;
> else if(dayString.equalsIgnoreCase("FRI")) day = 5;
> else day = 6;
> SchoolClass clazz = new SchoolClass(title,
> starttime, endtime, day);
> schedule.addClass(clazz);
> }
>
> request.getSession().setAttribute("schoolschedule", schedule);
>
> getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request,
> response); }
> }
>
>
>
>
> }
>
>
Re: Building a School Schedule Web Application problem [message #146061 is a reply to message #146034] Thu, 03 November 2005 08:34 Go to previous messageGo to next message
test is currently offline testFriend
Messages: 51
Registered: July 2009
Member
Thanks that did the trick but:

i keep getting the following inside the timetable:

${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am
${time}:00am

the only warnings in my weblogic console are:

Check against the DTD: cvc-elt.1: Cannot find the declaration of element
'taglib'. (line 6, column 19).>
myserver__appsdir_SchoolSchedule_war_SchoolSchedule\jarfiles \WEB-INF\lib\standard.jar!/META-INF/fmt.tld "
is malformed. Check against the DTD: cvc-elt.1: Cannot find the
declaration of element 'taglib'. (line 6, column 19).>

I put both jstl.jar and standard.jar in lib, they don't appear in the lib
directory in my workspace but it appears in the Web App
Libraries[SchoolSchedule]
Re: Building a School Schedule Web Application problem [message #146303 is a reply to message #146061] Fri, 04 November 2005 03:15 Go to previous message
Eclipse UserFriend
Originally posted by: kano.gmail.com

Does anyone have any idea on what might be causing this?
Previous Topic:Building a School Web Application problem
Next Topic:wsdl2java not creating all objects
Goto Forum:
  


Current Time: Wed Apr 24 19:02:56 GMT 2024

Powered by FUDForum. Page generated in 0.03438 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top