Servlet to Html/Jsp
Can someone enlighten me how to move from servlet code to html/jsp other than using the clumsy meta refresh html code??Many thanksRob Collett
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Should be between the <HEAD> and </HEAD> tags.
Similar Messages
-
Tomcat 6 Calling a Java Servlet from a JSP Page
Below is a very simple JSP Page that calls a Java Servlet. The question is given Tomcat security constraints, is it possible to call a servlet from a JSP and get the correct output without getting an error message? If so, how would you code the web.xml file?
c:\apache-tomcat-6.0.18
Under conf
catalina
localhost
HelloWorldExample.xml is directly under localhost
The application would have this directory structure:
webapps
HelloWorldExample
hello.jsp is directly under HelloWorldExample
Under HelloWorldExample
src
WEB-INF
classes
Under classes
jservlets
HelloWorld.java is in src folder
HelloWorld.class is in jservlets folder
HelloWorldExample.xml
<Context path="/HelloWorldExample" docBase="HelloWorldExample" debug="0"
reloadable="true" crossContext="true">
</Context>**************************
hello.jsp
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4">
<P>
Please enter your name:
<FORM
METHOD="Post"
ACTION="servlet/jservlets.HelloWorld">
<TABLE BORDER="3" CELLPADDING="1" WIDTH="100%" ALIGN="CENTER">
<TR>
<TD><B>Name:</B></TD>
<TD><INPUT TYPE="text" NAME="Name" VALUE="" SIZE="65"> </TD>
</TR>
</TABLE>
<P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</FONT>
</BODY>
</HTML>******************
HelloWorld.java
package jservlets;
import java.io.*;
import java.util.Date;
import java.util.*;
import java.text.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
PrintWriter out;
PrintWriter err;
String strName;
public void displayMessage(HttpServletRequest request, HttpServletResponse response)
throws Exception
try
if (!strName.equals("") && strName != null)
out.println("Hello " + strName + "" + "<P>");
out.println("Hello World" + "<P>");
else
out.println("Hello World" + "<P>");
catch (Exception e)
out.println("Exception: Could not display message." + "<P>");
err.println (e.getMessage () ) ;
out.println("<P>");
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
try
response.setContentType("text/html");
out = response.getWriter();
err = response.getWriter();
strName = request.getParameter("Name").trim();
out.println("<html><head><title>");
out.println("</title></head><body>");
out.println("<FORM");
out.println("METHOD=POST");
out.println("ACTION=http://localhost:8080/HelloWorldExample/hello.jsp>");
out.println("<TABLE ALIGN='RIGHT'>");
out.println("<TR>");
out.println("<TD>");
out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Hello World Page\";>");
out.println("</INPUT>");
out.println("</TD>");
out.println("</TR>");
out.println("</TABLE>");
out.println("</FORM>");
out.println("<BR CLEAR='all'>");
out.println("<P>");
displayMessage(request, response);
out.close();
out.println("</body></html>");
catch(Throwable e)
e.printStackTrace();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
doPost(request, response);
web.xml
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>jservlets.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping> ******************************
HelloWorld.java can be compiled by using javac.
Once compiled, HelloWorld.class would be moved to the jservlets folder.
FYI, coding the above url-pattern results in:
HTTP Status 404
The requested resource (/HelloWorldExample/servlet/jservlets.HelloWorld) is not available
The following url-pattern in the web.xml file permits the servlet to be executed but results in a null pointer exception:
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/ </url-pattern>
</servlet-mapping> **************************************************
RobinThis problem was resolved.
In hello.jsp
ACTION="servlet/jservlets.HelloWorld">
was replaced with
ACTION="servlet/HelloWorld">
Robin -
XML, XSL - HTML(JSP), bad UTF-8 encoding on Tomcat
I use simple transformation to create HTML (JSP) page from XML, XSL (both are encoded in UTF-8}. When doing this in embedded web server in JD9i developer, the result is fine. But when run at Tomcat 4.0.3, UTF-8 chars are displayed as 2 characters. It's interesting that the transformation gives different results:
- in JD9i the UTF-8 chars are left unchanged and shown good in IE browser
- in Tomcat the chars with acute (/) are transformed into "í" , "á" and so on and shown properly, whereas chars with caron (V) are encoded and shown badly.
Does somebody know solution to this ? Thanks.Doing some more experiments reveals a subtle difference between GET and POST with Tomcat - it may apply to other application servers, but I have only tested with Tomcat 5 and Tomcat 6, so I can't say.
The following is essentially what most people have indicated you need to do to have your JSP handle UTF-8:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!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=UTF-8">
<title>My Title</title>
</head>
<body>
</body>
</html>This is what I couldn't get working with my GET (the default for forms) and ended up working when I specified the URIEncoding for the connector in the server.xml file.
It turns out that the above will work with no modifications to the server.xml file if the form method is POST. If you need to be able use GETs then you will need to modify the connector, otherwise it would seem nothing you do at the JSP or servlet level will make a difference, unless you want to convert each parameter manually:
String parameter = new String( request.getParameter("myParam").getBytes("ISO-8859-1"), "UTF-8" );Edited by: ajmasx on Sep 27, 2007 10:20 AM -
How to Include a servlet in a jsp
Hello,
My jsp pages are all tied to respective Servlets. So when I have to forward to a jsp, I forward to a servelt which redirects to that jsp.
Now I have a jsp page which has to include another jsp page.
So I am trying to include a servlet in my jsp page which inturn redirects itself to the included jsp.
Have tried doing the following
<jsp:include page="../../servlet/ServletName" flush="true">
</jsp:include>
does not work. It compiles well but no output
any ideas ????
~ SoumyaIt does not seem to work... Let me give you the snippet of code I used.
calendarEntry.java - the parent jsp
<tr rowspan="60%">
<td width="100%">
<jsp:include page="file://c:/../../servlet/MonthEventList">
</jsp:include>
</td>
</tr>
MonthEventList.java - the included servlet
import javax.servlet.*;
import javax.servlet.http.*;
public class MonthEventList extends HttpServlet {
* Attributes
private static final String CONTENT_TYPE = "text/html";
private HttpSession session;
public void init() throws ServletException
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException
try {
HttpSession session = request.getSession(true);
String url;
url = "/jsp/site/calendar/monthEventList.jsp";
//ReDirect to where the page is going
response.sendRedirect(url);
return;
} catch (Exception ex) {
String url="/jsp/site/calendar/main/servletError.jsp;
response.sendRedirect(url);
return;
public void doGet(HttpServletRequest request,HttpServletResponse
response) throws ServletException, IOException
doPost(request, response);
monthEventList.jsp
just displays some dummy data
So if this is the case, do you think the <jsp:include> can work ??
Thanks in advance
Soumya -
Can I include a servlet in a jsp page?
Is there anyway to include a Servlet in JSP page?
What exactly do you want to achieve? And are you using 'include' in the generic sense or in the [JEE sense|http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html#include(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse)]?
By the way, behind the scenes, a JSP gets compiled into a servlet.
Edited by: nogoodatcoding on May 18, 2009 9:50 AM -
Include a Servlet into a JSP page
Hi guys,
When i try to include a Servlet into my JSP, the execution of the JSP stops...Somebody know why???Hi guys,
When i try to include a Servlet into my JSP,the
execution of the JSP stops...Somebody knowwhy???
No, and do you know why ? Bcos including a
servlet
in
a jsp doesnt stop the execution of the jsp. Sotell
us that you tried to do, post some relevant
code,
for us to help you.
ram.<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page buffer="500kb"%>
<html>
<head><title>JSP Page</title></head>
<body>
<jsp:include page="/showCryptValue"
ptValue" flush="true" />
asdfasdfasdfasdfasdf
</body>
</html>
that's the source code....do you have any idea????
Thak's a lottttFrom linxpda:
1) setting the flush="false" parameter for thejsp:include tag?
Here is the problem that I, and perhaps linxpda,
think you have:
You get an exception in the servlet.
You have already written to and flushed the response,
therefore you can not see the exception on your
screen (seeing the exception on screen requires a
send redirect to the error page, which can't happend
when the response is already committed).
The exception that is occuring MAY be alreay written
in your logs, take a look.
To see the problem on screen so as to be able to
identify it, make sure your include tag DOES NOT
flush the buffer. That means change
<jsp:include page="/showCryptValue" flush="true" />
to
<jsp:include page="/showCryptValue" flush="false" />Hi!
No even setting flush false or true it works...If somebody have done this before tell me how have you did....If you can post your code!
[]'s
Falow -
How to pass a object of JSP to a servlet called from JSP
Hi,
I am trying to display an image in the JSP through html image tag. I am using Struts Action class to get the image data from the database through a Session EJB. I am getting a byte array for the image retrieved from the database.
To display the image I need to call a servlet from the JSP from the image tag like this.
<html:img src="imageservlet" border="0"/>
But I need to send the image byte [] array data which is available with the JSP to the servlet to build image. I have a bean object with the JSP which holds the image byte []. The servlet should receive the bean object and will use the byte [] and build the image to be displayed.
My query here is how to send this bean object to the servlet which is getting called from the JSP as shown above.
Thanks in advance.Hi,
Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
Please help.
Thanks -
Challenge forwarding from a servlet to a JSP
Redirecting information from a servlet to a JSP
Hello Everyone,
I am processing the contents of a html form using a servlet. After processing the
information received and storing it into a javabean I am trying to pass control onto a jsp for
display. At this stage the jsp does not display as desired due to a URL challenge. The URL
which references my jsp is:
http://localhot/ferngully/prefset.jspThis url has been designated to the jsp page 'prefset.jsp' by the application specific web.xml
file (...I am using Tomcat 5!), the relevant contents of which follow:
<servlet>
<servlet-name>PreferenceSet</servlet-name>
<jsp-file>/prefset.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>PreferenceSet</servlet-name>
<url-pattern>/ferngully/prefset.jsp</url-pattern>
</servlet-mapping>If I access the page with the afore mentioned URL it displays correctly. However the URL which
is returned to the browser after the servlet has forwarded control to the JSP is:
http://localhost/ferngully/ferngully/PreferencesThe following form markup is used to access the servlet:
<form name="form1" method="post" action="ferngully/Preferences"> I know that I have mapped the servlet correctly because the servlet performs it's programatic tasks happily :)
I am using code within the servlet to forward control to the JSP, and I believe that this is the crux of my challenge.
The code for the servlet is listed below.
package userpreferences;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class PreferencesServlet extends HttpServlet
public void init(ServletConfig config) throws ServletException
super.init(config);
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String url = "/prefset.jsp";
ServletContext servCont = getServletContext();
RequestDispatcher reqDispatch = servCont.getRequestDispatcher(url);
reqDispatch.forward(request, response);
}I believe that the above highlighted code section is responsible for my challenge. I have tried changing the String url to "/ferngully/prefset.jsp",
however there was no improvement in functionality.
Can somebody please explain to me how I can go about directing the control of this process from the servlet to the jsp correctly? Particularly
how I can go about making the url returned to the client correct for accessing the jsp page? Do I need to delete the mapping entry for the
jsp page in web.xml? I am new to servlets & jsp so any help will be much appreciated.
Thanks
Kind Regards
Davo3. >The following form markup is used to access the servlet:
<form name="form1" method="post" action="ferngully/Preferences">Question 1:
why do you specify your contextname in action attribute again ?
General funda about urls:
When you have an index.html loaded through http://localhost/index.html, then a link in that html whose url is,
1. say, preferences.html (no forward slashes preffixed or suffixed) would load the html from the same folder.
2. say, /ferngully/prefences.html, would attempt to load a html from the ferngully folder that is a sub-directory
of your web-application
3. say, /ferngully/prefences.jsp, would attempt to load a html from the ferngully folder that is a sub-directory
of your web-application
When you have a servlet whose url-pattern is set to intercept requests, it would intercept requests that have that
pattern it is defined to intercept in web.xml (for example all the above requests in 1,2 and 3 would be intercepted
by a servlet whose pattern is ferngully/*)
Now if your action is not a specific resource (.jsp or .html), something like /preferences, this would map to a url
/ferngully/preferences. (for which a resource should be defined in web.xml - either a servlet or a jsp)
However the URL which is returned to the browser after the servlet has forwarded control to the JSP is:
http://localhost/ferngully/ferngully/PreferencesTell us the url of the original html
I know that I have mapped the servlet correctly because the servlet performs it's programatic tasks happily :)Tell us the url-appetrn of the servlet that intercepted your request
Particularly
how I can go about making the url returned to the client correct for accessing the jsp page?The url in the browser is always the request url, you cannot change it to the url of the jsp even which rendered the page
through a fwd from the servlet.
Do I need to delete the mapping entry for the
jsp page in web.xml?Not necessary. You can access the jsp directly from the servlet while forwarding by
1. specifying the exact path to the jsp. For example if the jsp is under a folder called jsps, your request dispatcher
url ought to be /jsps/prefset.jsp
2. specifying the jsp's url-pattern as specified in web.xml
Questions Contd
2. Why does the url pattern have to have a .jsp suffixed.
From your code
<url-pattern>/ferngully/prefset.jsp</url-pattern>It could equally well have been
<url-pattern>/ferngully/prefset</url-pattern>And then your servlet would have to forward it to ("/ferngully/prefset")
2. Your jsp-file mapping is in this form
<jsp-file>/prefset.jsp</jsp-file>This assumes that the jsp is in the top-level folder of your web-application and not under
any sub-directories. Correct ?
cheers,
ram. -
Can anyone enlighten me on a 'clean' way of jumping to html/jsp pages from a servlet. I'm currently using the meta refresh html tag which doesn't particularly work very well.Many ThanksRob Collett
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Should be between the <HEAD> and </HEAD> tags. -
Servlets, initArgs and JSP
Could someone from the WebLogic team please comment on this:
Is it really true that I cannot
a) Set some common arguments for all of my servlets at once, like:
servlets.default.initArgs = pooluser=someuser, poolpwd=somepwd
or
weblogic.httpd.initArgs.* = pooluser=someuser, poolpwd=somepwd
b) Read initArgs, added to the *.JSP section, from within a JSP like the
following:
String login = config.getInitParameter("pooluser");
or
String login =
getServletConfig().getServletContext().getInitParameter("pooluser");
or
String login = pageContext.getServletConfig().getInitParameter("pooluser");
I'm currently using WL 4.5.1. Neither of the tryouts in problem b works.
They all return "null".
As you can probably see from the code-sniplets I'm trying to hide the
WL-database-pool username and password from the programmer. It should not be
hardcoded in the servlets / JSPs, but embedded in the weblogic.properties
where it belong.
Carsten Jakobsen
Presys / Denmark
husbil,
I think generally speaking, servlets are the next generation of CGI scripts. As you mentioned, servlets are written in Java and CGI scripts are often written in Perl. The main difference between the two is that servlets can persist between requests, but CGI scripts cannot. Servlets are also more portable because of the whole platform-independence thing. In addition, when a request is made to a servlet, only a lightweight thread is spawned to handle the request, whereas each request to a CGI script can spawn a whole new process.
A JSP usually only handles the front-end aspects of Java-based web application. It'll be mostly HTML with a few snippets of Java code thrown in there to make your web page nice and dynamic. All the application logic should really be handled by the servlet, not the JSP, so I think that's why JSP's aren't really considered on the same page (no pun intended) as scripts and programs.
Does that help?
- Sheepy -
Do not know how to call Servlet from a JSP???
How do I call a Servlet from a JSP page?
I have an JSP page that does a few things but when there is an error I need the JSP page to call a Servlet but do not know how to do it.
I want to call a ServletFaillogin from a JSP page how can I do it?
<html><head>
<title> Login Page </title>
</head>
<body>
<%@ page import= "portal.* " %>
<jsp:useBean class="portal.PortalSystem" id="bean" scope="session" />
<% try
String servername = request.getParameter("servername");
String username = request.getParameter("username");
String password = request.getParameter("password");
bean.Connect(servername, username, password);
catch(Exception e)
//******Here I need help *********
action="http://localhost:8080/test/servlet/ServletFaillogin";
%>
<h1> You have successfully logged in. </h1>
</body></html>I have changed the code but get error, why??
I think it could be due to the way classes are located,
All my HTML and JSP pages are at:
C:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\jsp\portal-project
The class ServletFaillogin is located here:
C:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\WEB-INF\classes\portal
What am I doing wrong, please help???
<html><head> <title> FTP Login </title> </head>
<body>
<%@ page import= "portal.* " %>
<jsp:useBean class="portal.PortalSystem" id="bean" scope="session" />
<% try
String servername = request.getParameter("servername");
String username = request.getParameter("username");
String password = request.getParameter("password");
bean.Connect(servername, username, password);
catch(Exception e)
response.sendRedirect("http://localhost:8080/myJSPs/servlet/ServletFaillogin");
%>
<h1> You have successfully logged in. </h1>
</body></html> -
Problem for getting the real path using one servlet and one jsp page
I have one tomcat machine and several virtual domains. Eahc virtual domain has one realpath in the disc.
I am using one servlet and one jsp page for using this servlet.
my purpose is to load, using the servlet , the real path for the domains (eahc domain has its path).
for this i make this:
the servlet code is this:
package utils.ticker;
import java.io.*;
import java.io.File;
import java.io.IOException;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class Edicion extends HttpServlet{
public Edicion() {
public String cc(){
ServletContext myContext= getServletContext();
String abspath = myContext.getRealPath("/");
//here i want to return the real path
return abspath;
public static void main(String args[]){
and the jsp page is:
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%
tick.cc();
%>
</body></head></html>
But this produces one error, NullPointerException and dont shows me the real path.
Can anyone help me?
thanksi have put this into one sevlet:
package utils.ticker;
import javax.servlet.ServletContext;
public class Edicion{
private ServletContext myContext;
public Edicion(ServletContext myContext) {
this.myContext = myContext;
public String getCC(){
return myContext.getRealPath("/");
and in the jsp page this:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%=tick.getCC()%>
</body></head></html>
but appear this error in the tomcat.
Can you, please, help me. i am trying to solve this during one week and i am desesperate.
Thanks.
ERROR:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.pruebas_jsp._jspService(pruebas_jsp.java:72)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
Apache Tomcat/4.1.18 -
Hi, I have recently been having problems with embedding a servlet within a JSP. I have attempted to do this by using a frame within the JSP and using JSP include tags however, nothing seems to display. The reason why I want to do this is because I need to take advantage of servlet persistence which JSPs do not have, plus, I want to use the JSP to refresh the page produced by the servlet every so often using AJAX.
Any ideas? Thanks,
--RA JSP becomes a pure servlet on compilation. What persistence are u looking in a JSP ?
One reason you do not get anything is I am not tried this but I dont think its going to interpret the servlet code very well in the JSP page.
An include JSP tag includes another jsp/file inline and not sure if he can do a servlet there ? -
How to display outsream from a servlet in a JSP
I wrote a jsp file to call a Servlet, then want to display the result from the servlet in another jsp file. Anyone can give me possible solution or an example to illustrate it.
Many thanks in advance.
the file that call servlet in a jsp is as follow
<form method="POST" action="myservlet">
<table>
<tr>
<th align="center" colspan="2">
Enter The query words
</th>
</tr>
<tr>
<th align="right">query words:</th>
<td align="left">
<input type="text" name="querywords" size="60">
</td>
</tr>
<tr>
<td align="right">
<input type="submit" value="Search">
</td>
<td align="left">
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
............I would suggest that you use the Servlet to retrieve the data you are after and store it in the session. Then forward the user onto the JSP page where it can retrieve the object from the session and present it to the user in a formatted view.
-
Hi guys,
How do I Display a string from a servlet into a JSP Page...
Ive tried so many bloody things!.....
Simply.
I get text from JSP. The servlet does what ever it does to the string.
Now. Ive create sessions and bean things,.... how the hell do I display it in a text box... I can display on the screen.. but not in the text box.!!!
please help!!!hmmm, I dont really like using JSP programming, u should be using JAVA..
the way to do it is:
Call and cast to the bean like this:
<%@ page import="beans.*" %>
<% //cast to bean get request create object
userNameBean u= (userNameBean) request.getSession().getAttribute("userNameBean");
then... all you do is call it like this:
<input type="text" name="firstName" value="<%= u != null? u.getFirstName(): "" %>">
this is the real programmers way,,,
chet.~
Maybe you are looking for
-
Connecting Macbook to TV though HDMI
I'm finally getting an LCD tv and want to be able to connect my macbook to it. I was wondering if the audio would go through the TV if i used this cable. http://www.monoprice.com/products/product.asp?cid=104&cp_id=10428&cs_id=1042802&pid=5311&seq=1&f
-
Error on deploying JSP web module
Hi, I've created a JSP web module that consumes a web service. I'm following this tutorial [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0cf9e42-ccb0-2c10-d0a4-f5aa8a79e19a?quicklink=index&overridelayout=true|http://www.sdn.sap
-
S-video output on ATI Radeon X1900 XT
I just got a free quad G5. I was wondering if I needed a special 9-pin cable to get s-video out? I tried a 4-pin cable but it didn't seem to fit. Should I try to gently force the 4-pin into the 9-pin plug? Thanks
-
Sort photos in an event manually
Why would the sort manually option be grayed out, not able to choose? I went into event click view, click sort photos but the manually option is not available. Is there a way to change this? Thanks
-
Problem in dreamweaver - image file and swf file.
Hi friends.....nice to be here. Ahnm, lets start from the beginning! J I am new here and my english isnt so good, but i´ll try to explain what was happening with my webpage using Dreamweaver CS3 and a swf file-..Im sure that for most of you it's a ba