alona ariel

Ranch Hand
+ Follow
since Sep 09, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by alona ariel

I have another option to get the passenger that travel to london
I ask if it is a good way





I have a DB of passenger and I want to create a new DB of the passenger that travel to london
I want to ask if my Algorithm is good only

How can I change the pixel value to normall cell coordinate?

int xpos
int ypos

public void mouseClicked (MouseEvent me) {


xpos = me.getX();
ypos = me.getY();




}



public void paint(Graphics g)
{


g.drawString("("+xpos+","+ypos+")",xpos,ypos);
g.drawLine(xpos, ypos, x, y);

g.setColor(Color.blue);
g.drawString("("+xpos1+","+ypos1+")",xpos1,ypos1);
g.drawLine(xpos1, ypos1, x, y);




}
13 years ago
okey it is worked better now.
but what about if I want two or more vectors so I need to maintain the former parameters?
13 years ago
My programm is to dragged a vector and and calculate the vector length so I need constant parameter
13 years ago
I will to ask my question better

I try this code to get x,y paremeters, but I want constant parameter and not a parameters that change all the time
How can I do it

public void init()
{


addMouseMotionListener(this);
}

{
public void mouseMoved(MouseEvent me)

xpos = me.getX();
ypos = me.getY();

}
13 years ago
Is it possible to click the mouse in a coordinate, so it give the x,y horizontal with regard to the (0,0) point?
13 years ago
I want to send a compiled code project (that is written from eclipse) so it can work from c how can I do that?
14 years ago
I try to learn the session better, but my problem is why the KEY value is saved in the jsp, but isn't saved in the servlet?
How can I read the session session.setAttribute("KEY",i2); in a new servlet?
14 years ago
I write a classe with a session

HttpSession session = request.getSession(true);
session.setAttribute("KEY",i2);

Now when I write another classe when I used the code
session.getAttribute("KEY");
it get the value of the session.

but when I used the code

HttpSession session = request.getSession(true);
String name = (String) session.getAttribute("KEY");
The parameter name did not get the value of the session.
why it happened?
how I can improve the code so that the parameter name will get the sossion value?
14 years ago
This is a good way do ad a mouse lisener to a table?

public static void main(String args[]) {

JFrame frame = new JFrame("smsll project");
TableModel model = new ColorTableModel();
JTable table = new JTable(model);

TableColumn column = table.getColumnModel().getColumn(3);

table.add(new mouse());




how open a new window with using the mouse
14 years ago
This is a good way to add a mouse listener to a table
?
now how it can open a window?
14 years ago
How to open a new window when we double click on a row in JTable ?

please somebody can give me the code
14 years ago
I WILL TRY AGAIN TO WRITE MY CODE , HOPLY IT WILL BE MORE CLEARLY.

The jsp code is:

1..<%@ page language="java" contentType="text/html; charset=windows-1255"
2.. pageEncoding="windows-1255"%>
3..<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4..<html>
5..<head>
6..<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
7.. <title>Insert title here</title>
8--</head>
9--<body>
10--

welcome to our bank



11--<form action=TestUser3 METHOD="post">


12--<input type="radio" name="kaspomat" value="a1" CHECKED>

13--radio button 1
14--

15--

16--<input type="radio" name="kaspomat" value="a10" >

17--radio button 2
18--

19--

20--<input type="radio" name="kaspomat" value="a20" >

21--radio button 3
22--

23--

24--<input type="submit" VALUE="Submit" >

25--

26--


27--td> what your choise </td>


and the servlet is:

1.package alona;

2.import java.io.IOException;

3.import valueObjects.User;


4.* Servlet implementation class TestUser3

5.public class TestUser3 extends HttpServlet {
6.


7. private static final long serialVersionUID = 1L;
8. private Object user;



9. // TODO Auto-generated constructor stub



10. * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
11. public void doGet(HttpServletRequest request, HttpServletResponse response)throws javax.servlet.ServletException,
12. java.io.IOException {
13. // TODO Auto-generated method stub
14. // try {
15. // super.doGet(request, response);
16. // } catch (ServletException e) {
// TODO Auto-generated catch block
17. // e.printStackTrace();
18. // } catch (IOException e) {
// TODO Auto-generated catch block
19. // e.printStackTrace();
20. // doGet( request, response);
}
21.


22.// }

/**
23. * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
24. */
25. protected void doPost(HttpServletRequest request1, HttpServletResponse response1) throws ServletException, IOException {{
26. // TODO Auto-generated method stub

27. // try {
28. // super.doPost(request1, response1);
29. // } catch (ServletException e) {
// TODO Auto-generated catch block
30. // e.printStackTrace();
31. // catch (IOException e) {
// TODO Auto-generated catch block
32. // e.printStackTrace();
33. }

34. // TODO Auto-generated catch block







35. doPost1(request1, response1, null, null);

36. // TODO Auto-generated catch block

37. }






38.
void doPost1 (HttpServletRequest request1, HttpServletResponse response1,String username)throws
39.

ServletException,IOException {
40. String kaspomat1=(String)request1.getParameter("radios");




41.
42. try {
if((request1.getParameterValues("radios")) != null) {
43.
44. if(request1.getParameterValues("radios").equals("a1")) {

45. javax.servlet.RequestDispatcher rd = this.getServletContext().getRequestDispatcher
46. ("/indexa1.jsp");

47. rd.forward(request1, response1);



48. }

49. if(request1.getParameterValues("radios").equals("a10")) {
50. response1.sendRedirect("http://www.ynet.il");
51. }
52.
53. if(request1.getParameterValues("radios").equals("a20")) {

54. response1.sendRedirect("http://www.nrg.il");
55. }

56. }
else {
57. javax.servlet.RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/indexwrong.jsp");
58. rd.forward(request1, response1);

59. }
}
60. catch (Exception e) {
61. e.printStackTrace();
62. }
63.
64. }


65.}
14 years ago
I wrote programm using jsp , servlet that choose one value from the radio button and go to another page according to my choose.

my program is : jsp

<form action=TestUser3 METHOD="post">


<input type="radio" name="kaspomat" value="a1" CHECKED>

radio button 1




<input type="radio" name="kaspomat" value="a10" CHECKED>

radio button 2




<input type="radio" name="kaspomat" value="a20" CHECKED>

radio button 3




<input type="submit" VALUE="Submit" >






<td> what your choise </td>


and the servlet is:

@see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request1, HttpServletResponse response1) throws ServletException, IOException {{
// TODO Auto-generated method stub

// try {
// super.doPost(request1, response1);
// } catch (ServletException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
// catch (IOException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
}

// TODO Auto-generated catch block







doPost1(request1, response1, null, null);

// TODO Auto-generated catch block

}




public String[] Kaspomat(HttpServletRequest request1, HttpServletResponse response1,String kaspomat){
String[] kaspomat1=request1.getParameterValues("radios");
return kaspomat1;
}



void doPost1 (HttpServletRequest request1, HttpServletResponse response1, Object object,String kaspomat)throws ServletException,IOException {
Kaspomat(request1, response1,kaspomat);
try {
if((kaspomat) != null) {

if(kaspomat.equals("a1")) {

javax.servlet.RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/indexa1.jsp");
rd.forward(request1, response1);



}

if(kaspomat.equals("a10")) {
response1.sendRedirect("http://www.ynet.il");
}

if(kaspomat.equals("a20")) {

response1.sendRedirect("http://www.nrg.il");
}

}
else {
javax.servlet.RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/indexwrong.jsp");
rd.forward(request1, response1);

}
}
catch (Exception e) {
e.printStackTrace();
}

}


}

my problem is why I get null value from the button?

please someone can help me?
14 years ago