Help: A Strange Thing in my Servlet!
I wrote a simple servlet to get user feed back, and call an object to send feedback to a given address via Java Mail. For some strange reason, the data validation part never works - it is a simple IF/ELSE!
Below is a simplised version of the code. Anyone could give some ideas? Thanks a lot!
// a java servlet to handle user feed back at a site
// it gets form data
// it checks if required data are all there
// if they are, it calls other object to send these data via Java Mail, and display thank-you msg
// if not, it displays the form with data filled, if any, and asks user to resubmit
package feedback;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import feedback.FeedBack;
public class UserFeedBack extends HttpServlet {
// give mail server host name, mail receiver address, class var
static final String host="mail.myserver.com";
static final String receiver="[email protected]";
// method to get form data, validate data, and decide to send off or ask for resubmitting
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletOutputStream out = response.getOutputStream();
response.setContentType("text/html");
out.println("<HTML>");
out.println("<HEAD><TITLE>User FeedBack</TITLE></HEAD>");
out.println("<BODY>");
// get data from HTML form
String name=request.getParameter("name");
String email=request.getParameter("email");
String content=request.getParameter("content");
String subject=("User Feedback from " + name);
System.out.println("Go to validation!");
// data validation
if(name==""||name==null||email==""||email==null||content==""||content==null) {
System.out.println("Go reSubmit!");
reSubmit(out, name, email, content);
} else {
// all data are there, try to send mail via FeedBack
System.out.println("Go to Java Mail!");
try {
// call FeedBack object, which handle mail via Java Mail
FeedBack feedBack=new FeedBack(host, receiver, name, email, subject, content);
// thank sender
showConfirmation(request, out, name);
} catch (Exception e_) {
// when sending mail fails
System.out.println("Got an exception when calling FeedBack: " + e_.toString());
out.println("</BODY>");
out.println("</HTML>");
out.close();
// method to ask user to re-submit data
private void reSubmit (ServletOutputStream out, String name, String email, String content) throws ServletException, IOException {
// show submitted data in filed
// recursively call this page for resubmitting
String fb_name=name;
String fb_email=email;
String fb_content=content;
try {
out.println("<table><tr><form name=\"Feed_Back\" method=\"POST\" action=\"/servlet/feedback.UserFeedBack\">");
out.println("<td colspan=2>Please submit all data required as indicated by *</td></tr>");
out.println("<tr><td>Name*</td><td><input type=text name=\"name\" value=");
out.println(fb_name + "></td></tr>");
out.println("<tr><td>Email*</td><td><input type=text name=\"email\" value=");
out.println(fb_email + "></td></tr>");
out.println("<tr><td>Content*</td><td><input type=text name=\"content\" value=");
out.println(fb_content + "></td></tr>");
out.println("<tr><td><input type=\"submit\" value=\"Submit\"></td>");
out.println("<td><input type=\"reset\" value=\"Reset\"></td></tr>");
out.println("</form></table>");
} catch (Exception e_) {
System.out.println("Got an exception when making re-submit form: " + e_.toString() );
// thanks msg to this trouble maker
private void showConfirmation (HttpServletRequest request, ServletOutputStream out, String name) throws ServletException, IOException {
String user_name=name;
try {
out.println("Thank you, " + user_name);
out.println(", for writing something to keep us busy!" + "\n");
} catch (Exception e_) {
System.out.println("Got an exception when showing thanks note: " + e_.toString() );
// a standard way to assure both form methods can be safely used
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
One problem I found in your code...
For checking equality of two strings you need to use String.equals(String otherString) and not the operator ==
Similar Messages
-
Help! Strange things happen when I use Get Info command
Hi, I have updated iTunes for 7.7.1, and since then a strange thing happen: whenever I pick a Smart Playlist, select a song and use the Command-I, the Get Info screen appears for a few seconds, and then the "Cancel" button is highlighted, as if I had clicked on it, and the screen is closed.
Funny thing is that I am not clicking the "Cancel" button, but it happens automatically after a few seconds, and only with songs in the Smart Playlists. I haven't found a thing about it at the Discussion forums, can anyone help?In iTunes, right click on the file and Get Info.
Make sure it is marked Remember Playback Position. -
My imac is doing strange things:
-delaying between users: when closing session it goes to blue, then takes a while to appear users signin box, and then wont recognize mouse command to enter until a couple of minutes later... then everything seems alright until....
-it gets stuck between things, the rainbow wheel appears and its just delays there forever....
-and every now and then the mouse starts flickering and bouncing wildly onscreen.
I ran the appel hardware test and it detected an error:
4MOT/4/40000003:HDD-1233
Does anybody know what that means? HELP!WZZZ answered about where to get iStat. And do check the SMART status. If it is an overheating problem due to a fan or logic board problem, your hard drive is possibly cooking itself to death. If so it isn't a faulty hard drive even though the hard drive might fail. So assuming it's a temperature problem, even if you are able to repair things on the disk with software, that is working on symptoms, not causes. I could be wrong however.
RE: AppleCare: Your iMac came with one year of AppleCare (Apple's warranty program), but within the first year you can buy 2 more years. You have to extend by the one year anniversary of purchase of the computer. Your 10,1 is too old to still be in the first year, and since you asked what it was, I'm sure you don't have it. Bottom line meaning is that whatever this problem turns out to be, you'll have to pay for it. Unless there is something like this. It is for 2011 iMacs with certain Seagate drives. You can put in your serial number for fun, but it looks like yours is too old. Lastly, some people have had Apple help them anyway if it is just out of warranty, but many have not. Your machine is one of these. Type in 10,1 in the search box. Is there an Apple Store near you? Just b/c it's out of warranty doesn't mean you shouldn't have it looked at by Apple. But no one here can say at all what Apple will or will not do.
Hope you get it taken care of! -
I'm using Apple Mail 2.1.3 on a MacBook running OS 10.4.11. A very strange thing is happening. E-mail messages that I either sent or received months ago are showing up in my mailbox and receivers' mailboxes. In one case, a message someone had sent to me wound up in the mailbox of a third person, who was not included in the address list!! I have only two accounts, and have checked everything; only one account is showing the repeats Now, that account is my professional account, and it resides in three places: I use it on the laptop described here, I use it through Apple Mail on the much newer desktop Mac in my office, and I can run it through Web mail on my employer's server, which is where the professional account resides (I have a mailbox there, etc.) That program is called Zimbra.
My personal account is with Earthlink and is not doing the repeats. I access it either through my MacBook's Apple Mail or the Web; the Apple Mail on my office Mac is not configured to access the Earthlink server.
What IS going on here?? My friends, colleagues, and students (I teach college) are mystified by these ancient messages.
Thanks for any help!!I'm using Apple Mail 2.1.3 on a MacBook running OS 10.4.11. A very strange thing is happening. E-mail messages that I either sent or received months ago are showing up in my mailbox and receivers' mailboxes. In one case, a message someone had sent to me wound up in the mailbox of a third person, who was not included in the address list!! I have only two accounts, and have checked everything; only one account is showing the repeats Now, that account is my professional account, and it resides in three places: I use it on the laptop described here, I use it through Apple Mail on the much newer desktop Mac in my office, and I can run it through Web mail on my employer's server, which is where the professional account resides (I have a mailbox there, etc.) That program is called Zimbra.
My personal account is with Earthlink and is not doing the repeats. I access it either through my MacBook's Apple Mail or the Web; the Apple Mail on my office Mac is not configured to access the Earthlink server.
What IS going on here?? My friends, colleagues, and students (I teach college) are mystified by these ancient messages.
Thanks for any help!! -
Help needed to figure out a strange thing
I am running GJ and Java 1.4 on window 2k and I have been spending hours trying to figure out what's wrong with the following codes. Any help would be greatly appreciated. The code is simplified (doesn't use any util class at all), but it still throws runtime exception:
C:\test>java D
Exception in thread "main" java.lang.AbstractMethodError: E.test()LE;
at C.test(C.java:1)
at D.main(D.java:17)
The strange thing is that, when I change the name of class E to B, it runs fine. It seems that classes B and C have to be ordered. For example, using name C1 and C2 will be fine, but using C2 and C1 throws exception. It's getting late and I am tired.
public interface A {
public A test();
public abstract class E implements A {
public abstract E test();
public abstract class C extends E {
public C() {}
// the main class
import java.io.*;
public class D extends C {
public D() {
super();
public D test() {
System.out.println("D called");
return new D();
public static void main(String[] agrs) {
A obj = new D();
obj.test();Its a bug. The compiler neglected to generate a required bridge method.
I have reported 4821489 for this problem. -
Strange things are happening to my MacBook. Please help.
Since buying my first MacBook nearly two years I have not had a single problem with it until earlier this week, when strange things started to happen.
1) The first obvious problem was that my dock lost its settings.
2) Then the green light at the top of the screen was on when I turned on my computer. Although this was resolved by shutting down and restarting, I have no idea why it was on in the first place.
3) Thirdly, my email disappeared from Mail. After exploring, I found out that one of the check boxes in preferences had disabled my account and when I checked it again my email reappeared.
4) And finally, it seems to be getting slower and slower. Whether it is opening a program such as Mail, opening system preferences or restarting, it all seems to be taking longer than I previously remember. However, once things are up and running they are generally fine.
After doing some research I have found two possible fixes: resetting PRAM and resetting the System Management Control. The problem is that although I can read how to do them, I have no idea if they will fix my problems or what the implications of doing either are.
So, do you think it would be a good idea to reset either the PRAM or SMC? If so, which should I do or what order should I do them in?
Also, what, if any, are the risks of doing either? As I understand, my settings for things like the display will be reset but not things like wifi or the firewall, and all my programs, updates and files will remain untouched. Is that correct?
Anyway, I hope that all makes sense and thanks in advance for any help you may be able to offer me.
PaulHmm, free space is okay, though some folks would say it's a little on the low side.
How much RAM do you have in your computer?
Also download SMART Utility here: http://www.volitans-software.com/smart_utility.php
Run the application--it will give a report for your drive's physical health. If you get anything other than "Passed" you will probably need to replace the drive.
~Lyssa -
Help needed because of strange things with Lollipop!
Hello everyone. I've updated to Lollipop 5.0.2 .... But some strange things are happening.
I've updated using PC companion. When I finished downloading the update files from the Net
,and I've turned off my phone so the update starts. After 1 minute something wrong went with my
computer. It restarts by itself. So my phone didn't boot anymore. I tried to reupdate it, but
that couldn't be done cause the phone is not booting. So I had one option, which is to do
a system repair to repair my phone. I did it and I succeed. So my phone is now updated to lollipop
, but of course all the data in the phone were wiped out. This is not a problem, I can redownload the apps I want.
The problem is that on Kitkat I used to play a game called ( plants vs zombies ) , but on Lollipop
Whenever I open the game it shuts down after half a minute. I thought the problem was
because I moved it to the SD card, so I moved it to the internal storage of my phone
but no change. It still shuts down by itself.
Another thing is that when I install an app, in normal state there are moving lines from the above
to show that the app is installing . Sometimes those lines disappear , I don't know if this is a problem or not.
This is a screenshot of the fault.As you can see , the line is still. There must be lines moving inside it.Thanks.Hi! Sorry, I've been busy and hadn't gone on the forum for about 2 weeks haha. Uhm I do not experience the problem anymore it was a long time ago, from where do you download your APK files? I used 1MobileMarket for the download of PvZ2 but I receive updates via Google PlayStore. The only thing I can suggest is that you uninstall it, try downloading it vis 1MobileMarket and see if it works. If not I really don't know what the problem is.. I had my problems with PvZ on the Z, not the Z2, but it was the same you are experiencing with the game. I did notice that whenever I did a factory reset or system repair, I'd lose all my PvZ gaming data although I had my Google Play Account logged it to sync my data. As for the lines while installing the app; If the apps work normal after installing (the lines still didn't show up or disappeared) I don't think it might be such a problem. As long as you can run the apps. Hope this helps!
-
A very strange thing . . .
Hi all,
A very strange thing just happened. One track in a project, which has several regions, just stopped playing back! All other tracks play fine. Even the track that stopped playing back, when selected, is still active, i. e., my midi controller still plays the software instrument associated with the track. All of the info is still there; I can see it all in the piano roll, the score . . . everything.
One clue, which I'm not sure how to describe, is that in the problem track, all of the regions have changed color and now have a little dot in their upper left corner. So, the regions which were all green, the default color, are now gray and green, but have the little dot at the top left.
Oh, this happened by accident while I was recording on that track. I was attempting to record a new region between two other regions, then suddenly this happened!!
Anybody know what's going on here?
Thanks, Josephthanks for the gray tracks thing. I have worked with Performer since 1985. I am having the hardest time simply getting around on logic express. Copying, pasting, setting regions. I record and sometimes it doesn't erase the previous info. I paste a track and it goes to another track. How do I erase measures on one track? Sorry for the lack of clarity in this question but the manual has been hard to understand. COuld I call you? I know the answers are easy. I don't see the logic in logic. Any help would be appreciated. [email protected]
fritzkersting.com -
Very strange thing after 10.7.3 update?
Very strange thing after 10.7.3 update?
Everything seems to be working normal except the desk top BBC iPlayer which plays fine in a small window but when you go to full screen still plays the sound but the screen just goes black, no video?
I thought maybe the update knocked off one of the plugins or players but reinstalled iPlayer and same problem, anyone got a workaround or suggestion as to how I can fix it, am I the only one?
Full screen YouTube works fine.
Everything else seems ok, maybe running a little hotter and the fans are kicking in a little sooner but does feel a little snappier.
Thanks
PhilSeems like they are on it
http://iplayerhelp.external.bbc.co.uk/help/announcements/full_screen_mac_desktop
I hope it doesnt take too long -
strange things with keyboard happens on my macbook - after cleaning keyboard (rag with spirit) I start mac and get sticky key (continuously type one letter and beeping on speaker). I shutdown mac, remove key and clean space under it... it helps - but I found other strange bug:
pressing left shift - gives me capital letter "O"
letter "O" - always capitalized
| symbol always comes with return button
now I use external keyboard - all good on it... but macbook keyboard still wont work properly
what can it be? how fix it?
ps: sorry for my engthanks for your reply, and you might be right about using USB v2.0. The PS/2-USB adapters I am using are v.1.0 so may be incompatible, even though this technology is supposed to be backward-compatable.
Since this problem reared its ugly head, I have disabled the Toshiba applications and monitored the situation - OK so far, but I will keep an eye on it. -
Strange things happen: mail disappears/appears/is shown wrong
Strange things happen: mail appears in "drafts"/mail disappears after "send"/title-content doesn't match
I'm having some Problems with mails that get worse and worse
First thing I remember is, that I found mails in "Drafts" that weren't drafts, but just mails I received or mails I sent.
They were kind of aliasses of the original. Deleting them in "Drafts" deleted the original in its Mailbox too.
Re-indexing Mail (removing the envelope.index files etc.) fixes it, but it reappears very soon
Next thing:
When I send an email, it happens sometimes, that it is not send (no sending sound, no copy in the "Sent"-Folder). It just "disappears"
Re-indexing Mail fixes this: When Mail is ready with reindexing, it sends those messages (kind of funny, when I do this reindexing after some weeks... kind of...) - but it will reappear
The third thing happens more seldom:
When I klick on the emails name in the list, I get another Mail shown in the Previewbox. Doubleklicking the mail shows the wrong mail too.
Re-indexing fixes this, - but it will reappear
Well after having re-indexd my Mail library 10 times this week, I want another solution for this...
Mail Version etc:
Mail: Version 3.5 (930.3)
1 Pop account,
1 .mac account (i don't use)
Mail, after being sent, is moved to "Sent"mail never to be deleted
Mails Spam Filter is active (and working fine, by the way)
about 80 Mailboxes for old Mails I got, partially nested
More than 4000 Mails in the whole Database
Things I've already done:
Reindexing mail, as I already wrote (Quit mail, removing the files "Envelope Index" and "Envelope Index-1", and the folder starting with "Mac-", then start Mail again, that tells me to klick "ok" for reimporting the mail)
I deleted a bunch of emails with attachements, so there are just a few with attachment now.
I emptied the "Sent" folder and put those old emails in 3 Folders (each of them is containing about 500 mails now)
Thanks for your help in advance
PS: Yes, I want to keep all these old mails...This is not a security risk - a setting change you should make.
1. Take a look in settings - i message and see what the 'recieve at' addresses are declared. If you do not want to see phone messages on the pad, clear that number out of there - and just use your e mail address.
2. Since you used to have an i phone, that device is likely still registered go to your i tunes account and de register the device. -
Addressbooksync wants to connect to strange things
Little Snitch keeps alerting me that addressbooksync wants to connect to all kind of strange things. It looks like anything can request access to this and "spy" to my address book?
I read a number of posts about addressbooksync having problems, but couldn't find any other post about how it tries to access all kind of strange url's. See below picture, the list is much longer then that. It mostly pops up when I am browsing through safari.Thanks those are helpful - I can also see the activity in my router logs, but this is easier!
I just got another one that's a bit mystic as well since I have NO Microsoft anything on my 2011 Mini... BUT it looks like some kind of System process...
"netbiosd"
wants to connect to 10.xx.1.xx on TCP port 445 (microsoft-ds)
IP Address 10.xx.1.xx
Established by /usr/sbin/netbiosd
User _netbios (UID: 222)
Process ID 185"
I am running a Seagate Dockstar (Pogoplug) on the LAN sharing a media drive via SMB.
My router is a Linsys/Cisco E2000 with no Apple hardware on the network other than a couple of iPads and a MacBookPro on the WLAN. Also a couple of TiVos, and AppleTV1 (patched) and sometimes cell phones.
I haven't run down the IDs on all the MAC addresses completely yet - but I've got about 12 devices showing up that I need to identify. 4 are still yet to figue out.
Could an ID like 10.xx.1.xx have something to do with file sharing maybe? Dropbox? Elgato Syncmate? etc. I do have those running. -
This is by far the strangest problem I have come upon and
can't find anything in any forum discussing it. My site is
www.aloversscent.com. We are trying to put up 4 videos. I am
editing in FCP and compressing in Compressor to H.264 and then
making the files flv files to bring directly into Flash. All of
them are working fine except for our third episode, Operation Fox
Hunt. The audio sync is going off when the title cards come up,
about a 1/3 of the way through the video and only then. I went back
and made new exports where I tried filling in the blank audio
pieces under the cards with Slugs, I tried creating the title in
LiveType and then transfering it over instead of using the FCP
title cards. But neither worked. The strange thing is they work
fine when I play them in Quicktime. It's only when they play in
Flash that they get out of sync. If you scrub through the timeline
they will sometimes match back up again but while playing they
always get out of sync. I have run out of answers and need help
bad. Please let me know if you have any ideas.Naw, just tell us what your sequence settings are and what your original codecs are or were. It's easy to transcode or to shoot incompatible or wrong audio sampling rates.
Clip: HDV 1080i60, 1440x1080, Upper field first; Linear PCM 24-bit 44.1khz
Sequence setting: all standard easy setup for HDV 1080i60
The difference between 2 and 20 percent is a complete order of magnitude and that kind of discrepancy sends us to totally divergent debugging paths and wildly silly suggested workarounds.
You are right. My initial wrong judgement was based on which selection I thought I was seeing at the time.
If you convert, as Christina suggests, you may still need to alter the speed of your audio track to match the length of the video.
The audio is not the only problem. Even with no audio (just a video track extracted by QT or MpegStreamclip and saved as a self-contained movie) the video stops short; i.e. by minute 10 of a 10' clip material from earlier is still playing, and the rest is missing. All other apps see the video just fine.
I already tried converting the audio to the proper rate in QT and recombining the two. But again, this problem with the video is there with the audio stripped as well.
Oh, and also: the problem is there in the viewer as well, before adding it to the timeline.
Message was edited by: Jeremy Hansen -
Hi! I have a strange problem: In liveCycle Designer ES 8.2 I have on Master Page checkbox "mycheckbox".
My code:
if(mycheckbox.rawValue == "0")
myPage.presence = "visible";
else if(mycheckbox.rawValue == "1")
myPage.presence = "hidden";
When I clicked on mycheckbox happen strange things - mycheckbox will not be checked! I don't understand what is wrong.
MatthewHello mathew,
If you keep any interactive fields in the Master page like text field or check box, as Malcolm said you will loose the values in it.
This happens only when you try to hide some pages. because the form will be remerged again and it can bring back the values entered in the fields present only in the body page. It will not hold any values entered for the master page. That is why your check box is behaving wierd. To get more clarity on this, keep a text field in the master page, and on its exit event, try to hide one of your pages on the form. When you preview the form and type the value on text field and exit from it, the text field will become null and also your required page will be hidden.
Your problem solution:
For the check fields you want to have in Master page, maintain the duplicate hidden check fields in one of the body page. Try to assign the checked values to the hidden fields in the change event of check fields and retrieve the values back to the masterpage checkfields in the exit event.
This below should work for you in the events of master page checkbox:
form1.#pageSet[0].MasterPage1.CheckBox1::change - (JavaScript, client)
form1.page1.CheckBox2.rawValue = this.rawValue;
form1.page1.TextField2.rawValue = this.rawValue;
if (this.rawValue = 0)
page2.presence = "hidden";else
page2.presence = "visible";
form1.#pageSet[0].MasterPage1.CheckBox1::ready:layout - (JavaScript, client)
this.rawValue = form1.page1.CheckBox2.rawValue;
Hope this helps.
Regards,
Chaitanya -
Hello all,
I have noticed that when I go to a web site I have been previously that some of the links I've clicked on the last time I visited are highlighted (showing I've clicked on them before)
The strange thing is that this is happening on every site I go to, even when my IP address has changed ( by manually rebooting my router I get a new IP addy)
And I have also removed all the cookies at the end of a internet session!
I'm using mozilla WaNcom 1.3.1
all help is appreciated
kindest,becaYour web browser keeps track of the URLs it has visited for a limited time or number of URLs, which can be configured in the browser's preferences for some browsers. This record is not part of the cookies and it is independent of the computer's IP address.
(22713)
Maybe you are looking for
-
Ipod not reconised by windows, itunes or anythin!! help
ive installed ipod nd itunes on my computer and when i plug the ipod nano in it charges fine and everything, but it isnt showing up on the computer. It comes up with the install driver wizard window, and the driver isnt found on the disk or on the in
-
Help against hackers
-
Hi All, when i am trying to unzip a .zip file it shows unzip not found erro. but when i gave whereis unzip command , it shows the location. so that means unzip exists. but why i cant unzip my .zip file . my os is hp-unix. below is screenshot for that
-
%iowait is more than 50 always in TOP. What is the reason?
Dear All, In my server i have 2 databases APAC and AIX. In my top command the iowait % is more than always. So how can i find which DB casuing this and from which session this IO wait is happening. Please let me know how to tune to reduce this IO wai
-
I have been having trouble using Adobe Reader 8.1.1, every time I go to open it I receive the following message: Error Signature AppName:acrord32.exe AppVer:8.1.0.137 ModName:msver71.dll ModVer:7.10.3052.4 Offset:000010428 Has anyone else experienced