peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

For what sort of database is that zip file? Is that Derby or MySQL? If it is Derby you need to tell me how to import it and if it is MySQL then you didn't export it correctly...
The way to export from MySQL was something like this if I remember it:

  1. Open Command Prompt
  2. Got to top level of the hard disk C:\
  3. Type following command
    mysqldump -u YOUR_USERNAME DATABASE_NAME>FILE_NAME.sql -p

Replace sections in capital with your data and hit ENTER after "-p", where you will be asked for the password to your database. After that file with your given name and "sql" extension will be created on current directory level. So if you moved to the top as I told you it will be directly under root "C:\"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

On form validation can be done with JavaScript or AJAX. However after submit you do not want to send the page to a JSP for further processing, but you want to send it to servlet. Have look on the second post in this thread

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

since it is going to be a standalone non-web based application... why are you considering using html and applets?

Presumably because he is another drag&drop user of Dreamweaver...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

OK, I downloaded files, but first I will have to re-install NetBeans as I have the simplest package for Java coding and Mobility Pack

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I did not pay attention to first question, because of missing code tags therefore the Arrays.sort() is not best solution. I would recommend to get price and items in two dimensional array and use sorting algorithm like bubble sort on the price part of the array to get things in desired order

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

i tried using

import java.util.Arrays;

so as to use the method Arrays.sort(); but it only shows the highest instead, i would like the 2 lowest value plaease.

As it says in API "Sorts the specified array of doubles into ascending numerical order." that mean first two values in array are the lowest. If you look at the end you will obviously get the largest number

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes you can attach compressed copy (in ZIP) of your project.
And it would be possible to have one servlet handling all, but I would advice against it (Java file with hundreds lines doesn't look pretty either ) and recommend splitting on more servlets to handle similar requests

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Arrays class with its sort() methods is all you need

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Thread from JSP been moved to JavaScript section and merged with the one you created in JavaScript section.

brr - if somebody in the future tell you in wrong forum this does not mean you have to go there and create another post there. By doing so you breaching forum rule Keep It Organized - forum flooding. Just click on "Flag Bad Post" and type short message "Please move to JavaScript section" and moderators will take care of it as soon they seen it.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Am I correct to say you using GET method instead of POST method?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Now here is crucial question: "Do you want to submit only average project and forget about it or you want to get best out of your project and learn something?"
If

  1. answer is I want average project and forget about it, then continue as you started. Unfortunately I do not see many members want to help with such lousy coding...
  2. answer is I want to submit best project and learn in same time, then you will take this design to Database Design section and seek advice on current state of your DB design as there are serious flows in it. For example, aren't they supposed to be same?
    CREATE TABLE markedevent
    (
     userid   int(4)  NOT NULL ,
     eventid      int(4)  NOT NULL,
      PRIMARY KEY ( userid)
    );
    
    
    CREATE TABLE  Event
    (
      Eventid     int(4)  NOT NULL  AUTO_INCREMENT,
      Description   varchar (255)  NOT NULL,
      Publish       varchar(20)   NOT NULL,
      Questionid   int(4)    NOT NULL,
      Targetgroup   varchar(70)   NOT NULL,
       Anonymous  varchar(15)   NOT NULL,
       PRIMARY KEY (  Eventid )
    );
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Just few days ago some suggestions been made in this post http://www.daniweb.com/forums/thread136641.html. Please search the forum many questions are already answered...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@hny_lyn

  1. Read the rules, no request for homework solutions to be send over by email or PM
  2. "i need the answer as soon as possible!!" is rude thing to say, we will help when we want, it doesn't matter to us that when you need to submit this home work
  3. a code that has exception attached to main method is one of the worst things and we do not like to see it

if you want it in JFrame then i've done it. Let me know if you still need it.

If you think you helping him, you are mistaken. By giving the code, hny_lyn will learn nothing. Copy & paste is not a solution when you learning

Ezzaral commented: Agree with all of this. +10
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Can you get me full table descriptions with indication of primary keys? (Just table structure, not interested in data inside table)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What are the major views that admin and student get?
Like admin will see some of these options

  • add
  • delete
  • modify

I want to know what exactly is available to them and in what kind of form (links, buttons etc)?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

HOw to get random number between 0 -35

Random rand = new Random();
int num = rand.nextInt(35);
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

For that you choose very bad example as I can do it in least two ways and it will have nothing to do with JSP scriplets

  • Each button in its own form where button click will trigger different action
  • Two images of buttons working as links, once you click on one of them you go to different page
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you provide more in detail description of your problem/project then "in my jsp project there are nearly 35 jsp pages" and explain how you got to that conclusion you may actually get some precious suggestions...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

It is YOUR school work/work project so deal with it if you ignore advice from others with more experiences!

stephen84s commented: Now is this a rare sign of frustration from the Tiger ;-) +2
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

String array of A-Z characters and integers 0-9, which makes 36 elements (26 letters plus 10 numbers). Create random number generator between 0-35 with "i" loop to get password of certain length. Wouldn't be that the simplest solution?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

In your case there possibility of more then one answer

  1. 3 or 4 tables that will put together questionar
  2. combination of database and coding coordination. Database can hold question with possible answer/s but you can also have field for page/coding action "create text field/area", "sort" that will trigger certain actions on your page
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes, this one "The Java EE 5 Tutorial"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

save your file with the ext. of .css
if you give the css file name style.css

when you call the css style sheet in you html page give the code

<link rel="stylesheet" href="style.css" />

Man when do you start reading posts as whole, not just section you want!
Question asked was how do I save my external CSS in notepad, not how do I call my CSS in web site document!

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You have problem with yours prepareStatement.
Have look at this tutorial it will explain it to you. After that if you still have problems just post bellow.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Pl. help in handling button events in JSP like calling a servlet on Button click or executing java code.

What to do if more than 1 buttons are there??Plz help in that case..!

Description of the problem in both cases is inaccurate. Please provide better description and supporting examples of coding

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@ r3dbranch & ThatsNotJack! this thread is over year old!

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Why to write to file if you can handle click count nicer on server side?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

LOL, somebody is trying for clever. How about creating file through command line? Faster then extra click in dialogue menus. I can do that...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No, the new file which you create is outside the JAR file

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No you cannot update text file inside the JAR. You can only created one with help of jar and then you can update it. However you facing main problem, what if user delete that file? JAR will create new one, but then you not getting accurate count

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

It will never work as you directly inserted Java element into pure HTML without telling HTML you about to use something related to Java. You better start learning for example here, The Java EE 5 Tutorial

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Rules of html

<a href="../index.jsp">index.jsp</a>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you want to learn JSP you better to get book like this one Beginning JSP, JSF and Tomcat Web Development, From Novice to Professional

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

That code just look awful ! ! !
So much nicer if data would be retrieved from DB in servlet, stored in the bean and with session passed to JSP where everything would be displayed with few lines of necessary scriplet

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Also, you definately should not be doing this stuff as scriptlets in a JSP. This is a maintenance nightmare.

No point to repeat that, this guy completely ignore that for last two weeks from me. Another hopeless case to bang on...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Change "Save as type" from "Text Documents (*.txt)" to "All Files" and in "File Name" type name with css file extention like styles.css. Always work for me...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Ehmm, what exactly did you downloaded?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Download

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What version of Tomcat server you have?
Why don't you use MySQL database which is free to use, better then MS Access in my opinion?
Why do you use j2sdkee1.2.1 when there are newer version of Java?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Try this one, Horizontal CSS Dropdown Menus .
What do you think of it?

Grantmitch1 commented: :) +1
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

JavaBeans components, or beans, are reusable software components that follow simple naming and design conventions so they present a standard interface to other beans, programs, and tools.

Simply put bean is just storage class something like this one, which does use setter and getter methods for attributes to be stored or retrieved

package bean;

public class MyBean
{
	private String username;
	private String password;
	
	public MyBean() {}
	
	public void setUsername(String str)
	{
		username = str;
	}
	
	public String getUsername() { return username;}
	
	public void setPassword(String str)
	{
		password = str;
	}
	
	public String getPassword() { return password;}
}

and the above approaches will help you retrieve or set data for your bean

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Question: What is purpose of this forum?
A) People asking questions, expecting quick answers and just flooding it with post .
B) People asking questions and expecting quick answers.
C) People asking questions and actively searching answers.

Similar question been already answer already here just few hours back http://www.daniweb.com/forums/post653222-2.html

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If servlets are not mapped with use of web.xml you call it like this from the form for example

<form action="http://localhost:8080/PROJECT_NAME/servlet/SERVLET_NAME_NO_FILE_EXTENSION" method="POST">
YOUR FORM HERE
</form>

The web.xml mapping will look like this

<servlet>
       <servlet-name>SERVLET_NAME_YOU_WANT_TO_CALL_IT</servlet-name>
       <servlet-class>REAL_SERVLET_NAME_NO_FILE_EXTENSRION</servlet-class>
    </servlet>

    <servlet-mapping>
       <servlet-name>SERVLET_NAME_YOU_WANT_TO_CALL_IT</servlet-name>
       <url-pattern>/A_NAME.jsp</url-pattern>
    </servlet-mapping>

Example:
REAL_SERVLET_NAME_NO_FILE_EXTENSRION is FrontController
SERVLET_NAME_YOU_WANT_TO_CALL_IT I want to be Front
A_NAME.jsp I want to be front.jsp
to call my FrontController I will do following

<form action="front.jsp" method="POST">
FORM CODE HERE
</form>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes to get properties in JSP as follows

<%@ page language="java"%>

<jsp:useBean id="mybean" scope="application" class="Helloserv"/>
<jsp:getProperty name="mybean" property="username"/>
<jsp:getProperty name="mybean" property="password"/>

In my other post I marked place where you create session, that is basically where you store data in the bean and past it on the JSPs following after that

session.setAttribute( "mybean", mybean );
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

My bad, I forgot this possibility. It will be because I attempted only once, but on the end I did just quick Java code to sort it out... ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes, if the results from database confirm is is registered user and he/she is authorized then you should create bean. You can store username and password there, however storing unique user ID in bean would be better solution

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

He can only take away 17, when you give neg rep it takes away half of what you have for rep power. He can, however, give all 34.

Last time when I checked you gave and took same amount, maybe the change been implement while I was away last month

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You misunderstand the idea of JSP-servlet relation. Bellow is something you should do (I did not compile it so it may not be 100% correct)

Simple html login screen

<html>
<head>
<title>Ask for Names Example</titls>
</head>
<body bgcolor="LightSkyBlue">
<h3 align="center">Login event with use of the POST method</h3>
<form action="LoginEvent" method="post">
<p align="center">Username: <input type="text" site="20" name="username">
&nbsp;&nbsp;&nbsp;
Password: <input type="text" size="20" name="password"></p>
<p align="center"><input type="submit" value="Submit"></p>
</form>
</body>
</html>

Note: The form parameter action uses LoginEvent servlet that has been mapped through web.xml.

servlet to get data and connect to db

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FrontController extends HttpServlet
{
	Connection conn;
	Statement stmt;
	
	public void init() throws ServletException
	{
		try
		{
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		}
		catch (Exception ex)
		{
			System.out.println("Exception is : " + ex.toString() );
		}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
	{
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		boolean bValid = true;
		HttpSession session = request.getSession();
		
		if( (name.lenght() == 0) || (password.length() == ))
		{
			bValid = false;
		}
		
		if(bValid) // submited data are OK
		{
			try
			{
				conn = DriverManager.getConnection("jdbc:mysql://localhost/" 
														+ "database_name?user=your_username&password=your_password");
				stmt = conn.createStatement();
			}
			catch(SQLException ex)
			{
				System.out.println("SQLException : " + ex.getMessage() );
			}
			
			/**
			 * DO THE REST OF DATABASE REQUESTS
			 *
			 * DO NOT FORGET TO CLOSE CONNECTION
			 *
			 **/			
		}
		
		if(bValid)
		{
			// YOU MAY WANT TO CREATE SOME SESSIONS HERE
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/accept.jsp");
			dispatcher.forward(request, response);
		}
		else
		{
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/reject.jsp");
			dispatcher.forward(request, response);
		}
	}
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes, there are very simple solutions to this problem, but it would be very nice if bajanstar can clarify his intentions. Otherwise we wasting our time to provide numerous solutions to lousy specified requirements...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Reputation is "a way" everybody can see what members think of you and the answers you provide.

Gray rep - (not black) is from new members, if I'm correct below post count of 10 (correct me if I'm wrong)
Green rep - from these above 10 posts that agree/are happy with your respond. Their reputation power is different (according to member list top score goes to ancient dragon :) with currently 34 reputation point to give/take from any of us )
Orange rep - from these above 10 post that did not like your respond