|
Hi All!
I'm having a problem with java if-else conditional statements, here's the code that's just not working for me:
public void actionPerformed(ActionEvent act) {
if (userName.getText() == MyString) {
try {
userUrl = new URL("http://www.mywebsite.co.uk");
getAppletContext().showDocument(userUrl,"_blank");
}
catch(Exception e) {}
}
}
Where MyString is a string variable that has been declared earlier and userName is a TextField that is also declared earlier.
The actionPerformed code is being executed when I click the button in my applet but for some reason the code inside the if statement is never executed.
Do I have to use some kind of method on the MyString variable? Like MyString.value or something? (I've tried that by the way, no such luck )
Thanks!
MrWolfy
|
|
|
|
|
Try:
if(userName.getText().equals(MyString))
I believe that using == compares the two addresses of the strings as opposed to the actual value of the strings.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Right. Like C#, Java has a distinction between "value types" and "reference types". Unlike C#, the == operator is not redefined for the String type, so it's an address comparison.
|
|
|
|
|
Hi and Thanks!
Problem Solved, you guys are really helpful!
I'd never have figured that out by myself.
Thanks Again!
MrWolfy
|
|
|
|
|
Hello,
I need help with my sharepoint project...How can I customize the help menu of sharepoint?....How can I customize the errors pages and the login and logout pages of my sharepoint???....
If any person knows how to do or know any place in the web that could help me please send me a mail to fersango@gmail.com.
Thanks
|
|
|
|
|
Please any body tell me how to do the functionality as it is there
at the following link
http://www.makaan.com/property/create-ad.php?type=agent
create ad banner dynamically based on user inputs using javascript and
AJAX or are the any controls in AJAX for this functionality
|
|
|
|
|
You would need to use a server-side language like PHP to render the banner based on custom input.
And AJAX is merely a set of technologies used together to dynamically receive content from a server - there are no "controls" in AJAX.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi All!
In JavaScript, changing the browser location is simple:
window.location = "myurl.html"
How would I accomplish this same effect from an embedded java Applet?
Thanks!
MrWolfy
|
|
|
|
|
Use the Servlet Response sendRedirect() function, ie:
respose.sendRedirect(url);
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi and Thanks!
Thanks for your help, however response.sendRedirect() is not working, my compiler complains and tells me that it cannot find symbol variable 'response'. Do I need to import something or use any other code in order for this to work? (I'm just learning Java)
Thanks!
MrWolfy
|
|
|
|
|
Oh sorry I didnt realise you were new to Java. Yes, response is a HTTPServletResponse. See this article - it may be of help.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
This article may also be of help.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Wow Thanks!
Both articles were extremely helpful, Thanks! Problem Solved!
Thanks Again!
MrWolfy
|
|
|
|
|
No problem
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='postquery.php?cat=' + val ;
}
am really new to this i want to know how it functions
-which form does it refer to?
-what is cat?(an object of?)
-options?
infact evrthing
thanx
|
|
|
|
|
Hi,
The porpose of this is script is to get the value of a select box and then go to a page based on this selection.
For form.cat.options[form.cat.options.selectedIndex].value :
form is a form that is called "form" and "cat" is a select box. What this line does is get the value of the selected option in this select box, which is what form.cat.options.selectedIndex is for - the []s show that form.cat.options is an array. This value is stored in a variable called "val".
What the next line does redirect the current browser window to "postquery.php" with the argument "cat" being the val variable that was assigned in the first line.
For example, if "val" was "data", then the browser window would be redirected to "postquery.php?cat=data".
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
SOAP call to JAVA webservice from ASP using MSSOAP.SoapClient.
Could any one post the sample to access java webservice from asp
Cheers
Anoop
modified on Thursday, July 31, 2008 5:44 AM
|
|
|
|
|
Just add the web service as a web reference to your project, and it creates a class that you can use to call it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
mssql_connect() I get php error: Error in my_thread_global_end(): 1
threads didn't exit.
|
|
|
|
|
Try replacing libmysql.dll (located in your PHP directory) with the latest version from http://www.php.net/releases/.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi!!
Actually i want to provide my users a link from where they can download documents.
The link to download the document will be sent in their inbox.
What should I do to generate a random ..url everytime depending uopn the document he/she wants to download.
Apart from this the URL should only be active for a particular period of time.
Regards
Mrinal
|
|
|
|
|
First, the Guid.NewGuid().ToString() provides a pretty unique string, you can store that in a database and make sure you known what file should be downloaded when a user hits that url...
then send a mail with an url containing that guid
http://www.yourwebsite.com/?download=your-guid
if the user hits the page you can return the requested file, since you know (int your database) what file to return for this specific string and even monitor that the file download has started....
Then after a certain amount of time disable that unique string or even remove if from your database if you're sure the download will complete succesfully.
|
|
|
|
|
Hi folks,
A few of you may remember that I announced the loss of my website virginity a few weeks ago.
www.ozfarmguide.com. I invited you all to have a look at it and I improved the site from your suggestions.
All was going swimmingly until...
I tried to use one of the many fileupload controls in the admin section on my site.
It doesn't work! None of them do!
The application crashes as the server just can't find the file I'm looking for.
e.g
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Fred\Desktop\cherries.jpg' .
I'm 99% sure there is nothing wrong with my code. Everything was working perfectly locally.
Has this ever happened to any of you?
I'm absolutly stumped and without this functionality my site s useless!
Thanks
ps.please don't chastise me for this.
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
No programming questions in the Lounge!!
There, now that I have said that, have you checked that the path and file actually exist? Clearly you need to upload the file to some directory relative to your virtual directory (that holds your website). I'm pretty sure that your webserver doesn't have the directory:
JimBob SquarePants wrote: 'C:\Users\Fred\Desktop\cherries.jpg'.
--------------------------------------------------------
Knowledge is knowing that the tomato is a fruit.
Wisdom is not putting it in fruit salad!!
|
|
|
|
|
I know, I know, I know....... I feel guilty typing this.
I'm not actually using postedfile.save to save the file to a directory. The binary data gets resized, converted to system.data.linq.binary and eventually moved to the database. It's not a permissions issue with the database cos I dont get that far.
My latest effort is here:
http://www.codeproject.com/script/Forums/View.aspx?fid=12076&msg=2657779[^]
The resize stuff is further up. I tried it without that and it still didn't work.
I'm off to flagellate myself now.......
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|