~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Javascript can't spawn processes and it's a part of the browser security model; you can't do anything about it. Maybe VBScript might have something in store for you, but then again, your application won't work for non-windows users. Your best bet would be to set the appropriate mime type (content type) of the response and hope for the best.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> i should get a prise.

Good idea; we are already in the process of getting hold of a unique spell / grammar checker which would automatically rectify spelling / punctuation mistakes in posts. ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Phew! Next time make sure you attach your code instead of dumping the entire 1.6K line thing on the message boards.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> but still need to find out how

Find out how to preload images? Google has a lot of helpful links to get you started. If you still are facing issues, let us know.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

According to the HTML 4.01 specification:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Plus NAME attribute is deprecated for *non-form* elements; use ID instead. And a better way to access images would be document.images["imageId"]. Also, are you preloading the images?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What do you mean by 'open PDF' files using Javascript? You need the appropriate softwares for opening the respective files e.g. Acrobat reader for PDF files. The maximum you can do is make the browser open up a prompt box which would give you the option of either saving the file to your local system or opening it with a program of your choice and this can be done using plain HTML; no javascript required. Browser embedded Javascript is as such not capable of *reading* files.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Your question would be more pertinent in the SIFR forums than here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just rinse and repeat.

<html>
<body>
<div 
style="border-color:#000000; background-color:#000000; height:100px; width:100px; position:absolute; top:0px; left:50px;
z-index:9" onclick='window.location="http://www.yahoo.com/";'>
</div>
<div 
style="border-color:#FFF; background-color:#FFF; height:30px; width:30px; position:absolute; top:50px; left:100px; z-index:10" onclick='window.location="http://www.google.com/";'>
</div>
</body>
</html>

Plus these questions are more of CSS than of Javascript. Any more queries along the same lines should be directed to the CSS forums.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to toggle the rendering and not visibility. Even invisible elements takes up space on the page. Use the "display" property to create invisible elements that do not take up space.

<div id="testDiv" style="display: none;">Content</div>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Flash all the way.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Ok so here is the code I am using and all I am getting is a blank page.

A few things:

- window.location is a host object (browser object); what you probably need to do here is window.location.href = 'url' . Even though the former works, it's an incorrect way of specifying the URI.

- Specifying window.location = 'www.google.com' will make the browser search for a file named 'www.google.com' in the location where you page is located. What you need is window.location.href = 'http://www.google.com/';

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There can be a host of problems / reasons causing that message to come up. Is the applet working in standalone mode? Which version of Java are you using? What is the directory structure of your application (as in the placement of JSP / class files)? What does the Java console show? Can you run other Java applets embedded in web pages of other sites? Have you got the latest plug in installed?

Maybe this thread will give you some leads.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Use MySQL Connector J, a type 4 / pure JDBC compliant driver. Make sure you add this driver to your runtime dependency and you are good to go.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I have tried my level best to complete the project within 2 months but I am not able to do
> that.
Maybe you looked in the wrong places; the internet is choke full of resources which can help you complete almost every school level project. You just need to google for 'jsp tutorial' or 'jsp samples' and along those lines and you would have enough on your hands to keep you busy reading for weeks to come.

> If anyone can solve my problem of combobox then also it will be ok. request.getParameter("nameOfYourCombo"); or request.getParameterValues("nameOfYourCombo") if you are allowing multiple selection.

It is the very basic concept of Servlet / JSP programming. Read this.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Look closely at the code you have written. The tag <jsp:param> doesn't have a body and hence should be written as one. Leaving them open is what is causing the problems here. It should be: (notice the slashes at the end of the param tag)

<jsp:params>
<jsp:param name="textcolor" value="#FFFFFF" />
<jsp:param name="text" value="page name" />
<jsp:param name="color" value="#808000" />
<jsp:param name="hovercolor" value="#FFFFFF" />
<jsp:param name="effect" value="glow" />
<jsp:param name="url" valuetype="ref" value="p1.jsp" />
</jsp:params>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A document describing the common compile time / runtime errors and ways to resolve them; beginners might find it to be useful.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> If you can't help, why don't you just shut up. you are not any helpful

Insulting forum regulars / contributors is a sure shot way of driving away all help you could have got. Please refrain from such activities.

As far as your problem is concerned, you still haven't shown an indication of integrating the changes suggested in my previous post. Plus I see a hanging 'e' in your catch block which is probably the cause of your problem. This is a pretty basic thing which should have been easy to pick up; maybe you need to go back to the basics of Java programming and dive into J2EE once you are confident of tackling the Java related issues. A document which aids the beginners in finding the reason for some common compile and runtime errors can be found here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> yeah sometimes i do say things like "i agree" but hey, thats how a conversation works

Maybe in the Geek's Lounge, yes, but definitely not for Tech related threads. IMO such monosyllables when used in excess tend to dilute the usefulness of the thread in consideration. If you wholeheartedly agree with someone, there is always the "Add to XXX's reputation" link...

Nick Evan commented: I wholeheartedly agree +4
Ancient Dragon commented: And so do I :) +28
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good question; moved to Java forum.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

No matter what kind of tutorials you read, learning from a good book is almost always irreplaceable. For JSP/Servlets, Head First Servlets and JSP is a good choice IMO.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The proper way to go about the task would have been to use JSTL or JSF instead of scriptlets. The official J2EE tutorial would be a good starting point. Plus what you posted was far from useful; you need to post the entire relevant code instead of just the line which is flagging an error.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This happens almost always due to Javascript errors and the Javascript on that page looks all messed up. Remember that IE is more forgiving and will automatically make up for your mistakes; Firefox won't. Your best bet would be to get your generated HTML validated, look for any glaring markup errors and if it still doesn't work, look at the 'Error Console' of Firefox to see if it really is your Javascript which is blowing up.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Start off with the Sun J2EE tutorials which cover almost everything you need to complete this project along with a lot of sample code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

WTH has Santa got to do with 'Why this scientist believes in God' topic? Just because this thread has got a 'GOD' in it doesn't mean you go around resurrecting 3 month old threads just for the sake of starting an argument, and you Bennet, should have known that better than anyone else!

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> You can't use getElementById to access elements added by a script.
Bosh. Please verify the facts before stating something.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Expires" content="0"> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function addElem(frm) {
      if(!frm)
        return;
      var d = document.createElement("DIV");
      d.id = "thirdDiv";
      d.innerHTML = "ThirdDiv";
      frm.appendChild(d);
    }
    
    function showDiv(frm) {
      if(!frm)
        return;
      var divs = document.getElementsByTagName("DIV");
      if(!divs)
        return;
      for(var i = 0, maxI = divs.length; i < maxI; ++i) {
        alert("DIV-" + (i + 1) + ": " + divs[i].id);
      }
    }
    
    function showNewDiv(frm) {
      if(!frm)
        return;
      var e = document.getElementById("thirdDiv");
      if(e) {
        alert("The ID of newly added DIV is: " + e.id);
      } else {
        alert("First click on the 'Add DIV' button");
      }
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <div id="firstDiv">FirstDiv</div>
    <br>
    <div id="secondDiv">SecondDiv</div>
    <br>
    <input type="button" value="Add DIV" onclick="addElem(this.form);">
    <br><br>
    <input type="button" value="Show all DIV's" onclick="showDiv(this.form);">
    <br><br>
    <input type="button" value="Show new DIV" onclick="showNewDiv(this.form);">
    <br>
  </form>
</body>
</html>

> amongst a host of other hopeless stabs in the dark!!
> Eternally grateful for any pointers, even if it's to say that i can't do it!

You can try using Closures which are inner functions which can be executed even outside the context of it's enclosing function. Something like:

// Here 'id' is the ID of the element passed to the showDetails function
xmlHttp.onreadystatechange = function(myId) {
  return function() {
    if(xmlHttp.readyState == 4 || xmlHttp.readyState …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There are many free / open source Javascript calendars out there. Just key in 'Javascript calendar' in Google and you would be a few steps away from getting one...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Please explain your problem in a better manner. If there is a server side processing involved when interacting with the HTML control, then yes, you can write whatever data is present in the form (plus something totally unrelated) to a text file which would be created on your server. When writing data to client side, your options are limited to the use of cookies.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

And replacing the onclick with onmouseover doesn't seem to work?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Heh, well that's news to me considering that even the site admin is as stumped as we are. ;-)

PS: Which anime is that Narue chan?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Posting the server side code is pointless since browser embedded Javascript works with / operates on the generated content. Plus with no definitions of functions like $find(), $object(), show() how do you expect us to help you out? Maybe this question would be more suited in the C# / ASP .NET forums considering considering that you are making use of custom components.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about showing us your effort or what you have achieved so far considering that we have a forum policy to not give out free code snippets? Also, please don't forget to read the forum rules and use code tags when posting code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Initially attach a styleclass to all the links on your page which will keep them hidden using the display / visibility CSS property.

Attach an event handler to the onload event listener which would make these links visible only after the entire page has loaded, by virtue of the onload handler not being fired till the entire page is loaded, and hence your animations, unless you are employing lazy loading.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

So what seems to be the problem? Which method are you currently using for shipping data to-and-fro? XML, JSON or plain text?

AFAIK, refreshing (updating) two DIV's shouldn't be very much different than refreshing a single DIV except for the way in which you request / handle the two new data chunks.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Some from my side:

• People who think that the only purpose moderators exist for is to clean their crap and help them out with each and every problem they post since it's *urgent*.

• The pointless topics in the Geek's Lounge which keep on screwing with *Gawd* over and over again.

• Thread hijacking.

• Using threads as chat rooms and posting the most trivial or off-topic things one can come up with.

• The fact that Dani has yet to update her avatar with her latest photo. ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I really don't mind them since I rarely hover on a thread to preview it. But on rare times when those things pop up, they are a little bit distracting; maybe because I am not used to them.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> "Why do they sterilize the needles for lethal injections?"

How many lethal injection sessions have you witnessed to state that with conviction?

> If electricity comes from electrons, does morality come from morons?

No, morals.

> "If Wile E. Coyote had enough money to buy all that ACME crap, why didn't he just buy
> dinner?"

Maybe he had expensive tastes?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Kami-sama

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The snippet as such doesn't seem to reek of any bugs so your best bet would be to look at the place where usrPass actually originates. Maybe it's the way you are accepting user input which is causing it to trim whitespaces.

One minor point; instead of passCh == ' ' , consider using Character.isWhitespace(passCh) since a space is not the only whitespace out there unless you are only checking for spaces.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> When I use ajax request, the content renders alright too but didn't show up on the page
> source

This is because the data is fetched asynchronously only after the response is committed to the client. So what you see is the original response rendered by the server; it won't show you the data dynamically fetched using Ajax. Instead of bringing in the entire DIV using an Ajax request, place an empty DIV with an ID of 'news-xxx' on your page and fetch it's contents using Ajax.

As far as viewing the current state of DOM is considered, a Firefox extension DOM Inspector might be of some help.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Where is the definition of the empty() function? It would be better if you posted a working copy of your code which we can directly use for testing your example rather than trying to figure out what seems to be wrong in the small snippet presented to us.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> How can I fill the content with ajax responseText ONLY after the page structure has been fully
> loaded?

Attach a listener (function) to the onload event handler which would load all the values using Ajax requests only after the page has been loaded.

> is it matters if the file is not an html? is .html file faster to render than .php?

This question doesn't make sense. The client always gets to see HTML; PHP / Servlets / ROR etc. are just server side constructs which add dynamic nature to the pages being presented to the client. If your pages don't have any dynamic content, go with HTML otherwise with any server side language of your choice.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

To get around these scope issues, you can either go with the messier and error prone global object solution or make use of the elegant concept of Closures.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Expires" content="0"> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function Klass(name) {
      this.name = name;
      this.handle = null;
      this.startTimer = function() {
        this.handle = setInterval(function(obj) {
          return(function() {
            alert(obj.name);
            });
          }(this), 5000);
      }
    var a = new Klass('hello');
    a.startTimer();
    </script>
</head>
<body>  
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It would be better if you posted the code as it is rather than posting it in bits and pieces. Here is a small working example which is almost like yours and is working fine:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Expires" content="0"> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function addUp() {
      var divElem = document.getElementById("myDiv");
      var liElem = divElem.getElementsByTagName("li")[0];
      var ipElem = liElem.getElementsByTagName("input")[0];
      alert(ipElem.value);
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <div id="myDiv">
      <li>
        <input type="hidden" value="10">
      </li>
      <li>
        <input type="hidden" value="20">
      </li>
      <li>
        <input type="hidden" value="30">
      </li>
      <li>
        <input type="hidden" value="40">
      </li>
    </div>
    <br><br>
    <input type="button" value="Calculate" onclick="addUp();">
  </form>
</body>
</html>

It would be much more reasonable to just grab hold of the DIV element and then get all the INPUT elements or directly get all the INPUT elements instead of adopting the round about way of grabbing hold of LI's.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Expires" content="0"> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function addUp() {
      var total = 0;
      var divElem = document.getElementById("myDiv");
      if(!divElem)
        return;
      var elems = divElem.getElementsByTagName("INPUT");
      if(!elems)
        return;
      for(var i = 0, max = elems.length; i < max; ++i) {
        var e = elems[i];
        if(!e)
          continue;
        var val = Number(e.value);
        if(!isNaN(val))
          total += val;
      }
      alert("Total: " + total);
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <div id="myDiv">
      <li>
        <input …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You already have been given a solution; start reading some tutorials and post your latest attempt with the changes incorporated.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You are welcome. :-)

BTW, if your question is answered, please mark the thread as solved by clicking on the link 'Mark As Solved' so that it becomes easy for others who use the search feature of this forum to find solution to their problems.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> my project uses JSF.

JSF projects require a configuration file which goes by the name of faces-config.xml along with an entry of FacesServlet in the web.xml which does the actual processing of the JSF pages. You need to take care of these things when deploying a JSF app; but considering you are getting a 404, it's one of the two things jwenting has stated in the previous post.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You are doing a getElementById() for "I1" but there is no element which goes by the ID "I1"; you only have an IFRAME with a name attribute of "I1". IE is infamous for allowing such things to slip by. If a call to getElementById() returns null , it looks for an element with the same name and if found; uses that. I am pretty sure your code would have failed even in Opera or any decent browser out there.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You seem to be in serious need of some good Javascript tutorials.

First of all, Javascript is case sensitive, hence selectedindex is not the same as selectedIndex . Also, the values of form controls are always of type string, so checking a textbox value for 0 seems pointless enough. It should be txtInput.value.length == 0 .

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The best, safest and the most appropriate solution in this case would be to implement the functionality in the server side language of your choice.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Forward won't work given that the requested servlet is looked for in the given ServletContext. sendRedirect doesn't preserve the original request since it's a new request altogether which the client is making -- sendRedirect is basically an indication to the client to request for the given URI.