Help please!!!! regarding the calling of a class by a servlet
Hi all,
I have written a separate class (UserPresent.java),in this class I am doing checking for useid and password provided by a html form.I will post the code now.
import java.sql.*;
import java.lang.*;
import java.io.*;
public class UserPresent {
try
Connection con = DriverManager.getConnection("jdbc:odbc:MyDS");
System.out.println("Successfully connected to database");
}catch (Exception e){
e.printStackTrace();
// Should write a method here
public testUserExist(){
try{
PreparedStatement pstmt;
pstmt = con.prepareStatement("SELECT username,password FROM users" + " WHERE username ='" + user + "'" + "AND password='" + pass + "'");
ResultSet rs = pstmt.executeQuery();
if(rs.next())
username = rs.getString(1);
password = rs.getString(2);
if (username != null && password != null && user.equals(username) && pass.equals(password) ){
message ="ok";
PrintWriter out = response.getWriter();
out.print("<B>" + message + "</B>");
//response.sendRedirect ("http://localhost:8080/thankyou.html");
}//closes the if statement
else {
message="not ok";
PrintWriter out = response.getWriter();
out.print("<B>" + message + "</B>");
//response.sendRedirect ("http://localhost:8080/sampleapp/login.html");
}//close else statement
}catch (Exception e){
e.printStackTrace()
} // End of testUserExist()
// Whole thing should be a method ???? What will it return ??????? What will the parameters be ???????
} // End of class UserPresentI wanted to know how this above code can be incorporated into a servlet code
1) The parameters with which this method should be called from the servlets' doPost() method
2) What will be the return type of this method
Hope that my question is well stated.Help would be greatly appreciated
Thanks in advance
AS
Hi all,
I have written a separate class
class (UserPresent.java),in this class I am doing
checking for useid and password provided by a html
form.I will post the code now.
import java.sql.*;
import java.lang.*;
import java.io.*;
public class UserPresent {
try
Connection con =
n = DriverManager.getConnection("jdbc:odbc:MyDS");
System.out.println("Successfully connected to
to database");
}catch (Exception e){
e.printStackTrace();
// Should write a method here
public testUserExist(){
try{
PreparedStatement pstmt;
pstmt = con.prepareStatement("SELECT
SELECT username,password FROM users" + " WHERE
username ='" + user + "'" + "AND password='" + pass +
ResultSet rs = pstmt.executeQuery();
if(rs.next())
username = rs.getString(1);
password = rs.getString(2);
if (username != null && password != null &&
ull && user.equals(username) && pass.equals(password)
message ="ok";
PrintWriter out = response.getWriter();
out.print("<B>" + message + "</B>");
//response.sendRedirect
ect ("http://localhost:8080/thankyou.html");
}//closes the if statement
else {
message="not ok";
PrintWriter out = response.getWriter();
out.print("<B>" + message + "</B>");
//response.sendRedirect
ect ("http://localhost:8080/sampleapp/login.html");
}//close else statement
}catch (Exception e){
e.printStackTrace()
} // End of testUserExist()
// Whole thing should be a method ???? What will it
return ??????? What will the parameters be ???????
} // End of class UserPresentI wanted to know how this above code can be
n be incorporated into a servlet code
1) The parameters with which this method should
hould be called from the servlets' doPost() method
2) What will be the return type of this method
Hope that my question is well
estion is well stated.Help would be greatly
appreciated
Thanks in advance
AS
thanks people,Well I wasnt thinking when I posted the code for UserPresent.java
I didnt mean to include the presentation logic i.e., message="ok" and things like that in this jave file,do excuse me for this.
I will think about it and get back to you people hopefully ASAP
Thanks again
AS
Similar Messages
-
Help needed regarding the updation of "Relationships" in BP
Hello Guys,
This is to request you to kindly help me regarding the following.
We have a scenario where all the employees assigned to an Organizational unit (in PPOMA_CRM) are not showing in the "Relationships" ("Has Employee")in the BP transaction of that Organizational Unit.
Could anyone let me know whether there is any update program that updates the "Relationships" from the Organizational asssignment. Or we need to enter the employees manually in BP "Relationships". Please help. Thanks in anticipation.
Regards,
Kishore.Hi Amit,
Thanks alot for your reply. Its really helpful for me.
So,we usually enter these relationships manually only, right? Before going ahead with the custom program, could you please let me know whether there is any SAP note related to this.Once again thanks alot for you help.
Regards,
Kishore. -
Hey Verizon / HTC / Google Please fix the caller ID problem, post 2.2 Froyo UPDATE. This is a major Problem.
I have provided some steps below that may help with the Caller Id issue you are experiencing.
Try completing a soft reset on the device. A soft reset would be powering the device off and pulling out the battery. Once the battery is removed, place it back in and power the device back on.
Dial *228 and send. Once dialed, listen for the recording to prompt you for option 1 and select option 1. The phone should complete its programming within a minute.
Ensure you are using the area-code and 7 digit number format (ex. 9999951212)
Try removing the contact and re-adding it. -
Please help me regarding the running of a sql file
Hi I downloaded one sql file from
http://www.cs.uwf.edu/~sbagui/db/practical_oracle.htm
But i am unable to run it successfully...please help me regarding this... thanking you
Edited by: SowmyRaj on Dec 24, 2009 5:24 AMHi vali thanks for your reply...
I am using Windows XP sp2 Os.
and Oracle database 11g ...
when executing this file the follwing error is occuring
Enter value for user_name: system
old 2: uname VARCHAR(50) := '&user_name';
new 2: uname VARCHAR(50) := 'system';
**MOBILE CODE** immediate 'drop user ' ||uname;
ERROR at line 13:
ORA-06550: line 13, column 1:
PLS-00103: Encountered the symbol "*" when expecting one of the following:
( begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge -
Need help in modifying the Calls by the Telemarketing agent
Hi Group,
I am facing issues while updating the calls using the Function module 'CRM_CLM_CALL_MODIFY'.
the business requirement is as under:
- a program needs to be built which will take the calls from all the Call lists from the Current week and has to update these
calls by using by a certain field called 'CALL_RESULT' of the Sturucture 'CRMS_CLM_CALL'.
- I have collected all the Calls but while using the Function module 'CRM_CLM_CALL_MODIFY', I was not getting any
exceptions, but still could not the see the updation being done to the calls in the Call lists.
In the CRM system also, there is no sign of this Function module being used and in the SAP Market place also I could not get a proper answer/notes to this query.
So please let me know your inputs on this to proceed further on the updation part.
Thanks for the help in advance.
Regards
Vishnu.Hi Group,
This can be resolved by creating the Implicit enhancement and adding the required functionality.
Regards,
Vishnu. -
please help, 5 duke dollars up for the best answer, or first answer that solves my problem!
Hello, I have created a package called molecule that contains classes named Water, Sugar, Carbon Dioxide, and SulfuricAcid, and a sub-package named molecule.atom. The atom sub-package contains classes named Carbon, Hydrogen, Oxygen, and Sulfur. Each class in the molecule package should re-define the toString() method to print the numbers and types of atoms that constitute the molecule. For example, molecule.Sugar.toString() should return the string:
"Sugar: 6 Carbon, 12 Hydrogen, 6 Oxygen".
So basically, I have created a folder in C:\molecule\ and a subfolder C:\molecule\atom\ . I have also created a class called ChemTest belonging to the default package. ChemTest.main() creates and prints instances of each molecule and atom, but does not contain any import statements. The problem is that the ChemTest.java file won't compile coming up with 16 errors!
Can someone explain to me what I am doing wrong?
here is one of the molecule classes, for example CarbonDioxide.java:
package molecule;
public class CarbonDioxide
private String co2;
public CarbonDioxide()
co2 = "Carbon Dioxide: 1 Carbon, 2 Oxygen";
public String toString()
return co2;
and here is one of the atom classes, for example Carbon.java:
package molecule.atom;
public class Carbon
private String c;
public Carbon()
c = "Carbon: symbol = C, num = 6, weight = 12.011";
public String toString()
return c;
now here is the ChemTest.java file that won't compile:
public class ChemTest
public static void main(String[]args)
molecule.Water water = new molecule.Water();
molecule.Sugar sugar = new molecule.Sugar();
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
System.out.println(water.toString());
System.out.println(sugar.toString());
System.out.println(carbonDioxide.toString());
System.out.println(sulfuricAcid.toString());
System.out.println();
System.out.println(carbon.toString());
System.out.println(oxygen.toString());
System.out.println(hydrogen.toString());
System.out.println(sulfur.toString());
and finally, here are the errors:
C:\molecule\ChemTest.java:5: cannot resolve symbol
symbol : class Water
location: package molecule
molecule.Water water = new molecule.Water();
^
C:\molecule\ChemTest.java:5: cannot resolve symbol
symbol : class Water
location: package molecule
molecule.Water water = new molecule.Water();
^
C:\molecule\ChemTest.java:6: cannot resolve symbol
symbol : class Sugar
location: package molecule
molecule.Sugar sugar = new molecule.Sugar();
^
C:\molecule\ChemTest.java:6: cannot resolve symbol
symbol : class Sugar
location: package molecule
molecule.Sugar sugar = new molecule.Sugar();
^
C:\molecule\ChemTest.java:7: cannot resolve symbol
symbol : class CarbonDioxide
location: package molecule
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
^
C:\molecule\ChemTest.java:7: cannot resolve symbol
symbol : class CarbonDioxide
location: package molecule
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
^
C:\molecule\ChemTest.java:8: cannot resolve symbol
symbol : class SulfuricAcid
location: package molecule
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
^
C:\molecule\ChemTest.java:8: cannot resolve symbol
symbol : class SulfuricAcid
location: package molecule
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
^
C:\molecule\ChemTest.java:10: cannot resolve symbol
symbol : class Carbon
location: package atom
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
^
C:\molecule\ChemTest.java:10: cannot resolve symbol
symbol : class Carbon
location: package atom
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
^
C:\molecule\ChemTest.java:11: cannot resolve symbol
symbol : class Oxygen
location: package atom
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
^
C:\molecule\ChemTest.java:11: cannot resolve symbol
symbol : class Oxygen
location: package atom
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
^
C:\molecule\ChemTest.java:12: cannot resolve symbol
symbol : class Hydrogen
location: package atom
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
^
C:\molecule\ChemTest.java:12: cannot resolve symbol
symbol : class Hydrogen
location: package atom
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
^
C:\molecule\ChemTest.java:13: cannot resolve symbol
symbol : class Sulfur
location: package atom
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
^
C:\molecule\ChemTest.java:13: cannot resolve symbol
symbol : class Sulfur
location: package atom
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
^
16 errors
Please help!!!, thanks!HI,
I tried your problem with the following directory structure:c:\java\ChemTest.java
c:\java\molecule\CarbonDioxide.java
c:\java\molecule\atom\Carbon.javaI set the dos-prompt to c:\java and ran the following commands:javac molecule\CarbonDioxide.java
javac molecule\atom\Carbon.java
javac -classpath . ChemTest.java- and it worked!
Sure, in ChemTest.java I deleted all the lines refering to classes that you didn't post...
I hope this helps you!
Anja -
Smart forms - Identifying the calling method and class
Hi Experts,
Is there a way to identify the method and class names that called a smart form..
Any inputs or pointers in this regard woul;d be of great help.
Regards,
Kris.Hi Kartik,
The procedure you suggested is good to identify the class by manual intervention.
But I need the class/mehtod name in the program as the logic of the code depends on which class called the smart form.
Any idea how this can be read?
Regards,
Kris. -
Help needed regarding the deployment architecture for PROD env
Dear All,
Please help me with some clarifications regarding the deployment architecture for PROD env.
As of now I have 2 single node 12.1.1 installations for DEV and CRP/TEST respectively.
Shortly I will be having a PROD env of 12.1.1 with one DB node and 2 middle tier (apps) node. I need help in whether -
1) to have a shared APPL_TOP in the SAN for the 2 apps node or to have seperate APPL_TOPs for the 2 apps node. The point is that which will be benificitial in my case from business point of view. The INST_TOPS will be node specific in any case right?
2) Where to enable the Concurrent Managers, in the DB node or in the primary apps node or in 2 apps node both for better performance.
12.1.1 is installed in RHEL 5.3
Thanks and RegardsHi,
Please refer to (Note: 384248.1 - Sharing The Application Tier File System in Oracle E-Business Suite Release 12).
For enabling the CM, it depends on what resources you have on each server. I would recommend you install it on the the application tier node, and leave the database installed on one server with no application services (if possible).
Regards,
Hussein -
Little help please regarding deleting files and folders...
My wife has a MBP and has accumulated some old items in her documents folder that she'd like to delete. She has a USB mouse but the "right click" doesn't appear to work. She's running 10.4.11 and can't reveal the files in icon mode to facilitate dragging to trash. Certainly there is a sequence of keystroke commands that will allow these files to be effectively trashed, but our "control/delete", or "apple/delete", or "option/delete" doesn't do the trick after highlighting the subject file. Help please! TIA!
To delete a file or folder, high light it then using the keyboard type Command Delete and that will delete it. If you have multiple files and/or folders the same keyboard commands apply.
Regards,
Roger -
Help required regarding the outbound delivery creation by batch job
Hi Gurus,
We are facing one problem in the outbound delivery creation.
The deliveries will be created automatically (using program RVV50R10C) from the existing open sales orders through the run of a batch program for every 5 minutes.
The program RVV50R10C is scheduled to run for every 5 minutes, which picks up all the open sales orders and creates outbound deliveries. However, during one run we have found an error.
The error had message class V50R, message no: 024 and message type : I. The error message reads as follows : u201CAt least one order was blocked and could not be deliveredu201D.
When we have checked the VBFS table, it showed the sales document line items with the Message type : E, Message no: 24 and message id : V50R.
Can anybody decipher what could be the reason why this error message is appearing?
Thanks in advance,
KrishnaHi Friend,
to clearly identify the issue,
Goto SE38 and give the program which you are using as Back ground job to create the deliveries and give the sales order number as mltiple entries and execute the program in back ground.
In most of the cases we can identify the issue behind the job while doing this.
please revert me if you need more clarification
regards,
santosh -
Help - error: 1017: The definition of base class CairngormEvent was not found.
Hi.
I've inherited someone else's flex code. I need to make a small change re-complie and re-deploy, but the IDE (flash builder 4) keeps telling me there's an error in one of the.as files. Here's the details:
= Error:
1017: The definition of base class CairngormEvent was not found.
= Code:
package actionScripts.events {
import flash.events.Event;
import com.adobe.cairngorm.control.CairngormEvent;
public class CairngormGeneralEvent extends CairngormEvent {
[etc..]
Any ideas?
I'm using Flash Builder 4. Any help would be much appreciated.check if the Cairngorm.swc is in the libs folder
-
Getting the calling object reference / class?
Dear forum members,
Is it possible for A in the below example to get that B was the "caller"?
class A {
A() {
public void someMethod(String text) {
System.out.println("I was called with: " + text);
System.out.println("I was called by: " + thatMagicWayToGetCallerClassOrReference());
class B {
public static void main(String[] args) {
A a = new A();
a.someMethod("HOLA HOLA");
}Another way of getting the class of your caller is to use a SecurityManager object. getClassContext() is protected but you can get at it by subclassing SecurityManager (it works if you just instanciate the manager without installing it). This gives you a reference to the Class object itself where the stack trace returns only the class name. Bear in mind that the class in question will be several items up the array, the first entry is the SecurityManager itself, the second the called class.
However, I agree with others it doesn't sound like the best design. If you're having trouble with not being able to change the interface specifications to pass the extra information then consider using a static reference, if necessary a ThreadLocal. What happens if you want to call the offending method indirectly through some central method at some future time? You've lost the call origin data.
Why can't you simply add a parameter to the offending call? -
Help needed regards the usage of STL.....with CC
Hi All,
I am relatively new to SOLARIS. I am trying to figure out the options for using the STL components in the project.
The project needs to be compiled with both CC ang g++, should support both SOLARIS and LINUX systems. That's why i am going for STL components rather than using the RW-Components of Tools.h++.
I have the following doubts regards the usage of STL.
CC provides the -library option to link the libraries we require.
The following is what i understood from the documentation:
No ( -library ) option provides - default libraries included -lCstd -lCrun -lm -lw -lcx -lc+
-library=iostream+ - libraries included -liostream -lCstd -lCrun -lm -lw -lcx -lc+
-library=iostream,no%Crun+ - libraries included -liostream -lCstd -lm -lw -lcx -lc+
-library=stlport4+ - libraries included -lstlport4 -lCrun -lm -lw -lcx -lc+
-library=iostream,no%Cstd+ - Invalid combination, some header files missing [[ *iostream, sstream* ]]
When we try to make a new project, which of the following is recommended?
#! - Use libCstd suppplied along with solaris package.
When solaris makes a new release, is it always guaranteed that project is compatible with new libCstd ? (Is there a backward compatibility?)
The STL components which can be used in the project are limited. i.e we can use only those that come along with libCstd.....right?
Might not be compatible with other c++ compilers. ( Not compatible with g++ ) Right?
#2 - Use libCStd along with libiostream
Can we use STL (supported by libCstd ) + Classic-iostreams and still have the backward-compatibility?
Compatible with other C++ compilers....provided care has been taken of the CC STL Specializations. ( Compatible with g++ ) Right?
#3 - Use stlport4. Is it stable and backward-compatible ?
We can exploit usage of STL to the maximum.
Is it guranteed that the project (using -library=stlport4 ) will be backward compatible ?
Can the SunStudio (ORACLE) organization gurantee that stlport will take care of the changes in the CPP standards ?
i.e Is it guranteed that STLPORT and SUN-STUDIO packages will always be in sync?
Among the above three which is preferred method to go ensuring stability and backward-compatibility.
Thanks in advance.
Cheers,
Sreekar
Edited by: 855323 on 20-Oct-2011 04:04
Edited by: 855323 on 20-Oct-2011 04:04
Edited by: 855323 on 20-Oct-2011 04:06In general, you don't need any options to use the C++ Standard Library (which includes what is sometimes loosely called the "STL"). Consider this toy program:
// file vec.cc
#include <vector>
#include <iostream>
int main()
std::vector<int> vi(10);
vi[1] = 1;
std::cout << "vi[1]=" << vi[1] << '\n';
}You can compile and run the program as either
CC vec.cc && a.out
g++ vec.cc && a.outWith CC, by default you get the original libCstd. You use the -library option to select STLport or (on or selected versions of Solaris) Apache stdcxx instead. With g++, you just get the g++ library libstdc++, which should be suitable for all purposes.
For a discussion of which library to select with CC, see this thread:
Differnce between LibCstd and LibStlport
The optional libiostream is provided to provide support for programs written for the very old version of iostreams that was provided with the original AT&T Cfront compiler in the 1980's and early 1990's. There is usually no reason to use this obsolete library with code written after 1998.
The Solaris libCstd.so.1 (and libCrun.so.1) is always compatible with various releases of Studio, with one caveat: Each Studio release specifies the minimum patch level of Solaris libraries that is required to run programs created by the compiler. Any newer version of the library is guaranteed to be compatible. Thus, it is always safe to update the library, and an update might be required when using binaries created by a newer compiler.
A version of the STLport library ships with the compiler. C++ binaries created by an older compiler that link to libstlport.so.1 should still work when linked into a program created by a newer compiler. Use of the static libstlport.a is generally not safe when mixing binary code from different compiler releases.
Binaries created by Studio CC in default mode are not compatible with binaries created by g++. Even if you can get a program to link, which is doubtful, the program is not likely to run correctly.
Studio CC does provide a g++ compatibility mode as follows:
On supported versions of Linux with Studio 12.2 (C++ 5.11).
On Solaris/x86 and supported versions of Linux with Studio 12.3 (C++ 5.12).
In this mode, CC uses the g++ headers and the g++ runtime libraries.
Refer to the -compat=g option in the C++ Users Guide for details.
We plan to support the new C++ Standard, C++11, in a future compiler release. Because the ABI (binary interface) used by the current compilers is not adequate to support all the new features in C++11, we expect binaries built in C++11 mode to be incompatible with binaries created by earlier compilers. None of the existing C++ support libraries will be used in C++11 mode. A new library that provides full C++11 support will be used instead. We expect the new compiler to continue to provide the current C++03 mode as an option, being source and binary compatible with our earlier compilers.
Edited by: Steve_Clamage on Oct 20, 2011 10:00 AM
Edited by: Steve_Clamage on Oct 20, 2011 1:29 PM -
Please increase the call log history !! Its really important
Increasing the call log would add a great benifit to the iphone,
You can add this feature as an option, and it can be used if needed.
Thank youYou can provide feed back to Apple's engineering department, by going to www.apple.com/feedback.
-
Help/Info regarding the CL rating of RAM upgrades.
I'm upgrading my Early 2011 Macbook Pro 17 to 8GB Ram and I'm curious if anyone can offer advise regarding the CL rating. All the DDR3 1333GHz SODIMM kits have a CL9 rating. Is this a higher latency than the 4GB of ram that I have already? If so, will more latency actually do more harm than good??
Pardon me if I sound like a noob!
I'm running a stock MBP 17 8,1 2.2GHz i7 with Windows 7 Pro Bootcamp. (Windows & + Zone Alarm = 50% RAM usage when using Excel, UGH!)No, CL9 is a standard. I have the same model and put 8G from Omni Technologies in mine. It screams!
17" 2.2GHz i7 Quad-Core MacBook Pro 8G RAM 750G HD + OCZ Vertex 3 SSD Boot HD
Maybe you are looking for
-
Share button not working in Safari 8.0
I've just upgraded my iMac to Yosemite, but neither the Share button nor the share item in the menu are working in Safari 8.0. I'm pretty sure the problem has something to do with the Extensions in my System Preferences, since the share button is wor
-
Anybody at NAMM care to report on the new MC controller, i.e. touch and feel?
-
Increasing percentage formula, rounding up in Numbers '09
Having a hard time with numbers formulas... I need to increase a sum by 9%, rounding up. I have this formula: =roundup(81.09,0) but I know I am missing something. Anyone? Bueller? Thanks so much!! **blip**
-
Lead Columns - editing the head data
Hi, I have Cost center in the lead columns and I have to display both the Key and Name. On the layout only the column where key appears has the head data as Cost center the column where the name appreas has blank head data. I want to edit that to sho
-
IPad mini Wi-Fi + cellular 64GB Black
My iPad mini doesn't recharge when I plug it into my computer, in the top right corner it sais "NOT CHARGING" can anyone help me with this?