samart mateo

Ranch Hand
+ Follow
since Feb 06, 2006
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 samart mateo

Yes, realised that already..thank you.
But, can anybody advise me how to send object to another page?
15 years ago
JSP
Hello everyone,

can anybody tell me how to pass an object to another servlet or JSP page?
I have a list of groups such as:

CTRM Aero Composites
-- Finance
-- Program B1
-- Program B2
-- Strategic Development
---- Operation Analysis
CTRM AU
-- Finance

Each of these groups are actually a link that could open up another page, sending with it the object of each group.

I tried doing this:


but the session.setAttribute was not initiated upon on click action.

Can someone assist me on this?

Thank you.
15 years ago
JSP
Hi guys,
thank you so much for your advices...now i know how to handle exceptions in servlet...what i did was



dat'll be just fine
15 years ago

but your mentioning only SQLException insteadof you put Exception



This doesnt really matter, even if i code every single Exceptions to be thrown, it still give the same error. I think it should have something to do with missing some other declaration...
15 years ago
if i removed the exception, it will return error such as below:

Error(34,43): unreported exception: class java.lang.ClassNotFoundException; must be caught or declared to be thrown

Error(34,43): unreported exception: class java.lang.InstantiationException; must be caught or declared to be thrown

Error(34,43): unreported exception: class java.lang.IllegalAccessException; must be caught or declared to be thrown



It blows my mind as to what i should do exactly...huhu
15 years ago
Hi everyone, I'm relatively new to Servlet...need some favor in getting my first servlet going thru...


ok, below's part of my servlet coding:



My UserService class would throws these exceptions:

ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException.

Unfortunately, when i tried building the class, it gave me this errors:

Error(15,17): method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class riskmanagement.user.LoginCheck cannot override method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class javax.servlet.http.HttpServlet, overridden method does not throw class java.lang.ClassNotFoundException.



"Error(15,17): method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class riskmanagement.user.LoginCheck cannot override method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class javax.servlet.http.HttpServlet, overridden method does not throw class java.lang.InstantiationException"



"Error(15,17): method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class riskmanagement.user.LoginCheck cannot override method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class javax.servlet.http.HttpServlet, overridden method does not throw class java.lang.IllegalAccessException"



"Error(15,17): method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class riskmanagement.user.LoginCheck cannot override method doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in class javax.servlet.http.HttpServlet, overridden method does not throw class java.sql.SQLException"




Can someone please help me?? how to solve this and get my servlet running...

Thank you very much for your help!!
15 years ago

Originally posted by Ilja Preuss:
I remember a discussion on the Ranch some months ago about a database structure for a tree that allowed a whole subtree to be selected (or deleted) with the use of a single SQL statement. If you are interested, we could try to exhume it...



This would be very helpful!! Pls do..Thank you!
Hi there,

I'm writing my back-end programming using Data Access Object structure.
I need some opinion on which structure do use if I have a tree data structure and I need to delete one parent together with all its children that cost the cheapest with the database connection and reply time.

a) Find all children (and grandchilren) of the parents and put in a stack. Delete the parent one by one as you find its children. All these are done in one function with the database connection is open.

b) Find all children of the parents (and grandchilren) using two stacks (so that you can make sure there's no repetition of searches of parents), send the stack to the delete function. Delete from database. Connection is opened everytime you try to find the children of a parent and closed before you moved on to another.

I can visualised my functions using diagram but I dont know if you can paste a picture in this. If anybody knows how to paste a picture, kindly let me know.

Thank you in advance for your guys' opinions and helps!!

Originally posted by Satou kurinosuke:
You could use the onClick event to store the time the link was clicked and increase a "click counter" up to 2.
Comparing the link was clicked the first time, with the time the link was clicked a second time. Wouldn't that be possible ?
Not sure... And if you had to do this for all links, that sounds like a pain.



emmmm, what i meant earlier was, i would like to prevent having to use the javascript's location.href...btw, click counter sounds quite interesting. could u give me some example?

TQ
helo, from what i know, a href is activated with one mouse click only. Is there any way that the a href is only activated with double click? I'm trying to prevent having to use the javascript as the link is quite complicated to explain here.

please help me. Thank you very very much
sorry. nway i'm using the JFreeWebLineChart that could be retrieve from
http://www.javaresources.biz/line.jsp
helo,
i'm doing a graph in jsp. i had succeeded to display the graph with data from the db. but some how, when i enlarge my graph size (width), the empty space on the right hand side of the picture(graph) also increases. i'd like to reduce the empty space. could someone show me which code should i alter? i tried some but it didnt work out. here's my line of codes..

------------------------------------------------------------------------

<%@ page import = "net.comrom.chart.*" %>
<%@ page import = "net.comrom.chart.gc.*" %>

String encode="jpeg";
//String uri=request.getRequestURI();
//String myurl="http://"+request.getHeader("Host")+uri.substring(0,uri.length()-12); //12 ist the length of my page name


response.setContentType("image/jpeg");
response.setDateHeader ("Expires",0);
// get output stream
java.io.OutputStream outb=response.getOutputStream();

// size of the chart image
int w=1200;
int h=600;

// data (looping)--------------
double[] d1= new double [noR.size()];

for (int i=0; i<noR.size(); i++){
%><%
String amik = (String)noR.elementAt(i);
double amik1 = Double.parseDouble(amik);
%><%
d1[i] = amik1; }

//----------------------------------------------------
LineDataSerie data1= new LineDataSerie(d1,new LineStyle(1f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_DOTS));
data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);
data1.valueColor=GraphicsProvider.getColor(ChartColor.BLUE);
//data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);

// create title
Title title=new Title("WIP for <"+pjkID+"> on <"+tarikh+">");
title.color=GraphicsProvider.getColor(ChartColor.MAGENTA);

// create axis
Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());
Axis YAxis=new Axis(Axis.VERTICAL,new Scale());
XAxis.tickAtBase=true; // draw also first tick
XAxis.ceroAxis=Axis.CEROAXIS_NO;
YAxis.ceroAxis=Axis.CEROAXIS_NO;
YAxis.scale.min=0;
YAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLUE); //warna legend paksi y
YAxis.scaleTickInterval=20;//skala utk paksi y
XAxis.scaleTickInterval=1;
XAxis.bigTickInterval=1;
XAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLUE); //warna legend paksi y

//String[] lbls={"1995","1996a","1997","1998","1999","2000","2001"};
// label paksi-x (from db-vector)
String[] lbls = new String [stationNameR.size()];

for (int j=0; j<stationNameR.size(); j++){

String test = (String)stationNameR.elementAt(j);
lbls[j] = test;
}

//String[] lbls = new String [pjkIDR.size()];
//pjkIDR.copyInto(String [] lbls);
//----------------------------------------

XAxis.tickLabels=lbls;
XAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
YAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
YAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL);
XAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL);
XAxis.axisFrame=true;
YAxis.axisFrame=true;

HAxisLabel XLabel= new HAxisLabel("Workcenter",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12));
VAxisLabel YLabel= new VAxisLabel("No of panels",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12));

// plotter
LinePlotter plot=new LinePlotter();

// create chart
Chart chart=new Chart(title,plot,XAxis,YAxis);
chart.XLabel=XLabel;
chart.YLabel=YLabel;
chart.addSerie(data1);
chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.LAVENDER));
chart.setSize(w,h);
chart.saveToFile(outb,"jpeg");
outb.close();
//-----------------------------------------------------------------------

Thank you.
[ May 15, 2006: Message edited by: Bear Bibeault ]
ok, i found the problem already. it wasnt there
hihi, my mistake. thank you very very very 4 ur help.
17 years ago
JSP
could you correct me?
TQ
17 years ago
JSP
you must have an index file in your sites folder.
17 years ago
JSP