Valarie Brandt

Greenhorn
+ Follow
since Oct 03, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Valarie Brandt

Hi all
I have a servlet called EmpSearchResultProj4 which sends info to the javabean called Proj4JavaBean then the info is forwarded to a jsp called Proj4SearchResults.
In the jsp page i need to use jsp syntax for getting an attribute and showing its contents
I get the basic form from my book
my question is what is property suppose to be?
<jsp roj4JavaBean id="queryEmployee" type="bean" scope="session"/>
<jsp:getProperty name="queryEmployee" property="">

thanks.
16 years ago
According to the specs for the project I have to use the static html page for the user to enter the information from there I am confused.
are servlet java bean going to be a separate file? I thought i was suppose to it in one page.
17 years ago
Hi-- I don't know if i have just been staring at this too long but I am so frusterated i could cry....

I have an html form the user selects the type of sear(last name, first name, dept etc) and in a text box the user types in what are looking for then the user submits the page..

I have a class called EmployeeAddressSearchResultsServlet which displays the requested information in a table

The search is done against an access database

I don't know how to get the search to send the information and put it into the table. I do know that i am supose to loop and have the information feed in and create the table.

The instructor said to do it with a servlet and a javabean...
can anybody point me in the right direction.

I have the basic structure of the pages
[code]

<html>
<head>
<title> Employee Address Book Search </title>
</head>
<body bgcolor = #33FFCC>
<h1 align = center> Search the Employee Address Book</h1>
<p>Employee Address Book:</p>
<p>To look an employee up by their last name </p>
<form action="/servlet/java146.project3.EmployeeAddressSearchResultsServlet" method="Get\">
<br /><input type="radio" name="empSearch" value="findListById">Employee Id
<br /><input type="radio" name="empSearch"value="findListByLastName">
Employee Last Name
<br /><input type="radio" name="empSearch"
value="findListByFirstName">Employee First Name
<br /><input type="radio" name="empSearch" value="findListByDept">Employee
Department Name
<br /><input type="text" name="search" SIZE="40" MAXLENGTH="40">
<br /><p align = center>
<input type = "submit" name = "submitButton" value = "Search">
<input type = "reset" name = "resetButton" value = "Reset">
/p>
<h4><a href =" ../index.html"> Back to Home Page</a></h4>
</form>
</body>
</html>

package java146.project3;

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

/**
* Description of the Class
*@author VBrandt
*@created November 24, 2004
*/
public class EmployeeAddressSearchResultsServlet extends HttpServlet
{
//Connection connects = null;
/**
* Description of the Method
*@exception ServletException Description of the Exception
*/
public void init() throws ServletException {}

/**
* Description of the Method
*@param req Description of the Parameter
*@param res Description of the Parameter
*@exception ServletException Description of the Exception
*@exception IOException Description of the Exception
*/
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.print("<html>");
out.print("<head>");
out.print("<title>Results Page</title>");
out.print("<h1 align = center>Search Results</h1>");
out.print("</head>");
out.print("<table border = 1 cellpadding = 2 align = center >");
out.print("<th>ID</th> <th>Last Name</th> <th>First
Name</th> <th>Department</th>");
out.print("<tr>");
out.print("<td> </td>");
out.print("<td> </td>");
out.print("<td> </td>");
out.print("<td> </td>");
out.print("</tr>");
out.print("</table>");
out.print("<p>");
out.print("<h4 align = center><a href =../index.html>
Back to Home Page</a>" +
"\t<a href =../EmpAddressPage.html> \t
Search again</h4></a>");
out.print("<BODY>");
out.print("</body>");
out.print("</html>");
}
}
17 years ago
hi all,

please help me on this---- I keep getting the error type expected on this line: <%! propManager.getProperty("projectDesc") %>
i have tried it with a semicolon after the paren and got the same message.

here is the rest of my code
17 years ago
JSP
I have to bring information into proj3info.jsp from a file called project3.properties I just am at a loss where to start

I know i need to to have an instance of my properties so.....
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%!
public void jspInit()
{
PropertiesManager propManager = new
PropertiesManager("/project3.properties");
}
%>

<html>
<head>
<title>JSP Project Information</title>
</head>
<BODY>
<h1>Project Information</h1>
<p>This page was generated by a jsp page.</p>
<table>
<tr>
<td>My name is: </td>
<td> this is where i need to bring in from propManager getName()</td>
</tr>
</BODY>
</HTML>
17 years ago
JSP
HI I hope I can get some help on this :
I have a class called protocol in which i specify the appearance and what each selection does and I have this class called :
public class Client
{
private boolean status = true;
private PrintWriter out = null;
private BufferedReader in = null;
private Socket assignSocket = null;
private String host;


public static void main(String[] args) throws IOException
{
Client cc = new Client();
cc.runClient(args);
}

private void runClient(String[] args) throws IOException
{
if (args.length == 0)
{
host = "localhost";
}
else
{
host = args[0];
}

try
{
assignSocket = new Socket("localhost", 4444);
out = new PrintWriter(assignSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader
(assignSocket.getInputStream()));
}
catch (UnknownHostException e)
{
System.err.println("Doesn't know about host: " + host);
e.printStackTrace();
return;

}
catch (IOException e)
{
System.err.println("Couldn't get I/O for the connection to: " +
host);
e.printStackTrace();
return;
}

BufferedReader stdIn = new BufferedReader(new InputStreamReader
(System.in));
String fromServer;
String fromUser = null;

while (true)
{
fromServer = in.readLine();
System.out.println(fromServer);
while (true)
{
fromServer = in.readLine();
if (fromServer == null)
{
System.out.println("fromServer was null");
break;
}

System.out.println(fromServer);

if (fromServer.equals("Bye"))
{
status = false;
break;
}
}
if (status == false)
{
break;
}

if (fromUser != null)
{
fromUser = stdIn.readLine();
out.println(fromUser);
}
}
out.close();
in.close();
stdIn.close();
assignSocket.close();
}
}
I think part of my problem is I can't break out of the loop but... i am not sure what i am doing wrong or omitting.
any suggestions would be great.

valarie
17 years ago
Oops I for got to tell you which might be helpful that i have variable in the class
private Counter counter;
private PropertiesManager propManager;
private Map tokenMap;
thanks
Val
17 years ago
I think I have the counter maybe??
but but
public TokenCount(PropertiesManager input)
{
tokenMap = new TreeMap();
propManager = input;
}

/**
* This method will check the map to see if the map contains the
* key(word), if it does contain the key then it will add one to the
* counter but if it does not contain the key then it will add the key
* to the map.
*@param token Description of the Parameter
*/
public void processToken(String token)
{
if (tokenMap.get(token))
{
// add one to counter
counter++;
}
else
{
token put(token, tokenMap);
I think my problem understanding what to do is here I don't
understand what the key and value are. Is the value the
token that is read in? Is the key where it is in the map?
}
}
17 years ago
that is a lot of help--
but the specs for the prjoect indicate that I have to use the counter class so --- I need to increment the counter for each unique token. I am just not sure how to increment in another class.

thanks
Valarie
17 years ago
Hi,

I am having trouble with the whole treemapping thing. I have a class called TokenCount which implements a class called Analyzer.

in the class there is a method called create a TreeMap to hold tokens
first it will check to see if the map contains the Key
if it does thsn it will add one to the Counter class
but if it doesn't
then it will add the token to the map.

I am unsure of how to add one to the counter and i am unsure of how to put it in the map.

this is what i have:
public class TokenCount implements Analyzer
{
private Counter counter;
private PropertiesManager propManager;
private Map tokenMap;

/**
need a map that sorts
* Basic constructor for TokenCount object. We set input to the
* PropManager which is an instance of the PropertiesManager.
*/
public TokenCount(PropertiesManager input)
{
tokenMap = new TreeMap;
propManager = input;
}
public void processToken(String token)
{
if((this.equals(token)))
{
// add one to counter
}
else
{
tokenMap.put();
}
any suggestions or hints pointers of where to look
I have a couple of books i have nbought on java and none of them had anything on maps/hashmaps/treemaps/
thanks
valarie
17 years ago
Hi,

I am having trouble with the whole treemapping thing. I have a class called TokenCount which implements a class called Analyzer.

in the class there is a method called create a TreeMap to hold tokens
first it will check to see if the map contains the Key
if it does thsn it will add one to the Counter class
but if it doesn't
then it will add the token to the map.

I am unsure of how to add one to the counter and i am unsure of how to put it in the map.

this is what i have:
public class TokenCount implements Analyzer
{
private Counter counter;
private PropertiesManager propManager;
private Map tokenMap;

/**
need a map that sorts
* Basic constructor for TokenCount object. We set input to the
* PropManager which is an instance of the PropertiesManager.
*/
public TokenCount(PropertiesManager input)
{
tokenMap = new TreeMap;
propManager = input;
}
public void processToken(String token)
{
if((this.equals(token)))
{
// add one to counter
}
else
{
tokenMap.put();
}
any suggestions or hints pointers of where to look
I have a couple of books i have nbought on java and none of them had anything on maps/hashmaps/treemaps/
thanks
valarie
[ October 01, 2004: Message edited by: Valarie Brandt ]
17 years ago
Hi all I am having a little problem.
I have a class called Student in that class there is a variable:
public final static char[] GRADES = {'A', 'B', 'C', 'D', 'F'};
I have another class called GradePoint Inside of that class I have a method:
public boolean validateGrades(char tempGrade)throws Exception
{
boolean valid = false;
for(int i = 0; i < GRADES.length; ++i)
{
if (tempGrade == GRADES.Student[i])
{
valid = true;
break;
}
}
return valid;
}
The problem I am having is I need to accept user input and the validate the input...but I can't figure out how to get my method in the GradePoint class to use the array from the Student Class.
PS this is the format the instructor wants us to use.
17 years ago
I don't understand what to code to access the methods that will bring in the information.
17 years ago
The assignment required that I instaniate a Lawn object in the top-level control method which is the process lawnMethod. hOw do I call the methods in the display method?
thanks
17 years ago
I would start by coding the gets and sets for the employees wage and age and then you could either do a nested if for the age and then an array to determine the correct taxes
if age<50
(do this array)
else if age=>50
(do this array
I know that is kind of a simplistic start but maybe it'll hlep to get the ball rolling for you
17 years ago