Cerberus 17 Junior Poster

It works fine for me. I think that it does't like the import statement (can't find the class).

See if the following works.

<html>
<body>
<%
      out.print("Hello World");
%>
</body>
</html>

I'm new to JSP too so if any experts can help feel free.:P

Cerberus 17 Junior Poster

Perhaps there is an issue with your web.xml file.

How are you outputting your Hello World program? E.g. using a class or sciptlet in the JSP page.

Cerberus 17 Junior Poster

Hi. Is it possible to use a resultset from a scriplet in a <c:forEach> loop?

E.g.

results = prepstatement.executeQuery();
request.setAttribute("results", results);
<c:forEach items="${results.rows}" var="row">
      row.fieldValue <br />
</c:forEach>

Thanks.

Cerberus 17 Junior Poster

Like Shawn says you could use Javascript which is available to most modern web browsers. There are probably lots of examples of Javascript games. Javascript could be used to manipulate your HTML document. For example, hiding or showing certain page elements depending on the games state.

Cerberus 17 Junior Poster

Solved:

I just accessed it in the same way i would access elements submitted by a form (i.e. by the name e.g. ${param.pageid})

:$

Cerberus 17 Junior Poster

Hi all. How do you get values from an appended url string using JSTL?

For example:

redirect.jsp?pageid=23

-how would i get that value?

Thanks.

Cerberus 17 Junior Poster

Hi, i think you need to put them in the WEB-INF folder of your application and then shutdown and restart Tomcat.

Edit: Sorry i think the packages need to go into the WEB-INF - classes folder.

Cerberus 17 Junior Poster

If the new class uses some of the methods in the Customer class and is a type of customer then i would say extend/inherit the Customer class.

Best practice would probably be to identify common functionality in the design and create a class from which all relevant classes can inherit.

Cerberus 17 Junior Poster

Thats true. I didn't look at the order of the numbers:$

Cerberus 17 Junior Poster

From the little i know of the subject, Adobe AIR allows you to use web based technologies for desktop applications and i would guess Flash would be included. Flash uses ActionScript 3 which is object oriented and i believe to be very powerfull. So as a guess i would say that it is very possible.

Cerberus 17 Junior Poster

I would use an array of ints. Then loop through the length of the array. Then the nested loop output the numbers from the end of the array back to the beginning using the first loop as the counter to denote how many elements need printing.

Cerberus 17 Junior Poster

Sometimes applications require the use of system libraries and tools. Sometimes files may need to be copied to specific folders on the client maching. Another reason may be to ensure that certain software is present (e.g. the latest Java VM). Not all programs require this though. In java you can make a Jar file (a zipped file) executable with no installation at all.

Another reason you may want to install an application is to add desktop and task bar short cuts to make it easy to launch the application. I'm sure there a lots of other reasons for installation.

Cerberus 17 Junior Poster

That's a really good example. Thank you.

Cerberus 17 Junior Poster

Hi. I was wondering if there was a 'best practice' for formatting an html form. I assume that you are not supposed to use tables for this.

Any ideas?

Thanks.

Cerberus 17 Junior Poster

Thanks you for the replies. I'll add title attributes.

Cerberus 17 Junior Poster

Ok thankyou. Standalone working on XP would be most suitable. I've got old computers that run older browsers but it's a lot of hassel booting them up to test on.

Cerberus 17 Junior Poster

I have a navigation system with rollover effects using css. all effects are in the same gif image and depending on the state (mouse over, selected, mouse out) a different section of the image is shown.

Because the image is only referred to in the css file and a reference made to the class for the style rules in the <a> tag in the html script i was wondering how i can implement alternative text for each link.

Any suggestions?

Cerberus 17 Junior Poster

High, i've been looking on the MS website for old versions of Internet Explorer but can't find any downloads. I want to test a site to make sure it doesn't break in older browsers. If anyone knows where to find IE 5 on the MS site could you provide the link.

Thanks.

Cerberus 17 Junior Poster

What do you mean by visual program?

Cerberus 17 Junior Poster

Problem solved. I just used the onmousedown event handler in a span tag.

Cerberus 17 Junior Poster

Hi. Can anyone tell me how i can make a call to a javascript function when a user clicks on some plain text.

Thanks.

Cerberus 17 Junior Poster

I think the move is for tables to only be used for displaying data and CSS is used to organise the look and feel of the site. I think some older browsers still don't support (or not to standard) CSS, so this could be an issue with a site using CSS. I might be wrong about all of this though.

As for tutorials http://www.w3schools.com/css/default.asp the W3C tutorials is always a good starting point. But i think the best way to learn is just to practice.

Good luck.

Cerberus 17 Junior Poster

Thanks for the replies. I check out both options.

Cerberus 17 Junior Poster

You can just turn of the php tags or echo the img tag

if ($cam == camelx)
{
   ?>
      <img src="maledromidary.jpg" alt="" />
   <?php
}
elseif ($cam == camely)
    echo "<img src='malebactrian2.jpg' alt='' />";
?>
Cerberus 17 Junior Poster

Hi, can anyone point me in the right direction with incorporating rss feeds into web sites?

Thanks.

Cerberus 17 Junior Poster

I think UML is a good for documenting while you develop your software. Sometimes you don't know what you need to do until it's done and UML provides a set of models which, if used appropriately, document your system in an easily readable fashion.

Cerberus 17 Junior Poster

It works fine for me.

Do you try to open the file through the browser or clicking the file icon? I'm just trying think why dreamweaver would open.

Cerberus 17 Junior Poster

You could just style the tr, td and th tags

tr{
    background: white;
}

etc

Cerberus 17 Junior Poster

Thanks, i think i was just being a bit stupid and calling the instatiate.php script thinking it was the other one.

Cerberus 17 Junior Poster

Ok, i can't seem to do it. Would you mind telling me what i'm doing wrong. I get an error in the third script.

<?php    //animal.inc

class Animal
{
    private $noise;
    
    function __construct($param)
    {
        $this->noise = $param;
    }
    
    function makeNoise()
    {
        return $this->noise;
    }
}

?>
<?php    //instantiate.php

    require('animal.inc');
    
    session_start();

    $dog = new Animal("Woof!");
    
    $_SESSION[obj] = $dog;
   
?>
<?php    //call.php

    require('animal.inc');
    
    session_start();

    echo " a dog goes woof";
    
    $dog = $_SESSION[obj];
    
    //error on next line
    //$noise = $dog->makeNoise();
?>
Cerberus 17 Junior Poster

How about a web based game. Could be based on sports, adventure, puzzel etc.

Cerberus 17 Junior Poster

Thanks, i tried this but had problems accessing the object. But i'll try again. I assume that session auto start is a PHP configuration to stop you have to type session_start.

Cerberus 17 Junior Poster

Thanks i will have to read up on that.

Cerberus 17 Junior Poster

Basically when a user successfully logs in i want to instantiate an object and load it with the users details. The class would have functions to manipulate the date etc. I would like to be able to access this object through all scripts on the site if its possible.

Thanks.

Cerberus 17 Junior Poster

Thanks for your reply.

I just wrote that example quickly. I fully appreciate most OO concepts like access control etc. What i really want to do is load a class with data from a database and be able to access it throughout an entire web application. I was just wondering if this was possible some how.

Cerberus 17 Junior Poster

I've just started looking at OO PHP and was wondering how you would access an object in a script other than the one that instantiated it.

For example:

<?php // file: animal.php

Class Animal
{
      $name;
      $noise;

      function _construct($nm, $no)
      {
            $this->name = $nm;
            $this->noise = $no;
      }
      
      function noise()
      {
            return $this->$noise;
      }
}

$dog = new Animal("dog", "Woof!");

?>

How could i access the $dog object in a different script?

Any help would be much appreciated.

Cerberus 17 Junior Poster

Print on both sides of paper.

Cerberus 17 Junior Poster

Do you have a web server installed. I think that is a requirement inorder to serve the php pages.

I don't really have much knowledge on this subject btw.

Cerberus 17 Junior Poster

It just means that because of the 'public' keyword the filename must match the classname.

Cerberus 17 Junior Poster

This should work on Windows

public class LoadURL
{
    private String url = "www.yahoo.com";
    
    public LoadURL(){
        
        try{        
                Runtime.getRuntime().exec
                    ("rundll32 url.dll, FileProtocolHandler " + url);    
        }
        catch(Exception e){    }
    }
    
    public static void main(String[] args){
        LoadURL load = new LoadURL();
    }
}
Cerberus 17 Junior Poster

I'm a fan of JCreator (what is used in many AP Compsci classes).

Me too, the light edition. Code completion is really a hinderance id you touch type.

Cerberus 17 Junior Poster

Thanks guys, both of those methods should be able to acieve what i need.

Cerberus 17 Junior Poster

I couldn't find anywhere to ask this question and i'm working with PHP so i thought i would ask it here.

What would be the SQL statement to modify a database field from 'YYYY-MM-MM' to 'DD-MM-YYYY'.

Thanks,

Cerberus 17 Junior Poster

I'll give you a simple example..

Imagine a class:

public class Animal{
   int legs;
   bool tail;
   public Animal(int legs, bool tail){
         this.legs = legs;
         this.tail = tail;
   }
   public void noise(){
      System.out.println("GROWL!");
   }
}

Now we can inherit an 'Animal' and 'override' its noise method.

public class Dog extends Animal{
   public void noise(){
      System.out.println("WOOF"!);
   }
}

Dog inherits all the functionality of Animal and customises the noise method. This is approaching another subject (Polymorphism).

Cerberus 17 Junior Poster

Do you have any parameters in the CDArtist classes contructor?

E.g.

public CDArtist(String artistname)
Cerberus 17 Junior Poster

I pulled out this object oriented tutorial that you might find quite good.

http://sepwww.stanford.edu/sep/josman/oop/oop1.htm

peter_budo commented: I do not fancy design of that site, but that idea of introducing OOP is good +7
no1zson commented: always trys to help +1
Cerberus 17 Junior Poster

Notepad++ has syntax highlighting for a lot of different languages.

Cerberus 17 Junior Poster

I think that the Actor class isn't available to the compiler.

The bolded line is defining that the class has an 'Artist' as a member. Just the same as you might have a class 'shape' that has an Integer variable 'sides' (int sides). The Artist is a user defined class.

Cerberus 17 Junior Poster

TheGathering,
Compactdisk would be my vehicle, and Cdartist would be a car or truck.

The Compactdisk class is really the specification for a car (or Cd no artist) and Cdartist a specification of a truck (cd with an artist).

The car or truck is the object that you instantiate e.g.

Compactdisk cd = new Compactdisk();
Cerberus 17 Junior Poster

Don't you have to pass the db connection variable in?

mysql_select_db("$db_name", [B]$dbconnect[/B]);

$result=mysql_query($sql, [B]$dbconnect)[/B];