|
You could replace the getContextPath() and getServletPath() with getRequestURL() this should provide the url part after the domain up to the query string.
|
|
|
|
|
I tried it but it only return the address of JSP page which is called by Serlet.
I want to get the Serlet which called this JSP Page
|
|
|
|
|
How do you forward the call from the Servlet to the JSP, are you doing this with the RequestDispatcher.forward() or by a response.sendRedirect()?
If you are using the sendRedirect it is impossible to get the path of the servlet, as this is lost by a secondary client call to the JSP page.
|
|
|
|
|
import java.awt.*;<br />
import javax.swing.*;<br />
import java.awt.geom.*;<br />
<br />
public class QuestionA extends JApplet <br />
{ <br />
public void init() <br />
{<br />
PanelLukis panel = new PanelLukis(this);<br />
getContentPane().add(panel);<br />
}<br />
}<br />
<br />
class PanelLukis extends JPanel<br />
{<br />
private int x_axis, y_axis;<br />
private int squareWidth, squareHeight;<br />
private int x, y, coordinateX, coordinateY, squareNo;<br />
<br />
JApplet app;<br />
public PanelLukis(JApplet a) <br />
{<br />
app = a;<br />
app.setBackground(Color.white);<br />
}<br />
<br />
public void paintComponent(Graphics g)<br />
{<br />
x_axis = getWidth();<br />
y_axis = getHeight();<br />
squareWidth = 50;<br />
squareHeight = 50;<br />
<br />
Graphics2D graphic2d = (Graphics2D) g;<br />
y = (y_axis -300) / 2;<br />
<br />
for(int j = 0; j <= 5; j++)<br />
{<br />
x = (x_axis -300) / 2;<br />
for(int i = 0; i <= 5; i++)<br />
{<br />
Rectangle2D.Double square = new Rectangle2D.Double(x, y, squareWidth, squareHeight);<br />
graphic2d.draw(square);<br />
x += squareWidth;<br />
}<br />
y += squareHeight;<br />
}<br />
}<br />
}
this is the board for the game
import java.awt.*;<br />
import javax.swing.*;<br />
<br />
public class blue extends JApplet<br />
{<br />
public void paint (Graphics g)<br />
<br />
{<br />
g.setColor(Color.blue);<br />
g.fillOval(0,0,40,40);<br />
<br />
}<br />
}
this is the blue ball
import java.awt.*;<br />
import javax.swing.*;<br />
<br />
public class yellow extends JApplet<br />
{<br />
public void paint (Graphics g)<br />
<br />
{<br />
g.setColor(Color.yellow);<br />
g.fillOval(0,0,40,40);<br />
<br />
}<br />
}
this is yellow ball
import java.awt.*;<br />
import javax.swing.*;<br />
<br />
public class red extends JApplet<br />
{<br />
public void paint (Graphics g)<br />
<br />
{<br />
g.setColor(Color.red);<br />
g.fillOval(0,0,40,40);<br />
<br />
}<br />
}
this is red ball
i need help in this programming..
i want to make this game similar like this
<a href="http://www.geekin.de/data/public/umsetzung/five_or_more/"><</a>[<a href="http://www.geekin.de/data/public/umsetzung/five_or_more/" target="_blank" title="New Window">^</a>]/code><br />
or like tic-tac-toe..<br />
anyone can help me..<br />
this is my final year project.<br />
i don't know how to integrate the ball and the board to appear in randomly.<br />
<div class="signature"><br />
<div class="modified">modified on Wednesday, May 26, 2010 12:50 PM</div></div>
|
|
|
|
|
Hello Friends
I am creating a Executable jar file and it is loading file in Windows but If I use same Execuatble jar file on MAC os then it is not loading the file.
But If I open Viewer thru batch file in which I am setting the Heap space then it is loading the file.(In mac ,we cant run batch,I just copy paste into console).
So,to open a file in MAC do i need to do some other settings for heap Space.
Thanks & Regards
Yogesh
|
|
|
|
|
Hi
I know that I am disturbing a lot with my forums.I am so sorry if my questions are irritating u but I have no other option to post here,as Now I will not say I am new to java but now i learned a lot but still to learn more.
I hope you dont mind If I keep on posting with this type of Questions.
Actually,I also want some solution and want to finish my job.
Thanks & Regards
Yogesh
|
|
|
|
|
Hi Yogesh,
There is no problem with your questions, after all, this is the reason these forums were created. However, as I mentioned in one of your previous threads, there may not always be someone reading the messages who knows the answer. This question, for example, is specific to MAC OS but I think most of the people who read this forum are Windows/UNIX/Linux specialists so you may not get a quick solution.
It's time for a new signature.
|
|
|
|
|
|
Link 1[^] Scripting in general on the MAC. Link 2[^] How to save your script. I assume the batch file content run smoothly in the console of the MAC.
|
|
|
|
|
Hello
Thx for ur reply but I think u misunderstood my question.I dont want to run my jar file thru any scripting language as it is Executable jar file.So It should run by clicking itself and its happening on other operating system except Mac OS.
But when i tried to run my executable jar file by clicking itself,it opens the application but not loading the file.
And when i run my application thru some scripting it opens and loading the file too.
In my scripting I am setting some heap size.
But I want to run thru by clicking itself only.
So,Is any way to do ?
Thanks & Regards
Yogesh
|
|
|
|
|
|
sherry100 wrote: how to use jsp
Usually by study, application and sheer hard work. Here[^] are some places you can start.
It's time for a new signature.
|
|
|
|
|
hi all ,
i have a C program listening a SOCKET but i dont have source of the C program.and the program is looping endlessly.
I want to know is there is any message available in the socket which the C program is listening.Is there any utility or code snap which can help me.
HP true64 OS machine
with regards
Balagurunathan.B
|
|
|
|
|
Firstly this is the Java forum. Secondly it is impossible to guess what your program is doing without the source. I suggest you go to the person that supplied the program and ask them for help.
It's time for a new signature.
|
|
|
|
|
Hello Friends
I created a jar file and I tried to run on Windows7 thru batch file in which I m giving the path of java like this
set path=%path%;c:\Program Files (x86)\java\bin
to find the java from 32bit.
Now I installed 64bit Java and it is under ProgramFiles inspite of ProgramFiles(x86).
If i give tht path in batch file it would run but I dont want to use batch file.I want to run application directly thru jar file and I want tht it found s the automatically the java path first from ProgramFiles and if doesnt found there then look in ProgrmFile(x86)?
Is any soultion?
or is it possible thru Enviorement variable?I really need some help.
Thanks
Yogesh Sikri
|
|
|
|
|
Updated
I am trying to run a Executable jar file that I developed in WindowsXP32 bit on Windows7 64 bit.
When I try to run It shows message tht main class not found and If i try to run batch file then its giving error message that java.lang.classnotfound sun/j3dLoader
As I am using java3d sdk too And it is also in java/bin folder
Any Suggestions?
Regards
Yogesh
|
|
|
|
|
Check your default PATH environment variable and make sure it contains entries in the form:
c:\Program Files\java\bin;c:\Program Files (x86)\java\bin; ...
In this way it will search c:\Program Files\java\bin first, if it exists.
It's time for a new signature.
|
|
|
|
|
Hello
I checked that Path under System variables is right with c:\ProgramFiles\java\jdk1.6\bin.
As I told m using java3d sdk too and java3d folder is in java folder.
But when I try to run Executable jar file ,it gives error message:
Exception In Thread "main" Java.lang.NoClassDefFoundError: com\sun\j3d\loaders\incorrectFormatException
Some more Exceptions ...
And
Could not find the main class:packageName.mainclassname.Program will Exit.
Any Ideas
Regards
Yogesh
|
|
|
|
|
If i install 32 bit first then its working but if install 64 bit then its not working.
And if i install 64 bit first then its not working for both even.
Any Ideas ?
Thanks
Yogesh
|
|
|
|
|
I found one thing related to file Type association tht is not available in windows7 or i dont know .So i posted for that in Windows7 Forums.
May be -jar option is not associated with files,so for that i need to change settings of jar file extension and m not able to find advanced option in Windows7 for File Type Association.
Regards
Yogesh
|
|
|
|
|
It looks like you have a problem with your CLASSPATH and Java cannot find some classes. Check both your PATH and CLASSPATH values are pointing at the correct directories for both base Java and Java 3D.
It's time for a new signature.
|
|
|
|
|
I am setting the java bin path and java3d bin path in System Path variable and still its not running.
But if i put my jar file in java bin folder and then run thru command prompt like this
java -jar sample.jar
then its running.
Actually,no idea with classpath variable,m not setting there anything now.
is this one need to create in System variable or in user variable?And which value it contains?
Now,I think u can help me Richard Sir.
Regards
Yogesh
|
|
|
|
|
See here[^] for information on the CLASSPATH variable.
It's time for a new signature.
|
|
|
|
|
Hello
I read tht docs related to classPath.But here i dont think this prob related to classpath.
If this prob related to classpath then do I need to change tht classpath of every machine where I am sending my jar file?Tht is not possible .
Now,my prob is related to jar file association tht I m not able to find in windows7.As i think.
Regards
Yogesh
|
|
|
|
|
Hello Richard Sir
I found the solution.
I have to associate file with jar.And in windows7 we have to add manually.and for that we have to do like this
Go to Command Prompt
c:\assoc .jar=jarfile
c:\ftype jarfile="path of javaw.exe" -jar "%1" %*
Regards
Yogesh
|
|
|
|