Problems with my first Servlet
Hello,
I'm using tomcat 5 and Java SDK 5.0
I have compiled a Java class called HelloServlet.class, which is in the package foo/bar.
Now I have copied the class to the tomcat directory \webapps\servlets-examples\WEB-INF\classes.
According to my book it should work now, but it doesn't.
under http://localhost:8080/servlets-examples/fo/bar/HelloServlet I get an Error Message HTTP-Status 404
What could I did wrong?
Have you made an entry for the your servlet in the web.xml of Examples?
you would have to include something like:
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>foo.bar.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/foo/bar/HelloServlet</url-pattern>
</servlet-mapping>
Similar Messages
-
I created one apple I'd when I started using the iPad. After some days, I had to create a new apple id
as there was some problem with the first one. Now at some places still my old apple Id is appearing. Pls adv how I change this to my new apple Id.Anything you downloaded with the first Apple Id will forever be tied to it, and will always require it to update.
The question here is, why did you think you needed to create a new Apple ID? What was the problem with the first one?
To get rid of th old one, you'll need to delete everything you downloaded with it, and then sign out of the ID in several places around the iPad.
Go to Settings->iTunes & App Stores->Apple ID->Sign out.
Repeat the process, for Facetime, Messages, Mail and any other App you need to sign out of. -
Problem with Sessions in Servlets
Hi,
I'm having a problem with sesions with servlets. It seems that if someone logs into my website, which is running on all servlets, while another person is logged on, the second person gets the session of the first person.
I'm using
HttpSession session = request.getSession(true);to get the session in each page. The session contains a user object which shows if the user is logged in and what permissions.
The session should be unique to the client computer right? Or am I jsut screwing this up big time?Yes, each client will have their own session. However, you may be testing incorrectly:
In Firefox, for example, all instances of the application running on the same machine will share the same cookies, therefore the same session, and would be considered one client.
MS IE will do the same if you use File - New to open a new wondow rather than clicking on the desktop icon.
If the different clients are using different machines and still getting shared data, then you may be using class-level variables in the servlet, which would not be thread safe and could lead to your problems...
public class MyServlet extends HttpServlet {
String data; //bad
int moredata; //bad
public void doGet(...) ... { ... }
} -
Problem with logout in servlet After logging out i need to expire the pages
I have a problem in logout using servlet.
I introduced sessions in my page and while logout i used
session.removeAttribute("name");
session.removeAttribute("password");
res.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
res.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
res.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
String user=(String)session.getAttribute("name");
System.out.println(user);
if(user==null)
System.out.println("hi");
req.setAttribute("Error", "Session has ended. Please login.");
res.sendRedirect("http://localhost:8080/homepage.html");
and after i logout im redirected to login page but after clicking back button im getting back to restricted pages(the pages b4 logout).
what should i do?????Thanks Dear BalusC,
I tried with this,
rs.getString("DATA_SCAD1")// where the source from .xls files
String pattern = "yyyy-MM-dd";
SimpleDateFormat format = new SimpleDateFormat(pattern);
try {
Date date = format.parse("DATA_SCAD1");
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
System.out.println(format.format(new Date()));
this out put gives me Tue Apr 03 00:00:00 IST 2007
But I want to display the date format in yyyy-mm-dd.
regards,
maza -
Problem with running multiple servlet in same webapplication with tomcat 3
Hi all,
I am using Tomcat 3.0 as webserver with jdk1.3, Servlet 2.0,
Templates for html file and oracle 8i on UNIX platform.
I have problem with multiple servlet running same webapplication.
There are two servlet used in my application. 1) GenServlet.class
and 2) ServletForPrinting.class
All of my pages go through GenServlet.class which reads some property files
and add header and footer in all pages.
I want reports without header & footer that is not possible through GenServlet in my application.
So I have used another servlet called ServletForPrinting --- just for reading html file.
It is as follow:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletForPrinting extends HttpServlet {
public void service (HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
// set content-type header before accessing the Writer
response.setContentType("text/html");
PrintWriter out = response.getWriter();
File f1 = null;
String report = null;
String path = request.getPathInfo();
try{
String p = "/var/home/latif/proj/webapps/WEB-INF/classes" + path;
System.out.println(p);
f1 = new File(p);
p = null;
if (f1.exists()) {
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
report = new String();
while ((report = br.readLine()) != null) {
out.println(report);
}catch(Exception e) {
out.close();
report = null;
path = null;
f1 = null;
} // end class
It works fine and display report properly.
But now Problem is that if report is refreshed many times subsequently,
WebServer will not take any new change in any of java file used in web-application.
It works with the previous class only and not with updated one.
Then I need to touch it. As soon as I touch it, webserver will take updated class file.
Anybody has any idea regarding these situation?
Is there any bug in my ServletForPrinting.java ?
Any solution ????? Please suggest me.
Suggestion from all are invited. That will help me a lot.
Thanks in advance
Deepalee.Llisas wrote:
I solved the problem, I just had to wire the blocks in a sequential way (I still don't know why, but it works).
Feel free to delete this topic.
I would strongly suggest at least reading this tutorial to give you an idea of why your fix worked (or maybe only appeared to work). Myself, I never just throw up my hands and say, "Whatever," and wash my hands of the situation without trying my best to understand just what fixed it. Guranteed you'll run into the same/similar problem and this time your fix won't work.
Please do yourself a favor and try to understand why it is working now, and save yourself (or more likely, the next poor dev to work on this project) some heartache.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
Problems with the first USB port
Hi,
I'm having a problem with my 13 inch i5 Macbook Pro
For some reason my first USB port isn't working well, doesn't matter what, i plug in it just won't recognize anything.
But whenever I restart my mac, everything works well, and after about 2~3 days it stopps again and I have to reset or log out my mac again..
I tried to reset the SMC and the PRAM, it didn't work
This is freaking me out, I've never dropped my mac or something. It's not really old bought it in august.
I also upgraded to lion, it didn't work sadly and this problem still exists.
I'm pretty sure some people have this too, this is not an hardware issue, it's a software issue
Does anyone got any idea?
ThanksElectroSpyzz wrote:
this is not an hardware issue, it's a software issue
How do you know? -
Problems with MBOX (first version) with new Logic Pro 9 - only Input 1 work
Hi,
i never had problems with my old MBOX. Since 2 days I switched to Logic Studio 2 and Logic Pro 9. Very nice realease, but: when I create an audio object and choose the inputs in the channel strip for the MBOX, i only get Input 1, no Input 2! When I connect my MBOX in Logic (Audio Preferences) and launch with my started Logic, both Inputs are avaiable and both are working correctly. But never after having started Logic 9...
Any ideas?
I never had this problem with Pro 7 or 8.
Greetz,
Axel
MAC OS X 10.5.8
coreaudioinstaller_v74249904 for MBOX
Mac Book 4GB Intel Dual Core 2.1MHzOmg.... I't my total memory mistake !! lol
Sorry. Sorry.. Totally wrong post
Really - Logic Remote is only Logic X App....
Shame ... Thanks The Art Of Sound ...
Btw.... May be someone know iPad tool for remotely controlling Logic Pro 9 ? It's need me for recordings - i play on guitar and want remotely control Logic from audio isolated room... -
Problems with file uploading servlet, the form action doesnt capture url
Hi, i have one problem. I am working on a project , i have created a servlet that takes uploaded files and processses them and links them back to user to download. The servlet works perfectly from my computer, I am using apache-tomcat-6.0.16 and java 1.6 , I have two forms called encrypt.html and decrypt.html, I will post both of them, now the problem is when somebody access it on the internet while i am running apache, they get a connection was reset on a firefox browser and same stuff on Internet Explorer.
i have checked my server logs and saw nothing unusual there, So please if you can help me, it is my project.
I am pasting html file and error message that other users where getting remotely.
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Stego Form</title>
<link rel='STYLESHEET' type='text/css' href='encrypt.css'>
</head>
<body>
<center>
<form name='encrypt' enctype='multipart/form-data' method='POST' action='http://localhost:8080/examples/temp2
' accept-charset='UTF-8'>
<input type='hidden' name='sfm_form_submitted' value='yes'>
</input>
<input type='hidden' name='eord' value='e'>
<select name='encryption' size='1'>
<option value='Select an encryption' selected>
Select an encryption
</option>
<option value='DES'>
DES
</option>
<option value='Tripple DES'>
Tripple DES
</option>
</select>
<input type='file' name='overt' size='20'>
<input type='file' name='covert' size='20'>
<input type='submit' name='submit' value='Submit'>
</form>
</center>
</body>
</html>so it works for me even if i access the page with my ip , but for others it doesnt work,
now the user got this xhtml page that i will show, i cant find attach button so i am pasting here.
here is the servlet coding
import java.io.*;
import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class temp2 extends HttpServlet
FileInputStream fin;
String filenames[] = new String[2],fieldname,fieldval;
String keyfile,IVfile;
String names[] = new String[2];
public temp2()
super();
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String eord="";
List lst = null;
boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
if (!isMultiPart) // check whether the post request is actually multipart
System.out.println("ERROR NOT MULTIPART");
System.exit(0);
DiskFileItemFactory fif = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(fif);
sfu.setSizeMax(10000000);
try { lst = sfu.parseRequest(request); }
catch (FileUploadException ex)
{ System.out.println("ERROR IN PARSING FILES" + ex); System.exit(0); }
if(lst.isEmpty()) // check whether request is empty
System.out.println("ERROR LIST SIZE NOT GOOD : " + lst.size());
System.exit(0);
Iterator x = lst.iterator();
int i = 0;
FileItem f = (FileItem)x.next();
f = (FileItem)x.next();
System.out.println(f.getFieldName());
if(f.getFieldName().equalsIgnoreCase("eord")) // check hidden field to know the case : encrypt or decrypt
eord = f.getString();
System.out.println(f.getString());
else // if it is not first field exit
System.out.println("Invalid FORM");
System.exit(0);
f = (FileItem)x.next(); // next field
if(f.getFieldName().equalsIgnoreCase("encryption")) // type of encryption des / tdes
fieldname = f.getFieldName();
fieldval = f.getString();
System.out.println(f.getString());
if(eord.equalsIgnoreCase("e")) // if it is encryption form only file required
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
names[i] = ff.getName(); // original file names
try
f.write(ff);
filenames[i] = ff.getAbsolutePath();
// renamed
ff.deleteOnExit();
}catch(Exception e) {System.out.println("Error writing file"+ ff.getAbsolutePath()); System.exit(0);}
i++;
try { System.in.read(); } catch(Exception e) {}
}// endwhile
if(fieldval.equalsIgnoreCase("DES"))
System.out.println("DES 1"+filenames[1]);
javades o = new javades(filenames[1]); // the file to be encrypted
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println("should be original" + filenames[1]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[1]);
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println(filenames[1]);
System.out.println("Calling stego");
filenames[0] = "e:\\apache\\webapps\\temp\\" + names[0];
System.out.println("file 1 "+ filenames[0]);
System.out.println("file 2"+ filenames[1]);
try { System.in.read(); } catch(Exception e) {}
stego s = new stego(filenames[0],filenames[1]);
System.out.println("mainext " + s.mainext);
// encryption done, and new files are loaded, now lets hide
if(s.mainext.equalsIgnoreCase("wav"))
s.encodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
System.out.println("Encoded bmp");
s.encodebmp();
System.out.println("done !");
PrintWriter pr = response.getWriter();
pr.println("Greetings , Your work is done and saved, now download the following files");
pr.println("The secret key file is needed for getting back your hidden file, so download that too");
pr.write("<a href=\"/temp/files/IV.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/key.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/"+names[0]+"\">click here</a>");
return;
// if it is decryption case
else if(eord.equalsIgnoreCase("d"))
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
// else if ladder to store paths of stegofile keyfile and IVfile
if(f.getFieldName().equalsIgnoreCase("stegofile"))
filenames[0] = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("keyfile"))
keyfile = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("IVfile"))
IVfile = ff.getAbsolutePath();
try
f.write(ff); // writes whole file at once
}catch(Exception e) {System.out.println("Error writing file"); System.exit(0);}
}// endwhile
System.out.println("Calling stego");
System.out.println("file 1 "+ filenames[0]);
stego s = new stego(filenames[0]);
System.out.println("mainext " + s.mainext);
if(s.mainext.equalsIgnoreCase("wav"))
s.decodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
s.decodebmp();
System.out.println("Encoded bmp");
System.out.println("done !");
////// hidden file has been retrieved , now lets decrypt it
System.out.println("ext " + s.ext);
filenames[0] = "e:\\apache\\webapps\\temp\\"+s.filename;
System.out.println(filenames[0]);
System.out.println(keyfile);
System.out.println(IVfile);
if(fieldval.equalsIgnoreCase("DES"))
javades o = new javades(filenames[0],keyfile,IVfile); // the file to be encrypted
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println("should be original" + filenames[0]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[0],keyfile,IVfile);
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println(filenames[0]);
PrintWriter pr = response.getWriter();
pr.write("Greetings, you have successfully retrieved your hidden file, now download it from here <br>");
pr.write("<a href=\"http://localhost:8080/temp/files/" + (new File(filenames[0]).getName())+"\">Click here</a>");
}and here is the xhtml file the user receives, whe he clicks the submit button,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY loadError.label "Problem loading page">
<!ENTITY retry.label "Try Again">
<!-- Specific error messages -->
<!ENTITY connectionFailure.title "Unable to connect">
<!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
<!ENTITY deniedPortAccess.title "This address is restricted">
<!ENTITY deniedPortAccess.longDesc "">
<!ENTITY dnsNotFound.title "Server not found">
<!ENTITY dnsNotFound.longDesc "
<ul>
<li>Check the address for typing errors such as
<strong>ww</strong>.example.com instead of
<strong>www</strong>.example.com</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY fileNotFound.title "File not found">
<!ENTITY fileNotFound.longDesc "
<ul>
<li>Check the file name for capitalization or other typing errors.</li>
<li>Check to see if the file was moved, renamed or deleted.</li>
</ul>
">
<!ENTITY generic.title "Oops.">
<!ENTITY generic.longDesc "
<p>&brandShortName; can't load this page for some reason.</p>
">
<!ENTITY malformedURI.title "The address isn't valid">
<!ENTITY malformedURI.longDesc "
<ul>
<li>Web addresses are usually written like
<strong>http://www.example.com/</strong></li>
<li>Make sure that you're using forward slashes (i.e.
<strong>/</strong>).</li>
</ul>
">
<!ENTITY netInterrupt.title "The connection was interrupted">
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc "
<ul>
<li>Uncheck "Work Offline" in the File menu, then try again.</li>
</ul>
">
<!ENTITY netReset.title "The connection was reset">
<!ENTITY netReset.longDesc "&sharedLongDesc;">
<!ENTITY netTimeout.title "The connection has timed out">
<!ENTITY netTimeout.longDesc "&sharedLongDesc;">
<!ENTITY protocolNotFound.title "The address wasn't understood">
<!ENTITY protocolNotFound.longDesc "
<ul>
<li>You might need to install other software to open this address.</li>
</ul>
">
<!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
<!ENTITY proxyConnectFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Contact your network administrator to make sure the proxy server is
working.</li>
</ul>
">
<!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
<!ENTITY proxyResolveFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Check to make sure your computer has a working network connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY redirectLoop.title "The page isn't redirecting properly">
<!ENTITY redirectLoop.longDesc "
<ul>
<li>This problem can sometimes be caused by disabling or refusing to accept
cookies.</li>
</ul>
">
<!ENTITY unknownSocketType.title "Unexpected response from server">
<!ENTITY unknownSocketType.longDesc "
<ul>
<li>Check to make sure your system has the Personal Security Manager
installed.</li>
<li>This might be due to a non-standard configuration on the server.</li>
</ul>
">
<!ENTITY sharedLongDesc "
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
- The Original Code is mozilla.org code.
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998
- the Initial Developer. All Rights Reserved.
- Contributor(s):
- Adam Lock <[email protected]>
- William R. Price <[email protected]>
- Henrik Skupin <[email protected]>
- Jeff Walden <[email protected]>
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK ***** -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Problem loading page</title>
<link rel="stylesheet" href="temp2_files/netError.css" type="text/css" media="all"/>
<!-- XXX this needs to be themeable -->
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAICSURBVHjaYvz//z8DJQAggJhwiDPvnmlzc2aR0O+JGezt+AwACCCsBhxfYhn59N41FWtXIxZOLu70niRGXVwGAAQQNgNYHj96O8HaWYdJW5ubwd4/mI2Ng7sblwEAAYRhwMm1URk/vn4SUNWVYGD8+YZBXZOZm5OLzRjoCmNsBgAEEKoBN82Y7l851GLrqMjM8Oc7A8O/3wwMP54wuAQFCXNycUzGZgBAAKEYcOaKZO2/f//5FbUVgBrfMoRVcgHpNwyKGjKMXDwCan0prFboBgAEELIBzDcvXyy2cVZhYPj9GWj7H4jo/38MDJ9OMDj7O/KzsjH3oxsAEEBwA/bNNipiZf7FI6cqwcDw8x2qqp8fGORUpVn4BEXlgGHhhCwFEEAwA9gfP3hdZ+Oizcjw+wvCdjgAuuLrFQbXIH9hTm7uqcgyAAEENuD4ctcebm5mbikFYRTbV7V/Q6j88Z5BSuY7q4CQgAjQFR4wYYAAAhtw89L5ZFsnRaDtn4CW/YXrAQcisit+PGVwDgrnZ2NnnwATBQggpsNLvGYLCAmxi8tLARWg+h3FBVBXSEj/ZZWQkRcCuiIQJAQQQCyvnj5KMDTkZ2JgYmRg4FchnHv+vmEwttLmeXT3VjKQtx4ggFgk5TXebV63UfT3ijOMxOZAVlZWdiB1EMQGCCBGSrMzQIABAFR3kRM3KggZAAAAAElFTkSuQmCC"/>
<script type="application/x-javascript"><![CDATA[
// Error url MUST be formatted like this:
// moz-neterror:page?e=error&u=url&d=desc
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
function getErrorCode()
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
function getDescription()
var url = document.documentURI;
var desc = url.search(/d\=/);
// desc == -1 if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (desc == -1) return "";
return decodeURIComponent(url.slice(desc + 2));
function retryThis()
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call
// reload(), which will also repost POST data correctly.
try {
location.reload();
} catch (e) {
// We probably tried to reload a URI that caused an exception to
// occur; e.g. a non-existent file.
function initPage()
var err = getErrorCode();
// if it's an unknown error or there's no title or description
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
var errDesc = document.getElementById("ed_" + err);
if (!errTitle || !errDesc)
errTitle = document.getElementById("et_generic");
errDesc = document.getElementById("ed_generic");
var title = document.getElementById("errorTitleText");
if (title)
title.parentNode.replaceChild(errTitle, title);
// change id to the replaced child's id so styling works
errTitle.id = "errorTitleText";
var sd = document.getElementById("errorShortDescText");
if (sd)
sd.textContent = getDescription();
var ld = document.getElementById("errorLongDesc");
if (ld)
ld.parentNode.replaceChild(errDesc, ld);
// change id to the replaced child's id so styling works
errDesc.id = "errorLongDesc";
// remove undisplayed errors to avoid bug 39098
var errContainer = document.getElementById("errorContainer");
errContainer.parentNode.removeChild(errContainer);
]]></script>
</head>
<body dir="ltr">
<!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
<!-- PAGE CONTAINER (for styling purposes only) -->
<div id="errorPageContainer">
<!-- Error Title -->
<div id="errorTitle">
<h1 id="errorTitleText">The connection was reset</h1>
</div>
<!-- LONG CONTENT (the section most likely to require scrolling) -->
<div id="errorLongContent">
<!-- Short Description -->
<div id="errorShortDesc">
<p id="errorShortDescText">The connection to the server was reset while the page was loading.</p>
</div>
<!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
<div id="errorLongDesc">
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.</li>
</ul>
</div>
</div>
<!-- Retry Button -->
<xul:button xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="errorTryAgain" label="Try Again" oncommand="retryThis();"/>
</div>
<!--
- Note: It is important to run the script this way, instead of using
- an onload handler. This is because error pages are loaded as
- LOAD_BACKGROUND, which means that onload handlers will not be executed.
-->
<script type="application/x-javascript">initPage();</script>
</body>
</html>thank you for your prompt reply in advance,
Regards,
Mihir PandyaHi, thank you for your replies, I found out few things about my servlet, and its portability
and i have few questions, although i marked this topic as answered i guess its ok to post
I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
of the modified files to the user for them to download the modified files.
What i am using to get the tempdir i will paste
File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
System.out.println(baseurl);
baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
links to the user for download ?
and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
And i want to create unique directory for each request made to the servlet , so file names dont clash.
one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
Reply A.S.A.P. please..
Thanks and regards,
Mihir Pandya -
Hi,
My 1stgen iPad keeps. Switching back to the apps. Pages by itself after installing ios5. I have shut it down manually as suggestedby a tech rep but the problem still exists.
Thanks, Jim1) This is because of software version 1.1. See this
thread for some options as to how to go back to 1.0,
which will correct the problem...
http://discussions.apple.com/thread.jspa?threadID=3754
59&tstart=0
2) This tends to happen after videos. Give the iPod a
minute or two to readjust. It should now be more
accurate.
3) This?
iPod shows a folder icon with exclamation
point
4) Restore the iPod
5) Try these...
iPod Only Shows An Apple Logo and Will Not Start
Up
iPod Only Shows An Apple Logo
I think 3,4, and 5 are related. Try the options I
posted for each one.
btabz
I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again -
Problems with exec() in Servlet
Hi All,
In my project i have used exec()in servlets to get the ouput from the c- program.I am using linux 8.0 and the server is tomcat-4.1.24.so that i try this following code:-
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletExecute extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
String[] command={"/bin/csh","-c","home/anand/Ananth/grpmaschk.run sptest S"};/*Here the grpmaschk.run is a c-program which genarates an output that is passed to sptest as parameter and S is a argument which indicates the action is done from Servlet*/
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
Process p=null;
Runtime rt=Runtime.getRuntime();
try
p=rt.exec(command);//Executing the action on command string
catch(Exception e)
out.println("The Error Message is:"+e.getMessage());
try
FileInputStream fin=new FileInputStream("/home/Ananth/sptest");/*
Once the output is generated from the c-program it will be stored in the sptest in /home/Ananth */
BufferedReader br =new BufferedReader(new InputStreamReader(fin));
String line=null;
while((line=br.readLine())!=null)
out.println(line); //From there i am reading the contents in it to be displayed in the browser
} catch(Exception e1)
out.println("The error message was:"+e1.getMessage());
Whren it is displayed in the browser i am getting an error
/home/Ananth/sptest not found which means that exec() is not working (or)executing.What is the problem here ???Plz. do provide a solution for this.It is quite Urgent.I will be waiting for ur replies.
Thanx,
m.ananthuHi sir,
Sorry for the mistake i did there but by using /home/....
also the output is not coming.
Here is the code again for ur reference:-
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletExecute extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};//corrected one
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
Process p=null;
Runtime rt=Runtime.getRuntime();
try
p=rt.exec(command);
catch(Exception e)
out.println("The Error Message is:"+e.getMessage());
try
FileInputStream fin=new FileInputStream("/home/anand/Ananth/sptest");
BufferedReader br =new BufferedReader(new InputStreamReader(fin));
String line=null;
while((line=br.readLine())!=null)
out.println(line);
} catch(Exception e1)
out.println("The error message was:"+e1.getMessage());
Here exec(....) is going through but the path in FileInputStream is showing an error.The error message i got when i run it in the browser is :-
The error message was:/home/anand/Ananth/sptest (No such file or directory).Which means exec() function itself is not executed???. Is there any thing to do with security reasons or anything u need to configure in the tomcat configuration file??? Where i found that
when i give /home/anand/Ananth/grpmaschk.run only in the exec() then the output is diaplyed in the browser.So i think exec() is workuing well but not with this huge argument
String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};
Pls. do provide a solution for this problem.I will be waiting for ur replies.....
Thanx,
m.ananthu -
Problem with my applet-servlet comunication
Hello:
I'm using a dynamic chart on my applet, which gets the data from a servlet, by URLConnection. These service work, but after a moment, the chart scroll is stopped and I get the next error on java console:
java.security.AccessControlException: access denied (java.net.NetPermission
getProxySelector)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java
:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at
java.lang.SecurityManager.checkPermission(Ljava.security.Permission;)V(Unkno
wn Source)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:6
61)
at jfch.AppletGraphic$DataGenerator.sendCommand(AppletGraphic.java:307)
at jfch.AppletGraphic$DataGenerator.actionPerformed(AppletGraphic.java:259)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.
The applet make request to servlet by URLConection permanently, which gets
the data from SQL Server.
I'm using JVM 1.5.
The applet makes requests to servlet by normally url, not access to local resources (or file system).
Please can anyone help me?
Regards, Ulises.http://java.sun.com/j2se/1.5.0/docs/api/java/net/ProxySelector.html
Selects the proxy server to use, if any, when connecting to the network resource
referenced by a URL. A proxy selector is a concrete sub-class of this class and is
registered by invoking the setDefault method. The currently registered proxy selector
can be retrieved by calling getDefault method.
The getDefault Throws:
SecurityException - If a security manager has been installed and it denies
NetPermission("setProxySelector")
http://java.sun.com/j2se/1.5.0/docs/api/java/net/NetPermission.html
getProxySelector
The ability to get the proxy selector used to make decisions on which proxies
to use when making network connections.
Malicious code can get a ProxySelector to discover proxy hosts and ports on
internal networks, which could then become targets for attack.
I checked my java.policy for my w2k jre 1.5 installation but could not find any specific
NetPermission in there. I never had this problem using URL and URLConnections
in 1.5 but it sounds strange that creating an URL in an applet could throw a
SecurityException with the default jre 1.5 installation (both objects are introduced
since 1.5).
If you are using windows could you open the java control panel and select "use
browser settings" in the General tab after clicking the "Network settings" button?
I have this option in my jre settings and never got that Exception. -
I'm doing a simple servlet that invokes an EJB taht returns an ArrayList with a values.
My problem is that I do trace of my execution an this woks well in the EJB but when my remothe method do the return the app finish and never return to servlet that invoked it. I don't know 'cause this happend.
I'm using WASD 5.0.1 as my Web y EJB container.
Help would be appreciateWhat does that ArrayList contain?
Could you post the code please. -
Problems with my first site. Please help.
Hi,
I am fairly new to flash. I need some help if anyone can
spare a few moments. First off, my site is about 15mb in size and I
have it hosted by a shared hosting service. It takes a VERY long
time to load. Since I am new to this, I cannot tell whether to
upgrade the hosting service or to downgrade the flash site itself
and delete some content. Please advise.
Also, I used a template for this site, and was sucessful in
customising it, one problem is that I have a gallery in there and
only about 10 pictures on the screen, I have 'pre-made' buttons in
the botom that supposed to act as links to the next page (says
'next' in the bottom of the page), but I have no idea how to
duplicate the existing page and link it so that I can paste new
pics on page 2 and link it to page one. Can someone please point me
in the right direction?
the website is sikdancemuvz.com
Thanks in advance.OMG! 15MB? that's pretty insane regardless of the user's
bandwith - with good amount of traffic to
your site you will quickly reach the bandwith limit set by
your host and incur possible additional
hosting costs.
let's put it this way - a well designed website in general
(flash, html, hybrid, etc..) should way
in around 100k depending - a good idea of the weight of a
basic HTML page would be around 30-50k
depending on graphics.
What do you have in your flash movie? Video? Audio? Are you
using any compression on anything? Look
up loadMovie in the Flash help docs as well.
As for your question on "pages" - Flash doesn't have "pages"
per se - so not sure exactly what you
mean here.
I have a funny feeling your biggest problem is a lck of
knowledge about graphics and delivering
multimedia to the web in general.
Your site, on my cable modem, took several minutes to load -
nowadays, if a site doesn't load
instantly (or at worst, within 3 seconds) the user is going
to close the browser or navigate away
from your site.
So, once your site loaded (finally) there was annoying
"Enter" button - what was I waiting for?
So it seems you have entire high quality music and graphics
here...this site, if built properly
should have loaded within 2 seconds maximum - this is
achieved by having some very light weight
content to load quickly at first - then load more content in
the background - use loadMovie to load
separate SWF movies into one single container movie. NEVER
make the user sit and wait for content
they may decide not to listen to or look at.
There is no one direction to point you too - you need to
understand the web, flash and graphics and
how it all comes together in a way that is user friendly.
www.gotoandlearn.com
www.keyframer.com
www.lynda.com
www.kirupa.com
Chris Georgenes
Adobe Community Expert
mudbubble.com
keyframer.com
howtocheatinflash.com
maxswellz wrote:
> Hi,
>
> I am fairly new to flash. I need some help if anyone can
spare a few moments.
> First off, my site is about 15mb in size and I have it
hosted by a shared
> hosting service. It takes a VERY long time to load.
Since I am new to this, I
> cannot tell whether to upgrade the hosting service or to
downgrade the flash
> site itself and delete some content. Please advise.
>
> Also, I used a template for this site, and was sucessful
in customising it,
> one problem is that I have a gallery in there and only
about 10 pictures on the
> screen, I have 'pre-made' buttons in the botom that
supposed to act as links
> to the next page (says 'next' in the bottom of the
page), but I have no idea
> how to duplicate the existing page and link it so that I
can paste new pics on
> page 2 and link it to page one. Can someone please point
me in the right
> direction?
>
> the website is sikdancemuvz.com
>
> Thanks in advance.
> -
Problem with form or servlet???
hello..
i am trying to send some form data to a servlet for processing..
here is the code for the form
<table border="0">
<form action="details.upd" method="post" name="upd">
<tr><td>Username</td><td><input name="uname" type="text" size="25" maxlength="30"
value=<%=session.getAttribute("user") %> /></td>
</tr>
<tr>
<td>password</td><td><input name="pass" type="password" size="25" maxlength="30" />
</td></tr>
<tr><td>confirm password</td><td><input name="pass2" size="25" maxlength="30" type="password"/></td></tr>
<tr><td>Email</td><td><input name="mail" type="text" size="25" maxlength="30"
value=<%=session.getAttribute("EMAIL") %> /></td></tr>
<tr><td align="center"><input name="submit" type="button" value="Update" /></td></tr>
<tr><td align="center"><input name="ch" type="hidden" value="det"/></td></tr>
</form>
</table>
here is the web.xml entry for my compiled servlet
<servlet>
<servlet-name>update</servlet-name>
<description>
Servlet used for updates sent from landlord sessions
</description>
<servlet-class>UpdateServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>update</servlet-name>
<url-pattern>*.upd</url-pattern>
</servlet-mapping>
the problem is that when i click the submit button to send the data, nothing happens....absolutely nothing. the page just stays as it is...please can u spot any fatal error in the code?
I have looked and looked without success..please helpyeah..i solved that.. but now i am getting another
problem...
why does this code...
Stringuser=(String)session.getAttribute("user");
gives me a class cast exception????
please helpBecause the object named "user" in your session isn't
a String.ok...thks -
Problem with JSP and servlet in Tomcat
hello all,
I have made a simple hello world in Eclipse and Tomcat, it works well on my localhost, but now that I try to run it on the server in our lab I got this exception:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Implementing class
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.IncompatibleClassChangeError: Implementing class
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
java.lang.Class.getConstructor0(Class.java:2640)
java.lang.Class.newInstance0(Class.java:321)
java.lang.Class.newInstance(Class.java:303)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
I have transfered the web.xml file and lib and classes folder in a WEB-INF folder and also all the JSP files. I can see he JSP file, but the 'hello worl' does not work and gives this exception!
Does any one have any idea what could be the problem?
thanks a lot
Mitraseems the web Server code previously loaded a class only when it was used rather than when it was referenced,
ask your question in the tomcat-user mailing ! !!!
Maybe you are looking for
-
User-Exit for document changes (status)
Hi! I'm looking for an user-exit where I can check if the status of the document has been changed. Therefore I found the exit "EXIT_SAPLCV110_004" with the include "ZXCV110U04" which is triggered when a document (transaction CV02N) is saved. The prob
-
Error comes while adding a ADF BC/JSP portlet
Hello all, I built a portlet using ADF BC & JSP,the Provider's Test Page showed successfully. 1)I created an empty project; 2)I created an Business Component from Tables; 3)I created a portlet using Oracle PDK portlet wizard--in the same project whic
-
What are the basic steps for creating a content repository?
I am trying to create a document store on a file system (fsdb) that will hold files that are ftp's to that location. Is this possible using KM? If so, what are the basic steps for creating a file system repository and using it through KM? I have foun
-
Using a digital signature-base method to get tcUtilityFactory
In OIM API usage guide it is sais that: "The entity using the APIs must maintain security of the private key for the signature. The private key is the basis for establishing trust between the two systems. Oracle Identity Manager must also know what c
-
Install & configuring EBS Adapter for ECM
Hi All, I am trying to setup IPM/ECm 11g and in the process i am configuring the EBS Adapter. Following the documentation step by step. As per the document it says that EBS adapter is already installed for 11g and we just need to configure. I have ex