Re: [appengine-java] JSP code debug: Compiled JSP location in local environment
thanks, seleron! It's really help. I don't know why App docs does not point out it. Developer really needs this information. Or is there any other way to debug .jsp code efficiently? I tried to use Eclipse Debug perspective and could not find out useful information about bug in compiled code. On Tue, May 4, 2010 at 6:48 PM, m seleron wrote: > Hi, > > The following threads might be useful though it depends on the > operation system that you are using. > > > http://groups.google.com/group/google-appengine-java/browse_thread/thread/e63281b3e3d1b05/9b12a70f5172c6c1 > > Hope some of this helps. > thanks. > > > Hi > > > > I got following error in my local enviroment of Google App Eng with > > Eclipse plugin: > > at org.apache.jsp.scoreresult_jsp._jspService(scoreresult_jsp.java: > > 161) > > > > I would like to see the code on line 161 of compiled scoreresult.jsp > > file. But I can't find out the location of it. Anyone can tell me > > where the default folder locatoin for compiled .jsp files and also how > > you debug jsp code when error is on .jsp but no error on your .java > > file? > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > > To post to this group, send email to > google-appengine-j...@googlegroups.com. > > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com > . > > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Using DataNucleus JPA - Online Quizzes Database Design
My second thought after posting previous message is to modify schema of ScoreBoar and make it a real scoreboard. Old: ScoreBoard(scoreboard_id as primary key, quizz_id as foreign key to Quizzes, 100, 90, 80, 70,60,50,40,30,20,10,0). New: ScoreBoard( identity id, quizz_id, foreign key to quizzes, user_id, foreign key to User user_score ) Table ScoreBoard has one-to-one to both table User and Quizzes. New schema would allow to post absolute value for each user and also it's easy to calculate percentage of other user's result below or above the current user's with sorting on user_score. right? On Wed, Apr 21, 2010 at 2:38 PM, bobo wrote: > Hi > > After leaning JPA tutorial with Getting Started tutorial, I would > like to try creating my own web application called on-line quizzes > with Google Engine. This application would provide users quizzes with > uncertain number of questions for each quizz. And it displays the > result a user plays, as well as tells the rank of the result among > participants and percentage of performers below the result the user > receives. If a user desires, the application would be able to tell the > historic records of quizzes the user played in the past. I am stuck > on how to design and flat tables for this application. Below is what > I tried and feel the design is a bit of awkward and it may not fit > into tasks the application would perfom: > > 1. User table(user_id, first_name, last_name) > > 2. Quizzes tables(quizz_id, quizz_name) > User and Quizzes tables has many-to-many relationship. Each user has > a number of quizzes and each quizz can have a number of users > > 3. Join or associate table User_Quizzes(user_id, quizz_id). Both ids > are from User and Quizz table as a foregn key to its source table, and > both as a composite primay key for this join table. > > 4. Record table(record_id, score, qizz_id, user_id). It has one-to- > many relationship between User and Record table. Foreign key in Record > table is a user_id. So we can retrieve historic records for a > particular user; > > 5. ScoreBoard table, this is where I am confused and not confident. > Each quizz will store distribution of users with different level of > scores for a particular quizz, let's say 10 as an interval for score > level and then it can tell percentage of users played above or below > to this user. So it's one-to-one relationship between each quizz and > its corresponding scoreboard. > > ScoreBoard(scoreboard_id as primary key, quizz_id as foreign key to > Quizzes, 100, 90, 80, 70,60,50,40,30,20,10,0). > > If a user plays a quizz with 15 questions and have 11 correct, it's > 73% correct for that quizz. I will update the column of 70 with > whatever value there increased by 1. At this time, the total percent > of peope below this user is: sum( values in column 60, 50, 40, ,0)/ > total number of users participated in the quizz. > > With this database design above, firstly the application is not able > to give the rank of absolute scores with the user's result(but can > give a level rank). Should I create another table; Second, I am not > sure if the design can eventually fit into DataNucleus JPA > implementation. Do you have a better idea or experiences to make this > type of database work? > > My question may look dumb to you but please shed me a light...thanks! > Hope this question is not too boring to you. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: HTTP ERROR 405 with Guestbook Tutorial
Thank you for explanation, Chau. Checking .xsd file is really a good practice when having a question about xml schema. On Sat, Apr 17, 2010 at 2:47 AM, Chau Huynh wrote: > On Sat, Apr 17, 2010 at 8:43 AM, bosun wrote: > Is there a order requirement in element? Or should only one > servlet defined in this section? Anyone know how does invocation make on > servlets in section of and in web.xml ? Does > invocation go through chains of servlet? > > It's because of incorrect and declaration in > your old web.xml. > Should use each to define 1 servlet only (no limit on numer of > servlet) > The link in web.xml file reference to those syntax > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd > or you can just google "web.xml" for easier explanation. > > > On Sat, Apr 17, 2010 at 8:43 AM, bosun wrote: > >> From my observation, in guestbook.jsp >> is expected to trigger doPost method in SignGuestBookServlet but instead, it >> invoks doGet method in GuestbookServlet as it's the first servlet defined in >> web.xml. Thus, it causes the error message like HTTP method POST is not >> supported by this URL. >> >> I have been working on this issue for hours and finally I made it worked >> but I have to delete the servlet guestbook from entries in and >> in web.xml. But in tutorial, it didn't mention the >> deletion. It also works if I moved up the servlet sign to the first entry. >> I don't understand why it behaves like this. It looks to me that doGet >> method in GuestbookServet other than doPost method in SignGuestbookServlet >> gets invoked immediately after a user clicks Post Greetings, which posts >> data in the form. Is there a order requirement in element? Or >> should only one servlet defined in this section? Anyone know how does >> invocation make on servlets in section of and >> in web.xml ? Does invocation go through chains of servlet? >> >> After deletion, web.xml now looks like below: >> >> http://www.w3.org/2001/XMLSchema-instance"; >> xmlns="http://java.sun.com/xml/ns/javaee"; >> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; >> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; version="2.5"> >> >> sign >> guestbook.SignGuestbookServlet >> >> >> sign >> /sign >> >> >> guestbook.jsp >> >> >> >> On Fri, Apr 16, 2010 at 12:42 PM, bosun wrote: >> >>> Hi Chau, >>> I used the code in the tutorial with a slightly change. Data is posted >>> by POST method in the form so SignGuestbookServlet should use doPost to >>> handle it. >>> Anothe thing I am confused is that I can't see log message in Eclipse >>> console if I added custom message like log.info or system.out.printlin >>> alough I givie guestbook.level = INFO in logging.properties. >>> >>> Code below is SignGuestbookServlet.java: >>> import com.google.appengine.api.users.UserService; >>> import com.google.appengine.api.users.UserServiceFactory; >>> public class SignGuestbookServlet { >>> private static final Logger log = >>> Logger.getLogger(SignGuestbookServlet.class.getName()); >>> >>> public void doPost(HttpServletRequest req, HttpServletResponse resp) >>> throws IOException { >>> UserService userService = UserServiceFactory.getUserService(); >>> User user = userService.getCurrentUser(); >>> >>> String content = req.getParameter("content"); >>> if (content == null) { >>> content = "(No greeting)"; >>> } >>> if (user != null) { >>> log.info("Greeting posted by user " + user.getNickname() + >>> ": " + content); >>> } else { >>> log.info("Greeting posted anonymously: " + content); >>> } >>> resp.sendRedirect("/guestbook.jsp"); >>> } >>> } >>> Code below is guestbook.jsp: >>> >>> <%@ page contentType="text/html;charset=UTF-8" language="java" %> >>> <%@ page import="com.google.appengine.api.users.User" %> >>> <%@ page import="com.google.appengine.api.users.UserService" %> >>> <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> &
Re: [appengine-java] Re: HTTP ERROR 405 with Guestbook Tutorial
>From my observation, in guestbook.jsp is expected to trigger doPost method in SignGuestBookServlet but instead, it invoks doGet method in GuestbookServlet as it's the first servlet defined in web.xml. Thus, it causes the error message like HTTP method POST is not supported by this URL. I have been working on this issue for hours and finally I made it worked but I have to delete the servlet guestbook from entries in and in web.xml. But in tutorial, it didn't mention the deletion. It also works if I moved up the servlet sign to the first entry. I don't understand why it behaves like this. It looks to me that doGet method in GuestbookServet other than doPost method in SignGuestbookServlet gets invoked immediately after a user clicks Post Greetings, which posts data in the form. Is there a order requirement in element? Or should only one servlet defined in this section? Anyone know how does invocation make on servlets in section of and in web.xml ? Does invocation go through chains of servlet? After deletion, web.xml now looks like below: http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; version="2.5"> sign guestbook.SignGuestbookServlet sign /sign guestbook.jsp On Fri, Apr 16, 2010 at 12:42 PM, bosun wrote: > Hi Chau, > I used the code in the tutorial with a slightly change. Data is posted by > POST method in the form so SignGuestbookServlet should use doPost to handle > it. > Anothe thing I am confused is that I can't see log message in Eclipse > console if I added custom message like log.info or system.out.printlin > alough I givie guestbook.level = INFO in logging.properties. > > Code below is SignGuestbookServlet.java: > import com.google.appengine.api.users.UserService; > import com.google.appengine.api.users.UserServiceFactory; > public class SignGuestbookServlet { > private static final Logger log = > Logger.getLogger(SignGuestbookServlet.class.getName()); > > public void doPost(HttpServletRequest req, HttpServletResponse resp) > throws IOException { > UserService userService = UserServiceFactory.getUserService(); > User user = userService.getCurrentUser(); > > String content = req.getParameter("content"); > if (content == null) { > content = "(No greeting)"; > } > if (user != null) { > log.info("Greeting posted by user " + user.getNickname() + ": > " + content); > } else { > log.info("Greeting posted anonymously: " + content); > } > resp.sendRedirect("/guestbook.jsp"); > } > } > Code below is guestbook.jsp: > > <%@ page contentType="text/html;charset=UTF-8" language="java" %> > <%@ page import="com.google.appengine.api.users.User" %> > <%@ page import="com.google.appengine.api.users.UserService" %> > <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> > > > <% > UserService userService = UserServiceFactory.getUserService(); > User user = userService.getCurrentUser(); > if (user != null) { > %> > Hi, <%= user.getNickname() %>! (You can > sign > out.) > <% > } else { > %> > Hello! > Sign > in > to include your name with greetings you post. > <% > } > %> > Comment Board: > > > > > > > > code below is GuestbookServlet.java: > package guestbook; > import java.io.IOException; > import javax.servlet.http.*; > import com.google.appengine.api.users.User; > import com.google.appengine.api.users.UserService; > import com.google.appengine.api.users.UserServiceFactory; > > @SuppressWarnings("serial") > public class GuestbookServlet extends HttpServlet { > public void doGet(HttpServletRequest req, HttpServletResponse resp) throws > IOException { > UserService userService = UserServiceFactory.getUserService(); > User user = userService.getCurrentUser(); > //log.info("user name is " + user.getNickname()); > if (user != null) { > resp.setContentType("text/plain"); > resp.getWriter().println("Hello, " + user.getNickname()); > } else { > > resp.sendRedirect(userService.createLoginURL(req.getRequestURI())); > } > } > } > > On Fri, Apr 16, 2010 at 12:16 PM, Chau Huynh wrote: > >> And
Re: [appengine-java] Re: HTTP ERROR 405 with Guestbook Tutorial
Hi Chau, I used the code in the tutorial with a slightly change. Data is posted by POST method in the form so SignGuestbookServlet should use doPost to handle it. Anothe thing I am confused is that I can't see log message in Eclipse console if I added custom message like log.info or system.out.printlin alough I givie guestbook.level = INFO in logging.properties. Code below is SignGuestbookServlet.java: import com.google.appengine.api.users.UserService; import com.google.appengine.api.users.UserServiceFactory; public class SignGuestbookServlet { private static final Logger log = Logger.getLogger(SignGuestbookServlet.class.getName()); public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); String content = req.getParameter("content"); if (content == null) { content = "(No greeting)"; } if (user != null) { log.info("Greeting posted by user " + user.getNickname() + ": " + content); } else { log.info("Greeting posted anonymously: " + content); } resp.sendRedirect("/guestbook.jsp"); } } Code below is guestbook.jsp: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="com.google.appengine.api.users.User" %> <%@ page import="com.google.appengine.api.users.UserService" %> <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> <% UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { %> Hi, <%= user.getNickname() %>! (You can sign out.) <% } else { %> Hello! Sign in to include your name with greetings you post. <% } %> Comment Board: code below is GuestbookServlet.java: package guestbook; import java.io.IOException; import javax.servlet.http.*; import com.google.appengine.api.users.User; import com.google.appengine.api.users.UserService; import com.google.appengine.api.users.UserServiceFactory; @SuppressWarnings("serial") public class GuestbookServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); //log.info("user name is " + user.getNickname()); if (user != null) { resp.setContentType("text/plain"); resp.getWriter().println("Hello, " + user.getNickname()); } else { resp.sendRedirect(userService.createLoginURL(req.getRequestURI())); } } } On Fri, Apr 16, 2010 at 12:16 PM, Chau Huynh wrote: > And next you'll need to post your servlet ;-) > > Just wonder if you code SignGuestbookServlet servlet yourself - in such a > case, you might code doGet() while your JSP posts to the servlet? Error > message from your post: "HTTP method POST is not supported by this URL" > > > On Fri, Apr 16, 2010 at 10:59 PM, bosun wrote: > >> Hi Rajeev, >> >> Thank you for helping me troubleshooting this issue. >> >> Below is web.xml >> >> >> http://www.w3.org/2001/XMLSchema-instance"; >> xmlns="http://java.sun.com/xml/ns/javaee"; >> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; >> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; version="2.5"> >> >> Guestbook >> guestbook.GuestbookServlet >> sign >> guestbook.SignGuestbookServlet >> >> >> Guestbook >> /guestbook >> sign >> /sign >> >> >> guestbook.jsp >> >> >> >> below is appengine-web.xml >> >> >> http://appengine.google.com/ns/1.0";> >> >> 1 >> >> >> >> > value="WEB-INF/logging.properties"/> >> >> >> >> >> >> >> >> On Fri, Apr 16, 2010 at 10:29 AM, Rajeev Dayal wrote: >> >>> Can you post the contents of your web.xml file and your appengine-web.xml >>> file? >>> >>> On Thu, Apr 15, 2010 at 10:21 PM, bosun wrote: >>> >>>> I forgot mention in my post about the version of Eclipse I am using is >>>> Galileo. I downloaded Google plugin for this version. >>>> >>>> The link to the Tutorial where I am s
Re: [appengine-java] Re: HTTP ERROR 405 with Guestbook Tutorial
Hi Rajeev, Thank you for helping me troubleshooting this issue. Below is web.xml http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; version="2.5"> Guestbook guestbook.GuestbookServlet sign guestbook.SignGuestbookServlet Guestbook /guestbook sign /sign guestbook.jsp below is appengine-web.xml http://appengine.google.com/ns/1.0";> 1 On Fri, Apr 16, 2010 at 10:29 AM, Rajeev Dayal wrote: > Can you post the contents of your web.xml file and your appengine-web.xml > file? > > On Thu, Apr 15, 2010 at 10:21 PM, bosun wrote: > >> I forgot mention in my post about the version of Eclipse I am using is >> Galileo. I downloaded Google plugin for this version. >> >> The link to the Tutorial where I am stuck on is: >> http://code.google.com/intl/en/appengine/docs/java/gettingstarted/usingjsps.html >> >> In Eclipse console, all log messages after server restarted are like >> below: >> >> Apr 16, 2010 2:05:54 AM >> com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml >> INFO: Successfully processed >> C:\EclipseGalileo\workspace\Guestbook\war\WEB-INF/appengine-web.xml >> Apr 16, 2010 2:05:54 AM >> com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml >> INFO: Successfully processed >> C:\EclipseGalileo\workspace\Guestbook\war\WEB-INF/web.xml >> The server is running at http://localhost:/ >> Apr 16, 2010 2:07:08 AM >> com.google.appengine.tools.development.LocalResourceFileServlet doGet >> WARNING: No file found for: /favicon.ico >> Apr 16, 2010 2:07:25 AM >> com.google.appengine.tools.development.LocalResourceFileServlet doGet >> WARNING: No file found for: /favicon.ico >> >> Please advise where it goes wrong. >> >> Thanks! >> >> >> On Thu, Apr 15, 2010 at 9:57 PM, bobo wrote: >> >>> Hi >>> >>> I run Google App Engine (Java) locally with Eclipse. Following the >>> tutorial of Getting Started - Java, I lean it step by step and my >>> local server works well until the section Using JSPs. After adding >>> SignGuestbookServlet.java and greeting form in guestbook.jsp as well >>> as editing web.xml for servlet mapping for sign and /sign, I >>> restarted the server. My browser displayed error message immediately >>> after I tried to post a greeting message: >>> >>> HTTP ERROR 405 >>> Problem accessing /sign. Reason:HTTP method POST is not supported >>> by this URL >>> >>> In Eclipse console, the red error message like: >>> Apr 16, 2010 1:34:31 AM >>> com.google.appengine.tools.development.LocalResourceFileServlet doGet >>> WARNING: No file found for: /favicon.ico >>> >>> I googled this error but seems no one having this problem before. I >>> am stuck on this point and anyone who can shed me a light? >>> >>> Thanks! >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine for Java" group. >> To post to this group, send email to >> google-appengine-j...@googlegroups.com. >> To unsubscribe from this group, send email to >> google-appengine-java+unsubscr...@googlegroups.com >> . >> For more options, visit this group at >> http://groups.google.com/group/google-appengine-java?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: HTTP ERROR 405 with Guestbook Tutorial
I forgot mention in my post about the version of Eclipse I am using is Galileo. I downloaded Google plugin for this version. The link to the Tutorial where I am stuck on is: http://code.google.com/intl/en/appengine/docs/java/gettingstarted/usingjsps.html In Eclipse console, all log messages after server restarted are like below: Apr 16, 2010 2:05:54 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed C:\EclipseGalileo\workspace\Guestbook\war\WEB-INF/appengine-web.xml Apr 16, 2010 2:05:54 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed C:\EclipseGalileo\workspace\Guestbook\war\WEB-INF/web.xml The server is running at http://localhost:/ Apr 16, 2010 2:07:08 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /favicon.ico Apr 16, 2010 2:07:25 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /favicon.ico Please advise where it goes wrong. Thanks! On Thu, Apr 15, 2010 at 9:57 PM, bobo wrote: > Hi > > I run Google App Engine (Java) locally with Eclipse. Following the > tutorial of Getting Started - Java, I lean it step by step and my > local server works well until the section Using JSPs. After adding > SignGuestbookServlet.java and greeting form in guestbook.jsp as well > as editing web.xml for servlet mapping for sign and /sign, I > restarted the server. My browser displayed error message immediately > after I tried to post a greeting message: > > HTTP ERROR 405 > Problem accessing /sign. Reason:HTTP method POST is not supported > by this URL > > In Eclipse console, the red error message like: > Apr 16, 2010 1:34:31 AM > com.google.appengine.tools.development.LocalResourceFileServlet doGet > WARNING: No file found for: /favicon.ico > > I googled this error but seems no one having this problem before. I > am stuck on this point and anyone who can shed me a light? > > Thanks! > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.