I'm getting this error while running the login application (Using GWT-RPC). How can I resolve this? I have provided the error list as well. What I'm missing?
------VinLog.html
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="VinLog.css">
<title>VinLog</title>
<script language="javascript" src="com.login.vinayak.VinLog/com.login.vinayak.VinLog.nocache.js"></script>
</head>
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
</body>
</html>
------web.xml
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <servlet-class>com.login.vinayak.server.GreetingServiceImpl</servlet-class>
> </servlet> <servlet-mapping>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <url-pattern>/Login</url-pattern> </servlet-mapping> <!-- Default page to serve --> <welcome-file-list>
> <welcome-file>VinLog.html</welcome-file> </welcome-file-list>
> </web-app>
------error list
com.google.gwt.user.client.rpc.StatusCodeException: 404 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>
<p>RequestURI=/com.login.vinayak.VinLog/login</p><p><i><small>Powered by Jetty://</small></i></p><br/>
<br/>
<br/>
</body>
</html>
You registered your servlet for the URL "/Login", but you're calling "/login".
You need to change either the <url-pattern> to lower case, or your #RemoteServiceRelativePath to upper case. Then restart the server.
Related
I am receiving a response from the api which is HTML, and I would like to know how I render this answer, if there is a library or something.
I am very grateful, I am wanting to learn and I am having difficulties in some things.
The response from api is something like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/199
flutter: ║ 9/xhtml"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head id="j_idt3">
flutter: ║ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="C
flutter: ║ ontent-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" conte
flutter: ║ nt="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
flutter: ║ <meta name="apple-mobile-web-app-capable" content="yes" /><link type="text/css" rel="s
flutter: ║ tylesheet" href="/SiGCExterno-war/javax.faces.resource/theme.css.xhtml?ln=primefaces-parad
flutter: ║ ise-blue" /><link type="text/css" rel="stylesheet" href="/SiGCExterno-war/javax.faces.reso
flutter: ║ urce/fa/font-awesome.css.xhtml?ln=primefaces&v=7.0hc" />
It keeps going for a time
here is all the response: https://docs.google.com/document/d/1k_PsbFx5_x9SXPIBzDRpXa8TnJYlANMFVxhoTibZZZ4/edit?usp=sharing
How can i render this?
Try this package simple_html_css
I can't seem to get my CSS to link to my page. I've tried multiple fixed already on the website and I've had a few people look at is but for some reason it just wont work. I've tried putting it in the Web-inf, and multiple difference ways in which too link the CSS.
JSP
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<!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=ISO-8859-1">
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.css" rel="stylesheet">
<title>Insert title here</title>
</head>
<body>
<div class="panel panel-default">Hello</div>
<p>${topAlbums.size() }</p>
<c:forEach items="${topAlbums}" var="album">
<p>${album}</p>
</c:forEach>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>Spring Web App</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
dispatcher-servlet
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
">
<context:component-scan base-package="com.springwebapp"> </context:component-scan>
<context:component-scan base-package="de.umass"></context:component-scan>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".jsp" />
</bean>
Error:
http://i.imgur.com/1zd9tHL.png
Files:
http://i.imgur.com/yL8je5u.png
UPDATE:
Got this working, it was something in my dispatcher servlet blocking all CSS files. Thanks for all the help people :)
I tried to reproduce the same example in this question using JSF 2.2.6 and Tomcat 7.0: JSF navigation rule doesn't work on form submit, I also read the JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output and respected all the recommandations provided by BalusC's answer, then I also consulted this question JSF 2 with HTML pages instead of XHTML because I want to use only .html files (I know i can use .xhtml but i need to understand the reason why this is not working).
I tried to make it simple as much as possible so any one could reproduce that:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="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">
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html</param-value>
</context-param>
</web-app>
faces-config.xml (Navigation rules are not needed as it's provided dynamicly):
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<navigation-rule>
<display-name>index.html</display-name>
<from-view-id>/index.html</from-view-id>
<navigation-case>
<from-outcome>welcomePage</from-outcome>
<to-view-id>/welcome.html</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
BeanFilm.java:
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
#ManagedBean
#SessionScoped
public class BeanFilm implements Serializable {
private String recherche = new String();
public String getRecherche() {
return recherche;
}
public void setRecherche(String recherche) {
this.recherche = recherche;
}
public String doRecherche() {
return "welcomePage";
}
}
index.html:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head>
<title>Accueil</title>
</head>
<body jsf:id="body" >
<h1>Plain HTML5 with JSF</h1>
<form jsf:id="form">
<input type="text" jsf:id="recherche" jsf:value="#{beanFilm.recherche}"/>
<input type="submit" jsf:value="Submit" jsf:id="searchButton" jsf:action="#{beanFilm.doRecherche}"/>
</form>
<ui:debug/>
</body>
</html>
welcome.html:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head>
<title>Accueil</title>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
The issue:
The exact problem is that when i click on the submit the method BeanFilm#doRecherch() is never called (using a breakpoint) and i can't really understand why? another information wich may be useful, is that in HTML code source attributes are still like jsf:id="searchButton"does this mean that the HTML wasn't generated?
Ok, so I've been stuck trying to setup a Spring MVC project integrated with DOJO for some time now. Finally decided it was time to make an account here and ask the question. I have everything loading except for my dojo.js file that I am referencing from my tag. I'll provide my project hierarchy and what I'm seeing:
My #RequestMapping method.
#RequestMapping(value = "/rbd", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
}
..When I browse to http://localhost:8080/myproject/rbd the application is successfully loading the home.jsp file, which is shown below:
<%# taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%# page session="false"%>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
<link rel="icon" href="../sba-icon.png" type="image/x-icon" />
<link rel="shortcut icon" href="../sba-icon.png" type="image/x-icon" />
<script src="<spring:url value='/scripts/dojo/dojo.js'/>" data-dojo-config:"locale:'en', async:true, parseOnLoad:false"></script>
..My JBOSS deployments folder follows the hierarchy myproject/scripts/dojo/dojo.js. My home.jsp is in myproject/WEB-INF/views/home.jsp. Is the location of the src tag relative to the location of the home.jsp? I'm so lost because I keep getting 404 errors.. yet I obviously know that dojo.js is on the server. I've tried every path that makes sense to me, I am a Spring/MVC beginner, so don't bash please!
Thanks for the help! :)
EDIT: Here is my init of my DispatcherServlet within my web.xml ...
<servlet>
<servlet-name>rbd</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/rbd/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rbd</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
..And here is my servlet-context.xml located in the path shown above..
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
The problem is that you have no mapping to your /scripts directory. When using Spring MVC, each request is being mapped to something. You have mapped the following:
/rbd: In your controller
/resources: In your servlet-context.xml (as a resource)
As you can see there's no kind of mapping for the /scripts directory, so in order to make it work you should either move it to the resources-folder (and adjust the links) or provide some additional mapping, by adding the following to your configuration:
<resources mapping="/scripts/**" location="/scripts/" />
Without it Spring simply doesn't know where it should refer to when you're trying to access Dojo.
DispatcherServlet intercepts the js file
you should set <servlet-mapping> like:
<servlet-mapping>
<servlet-name>rbd</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
meanwhile change your controller mapping:
#RequestMapping(value = "/rbd.do", method = RequestMethod.GET)
I am trying to get all calender details of all users. I got this successfully but its return result in Xml format as following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://www.google.com/calendar/feeds/email-id/private/full</id>
<updated>2012-02-15T15:34:49.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event"/>
<title type="text">email-id</title>
<subtitle type="text">email-id</subtitle>
<link href="https://www.google.com/calendar/embed?src=email-id" rel="alternate" type="text/html"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full" rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full/batch" rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full?max-results=25" rel="self" type="application/atom+xml"/>
<author>
<name>Name</name>
<email>email-id</email>
</author>
<generator uri="http://www.google.com/calendar" version="1.0">Google Calendar</generator>
<openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:totalResults>
<openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex>
<openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage>
<gCal:timezone value="Europe/Dublin" xmlns:gCal="http://schemas.google.com/gCal/2005"/>
<gCal:timesCleaned value="0" xmlns:gCal="http://schemas.google.com/gCal/2005"/>
<entry>
<id>http://www.google.com/calendar/feeds/email-id/private/full/vj39u2qedgphrp10nah92h6ho0</id>
<published>2012-02-15T11:21:54.000Z</published>
<updated>2012-02-15T11:21:54.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event"/>
<title type="text">Test Appointment</title>
<content type="text">This is a test description</content>
<link href="https://www.google.com/calendar/event?eid=dmozOXUycWVkZ3BocnAxMG5haDkyaDZobzAgcmFoaW1AZGFtc2" rel="alternate" title="alternate" type="text/html"/>
...
</entry>
</feed>
I want to get the value of title and content.Please share me with the solution
Thank you
Use the built-in Xml service https://developers.google.com/apps-script/service_xml.
With this sevice you can parse thru the xml document.