|
First create the servlet and then through the "doget" method
ad = request.getParameter("ad");//html input name
After insert database.. good luck
Java Developer
|
|
|
|
|
HOW ARE PACKAGES USED IN JAVA?
|
|
|
|
|
|
I am Newbie to Java programming. I have written the following code to add checkbox to a frame, but it doesn't appear on frame. There's no error when compiling..so can anyone please check and let me know how to add checkbox in frame?
import java.awt.*;
import java.awt.event.*;
public class CheckBoxTest {
private Frame f;
private Checkbox chk;
private CheckboxGroup cg;
CheckBoxTest()
{
f=new Frame();
cg=new CheckboxGroup();
chk=new Checkbox("Hello",cg, true);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
f.dispose();
}
});
f.add(chk);
f.setSize(300, 300);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String[] args) {
new CheckBoxTest();
}
}
|
|
|
|
|
|
I want to prepare hotel reservation programme.
|
|
|
|
|
Well, go ahead - you have our permission.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Idjit vote reversed
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So, I'm trying to make a "save.dat" so that I can store my player's information in the game into that file, and then read it if they choose to continue. Right now, the file will create, and I can write to it easily, but I want to know how to get rid of "Special Characters" and how to create sections and write to them. I want it to look a little something like this:
PlayerName:
Attack:
Defence:
Speed:
Money:
World:
And allow me to add something like this:
PlayerName: "Nick"
Attack: 6
Defence: 6
Speed: 8
Money 899888
World: "Earth"
|
|
|
|
|
You would need to read the file into some list or object which you then update with the relevant details. You then write out the updated records when necessary. You create sections just by writing keywords at particular points in the file. Not sure what you mean by how to get rid of "Special Characters".
You may also like to look into the use of java serialization - Google Search[^].
|
|
|
|
|
I get characters in the file such as √∫∆©†¨˚¬ˆ˙¥¥©¥ƒƒ and I'm guessing those are special characters or some sort of encryption.
Could you give me an example? Would this work?
Object playerName = new Object();
playerName.set(someVariable);
|
|
|
|
|
You have not explained how you are writing the file so it is not possible to tell where those characters are coming from. In terms of serialization the sequence is:
1. Read all current objects from the file.
2. Create any new objects, and update the existing ones, as required by the program.
3. Write all updated objects to the new file.
4. End the program.
|
|
|
|
|
Example:
Could you tell me how you would do it? I could then come up with a way that I would do it based on that. An example would help a great deal.
|
|
|
|
|
Just like I told you in my previous message, using the links I gave you in my first message.
|
|
|
|
|
Hi Sir,
I have gone through the above mentioned article and it was good. But I'm confused using the tool.I have done the same as what you have said in the article, but when I run the tool it is always showing NullPointerException. Even I have tried with TestPage.jsp from example, but still it is showing the same NullpointException.I have posted the error below.
Thanks in advance,
Nick.
INFO: Validating file /WEB-INF/TestPage.jsp
Exception in thread "main" java.lang.NullPointerException
at org.apache.jasper.compiler.NodeVisitor.visit(NodeVisitor.java:85)
at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:958)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.JSPValidator.doValidate(JSPValidator.java:325)
at org.apache.jasper.compiler.JSPValidator.validatePages(JSPValidator.java:126)
at org.apache.jasper.compiler.JSPValidator.main(JSPValidator.java:368)
|
|
|
|
|
Please post your question in the forum at the end of the article so the author gets notified. There are thousands of members online at CodeProject, so you need to direct it to the right person.
|
|
|
|
|
Dear Friend,
I build the dll(Maths) in visual studio 2013 win32.
Hide Copy Code
#include "stdafx.h"
#include <stdio.h>
extern "C"
{
__declspec(dllexport) int Add(int x, int y)
{
return x+y;
}
}
and tried to call this dll in java using JNA library.
Hide Copy Code
import com.sun.jna.Native;
import libs.IMathFunc;
public class MathFuc {
public static void main(String[] args) {
// TODO Auto-generated method stub
IMathFunc mathfunc = (IMathFunc)Native.loadLibrary("Maths", IMathFunc.class);
int addition = mathfunc.Add(5, 5);
System.out.print(Integer.toString(addition));
}
}
But I dont knwon where I am making mistake
Can anyone refer me an atricle or sample application on this issue.
Please kindly help me on this issue.
Thanks,
S Shanmuga Raja
What I have tried:
I have used JNA library. But it throwing error like:
Hide Copy Code
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'Maths': JNA native support (win32-amd64/Maths.dll) not found in resource path (E:\Maths\Demo\bin;C:\Program Files\JAVA\jna-3.5.2.jar\jna-3.5.2.jar;E:\MathsDemo\x64\Debug;C:\Program Files\JAVA\jdk1.8.0_71\include\win32)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:220)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322)
at com.sun.jna.Library$Handler.<init>(Library.java:142)
at com.sun.jna.Native.loadLibrary(Native.java:387)
at com.sun.jna.Native.loadLibrary(Native.java:366)
at MathFuc.main(MathFuc.java:13)
|
|
|
|
|
The message is quite clear, it cannot find the dll file.
|
|
|
|
|
I have pasted the dll in appropriate location.But still I am facing same error.
|
|
|
|
|
Well it is fairly obvious that the Java runtime cannot find it. Try putting it in the same directory as your Java application, or adding the path to the java.library.path property.
|
|
|
|
|
please am new in java programming and i have a problem on how to solve the problem below please can any one help me.
how to write a java program to display 3 on labal1 if textbox1 is not empty or display 0 if textbox1 is empty
|
|
|
|
|
|
if we take input as 'eyes'
then, occurence of e = 2
y = 1
s = 1
then, 2=1+1 ,so the output will be 'YES'
if its not equal ,then output will be 'NO'
that is, check whether the sum of occurences of some character is equal to the sum of occurences of other charcters.
|
|
|
|
|
Very interesting. Now do you have a question?
|
|
|
|
|
yeah, this is my question
if we take input as eyes
then, occurence of e = 2
y = 1
s = 1
then, 2=1+1 ,so the output will be printed like "YES"
if its not equal ,then output will be printed "NO"
that is, check whether the sum of occurences of some character is equal to the sum of occurences of other charcters.
|
|
|
|