Joyce Derzaph

Greenhorn
+ Follow
since Mar 18, 2004
Merit badge: grant badges
For More
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 Joyce Derzaph

I'm not sure if this belongs in this forum or another but the problem is in a servlet.
I'm trying to set a date and it keeps comming up null

currentDate = new Date();
dateSyntax = new SimpleDateFormat("s",Locale.getDefault());
dateSyntax.applyPattern("yyyy-MM-dd");
now = (long)System.currentTimeMillis();
currentDate.setTime(now);
clock = dateSyntax.format(currentDate);

currentDate.setTime(now) is where the problem is. now has a value.

Joyce
19 years ago
Doh! I found it last night. Thanks. I shouldn't program late at night.

Joyce
19 years ago
JSP
I'm having trouble passing attributes back and forth between a servlet and a jsp.
I set the attribute in the servlet then forward the request and response to a jsp. The attribute shows up in the servlet but comes up null in the jsp.
Here is the code sections:

---servlet---
session.setAttribute("trans",t); // t was initialized earlier
RequestDispatcher rd = req.getRequestDispatcher("/mainTill.jsp");
rd.forward(req,res);

---jsp---
<% double total = 0;
Transaction t;
t = (Transaction)request.getAttribute("trans");
%>
<%= t.toString() %>
If anyone has any ideas I'd appreciate it. This is driving me nuts!

Joyce
19 years ago
JSP
Tried that. Didn't make a difference. Thanks anyway though.

Joyce
19 years ago
JSP
Well, taht got rid of the errors. Now it just tells me the requested resource is not available.
Any ideas for that one?

Joyce
19 years ago
I'm having trouble running any servlets that I've made on Tomcat. I think it may be a class path problem but I'm not sure.
Its with simple post forms. When I hit the submint button this is what tomcat tells me:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.ClassCastException
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:416)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.

Yet everything complies fine outside of tomcat.

Any suggestions anyone! Would posting the stack trace help?
Thanks,

Joyce
19 years ago
This is something that should be simple but it just won't work for some reason. All I get is a blank page. This is the whole document. The page I'm
trying to include does exist. It just won't display it. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title></title>
</head>
<body text="#00ff66" bgcolor="#330033">
<jsp:include page="header.html" flush="true" />

</body>
</html>

Also, except for the name of the page and the lack of any text, this identical to another page I have that does work.
Any ideas?

Joyce
19 years ago
JSP
Thanks for the help everyone. This makes much more sense now.
Any ideas on why I cant' cast the object from peek() to a string even though that's what it was before it was added to the stack?
Probably something simple I can't see because I've been staring at it so long my eyes are square.
Ahh, the joys of debugging.
Joyce
20 years ago
I guess it might help if I post what I have so far.
public boolean checkExpression(String expr)
{
int size = expr.length();
SLLStack bracketStack = new SLLStack();
char char2;
for(int x=0; x<size; x++)
{
char char1 = expr.charAt(x);
switch(char1)
{
case '(': case '[': case '{': case ')': case ']': case '}':
{
bracketStack.push(char1);
break;
}
case '/':
{
if(exprStack.peek() == '*' || exprStack.peek() == '/')
{
bracketStack.push(exprStack.pop());
}
}
}
}
char char3 = bracketStack.pop();
if(char3 == '('||char3 == '{'||char3 == '[')
{
return false;
}
20 years ago
Ok, this is supposed to be an easy assignment. I think I'm making it more complicated than it has to be.
Using stacks, I have to determine whether an expression is well bracketed or not.
eg. 3*(5+9)/4 well bracketed
(4*[4+7)] not
If I could just use a linked list and match the brackets from each end I could do it but my mind doesn't want to do it from one end.
Any suggestions?
Joyce
20 years ago
I keep forgetting to say that we can't use BigInteger. That would make it too easy and we've being doing a lot of reinventing the wheel this semester. I think I've figured it out though. Now I just have to pad the list if one is smallen than the other.
Thanks for the help!
Joyce
20 years ago
Ok,take two linked lists. Each one has a series of numbers stored in it. Each node has up to three numbers. Eg. 123 456 78 This represents the integer 78,456,123. I have to add the lists as though they were integers. I thought about using a loop to run through each list and add the nodes one at a time but I don't know how to handle carrying over when the sum is greater than 999.
Basically, what I was thinking is something like this:
get first node from each list(strings)
convert to ints
add ints
convert to strings
put back into a list as a node
gwt next node
etc.
Joyce
20 years ago
That's not quite what I was looking for but thanks anyway. It has to take two linked lists and add them together as though they were integers.
Joyce
20 years ago
This is my first post to this site so I hope I've got it in the right catagory.
I have to create a class that uses a single linked list to store a large integer. The problem I have is that we have to have a method to add two of these integers together. I'm having trouble figuring out to do this.
Each node in the list has a three chacter string which is a section of the large integer.
Any one have any ideas?
20 years ago