Help - how to get 2 inputs

hi, i am creating this basic program/game. i need to get two inputs from the user. the problem is when i run the program it gets the first input from the user but then doesn't get the second input.. please help, the code is as follows:
public class game
public static void main(String[] args)
char rock = 'r';
char paper = 'p';
char sciccsors = 's';
do
System.out.println("Player 1 please enter a letter");
char c1 = SavitchIn.readChar();
System.out.println("Player 2 please enter a letter");
char c2 = SavitchIn.readChar();
winnercalculation(c1,c1);
game.winnercalculation(c1,c2);
} while (quitoption());
public static void winnercalculation(char c1, char c2)
char rock = 'r';
char paper = 'p';
char sciccsors = 's';
if ((c1 == rock) && (c2 == paper))
System.out.println("Player 2 Wins");
private static boolean quitoption()
System.out.print("Would you like to repeat this program?");
System.out.println(" (y for yes or n for no)");
char answer = SavitchIn.readLineNonwhiteChar();
return ((answer == 'y') || (answer == 'Y'));
thanks for your help
alex
(i will reply to this post with the code required to make the SavitchIn.readline thing work.

this is the code required for the SavitchIn read- copy the below code and save it as SavitchIn.java:
import java.io.*;
import java.util.*;
*Class for simple console input.
*A class designed primarily for simple keyboard input of the form
*one input value per line. If the user enters an improper input,
*i.e., an input of the wrong type or a blank line, then the user
*is prompted to reenter the input and given a brief explanation
*of what is required. Also includes some additional methods to
*input single numbers, words, and characters, without going to
*the next line.
public class SavitchIn
*Reads a line of text and returns that line as a String value.
*The end of a line must be indicated either by a new-line
*character '\n' or by a carriage return '\r' followed by a
*new-line character '\n'. (Almost all systems do this
*automatically. So, you need not worry about this detail.)
*Neither the '\n', nor the '\r' if present, are part of the
*string returned. This will read the rest of a line if the
*line is already partially read.
public static String readLine()
char nextChar;
String result = "";
boolean done = false;
while (!done)
nextChar = readChar();
if (nextChar == '\n')
done = true;
else if (nextChar == '\r')
//Do nothing.
//Next loop iteration will detect '\n'
else
result = result + nextChar;
return result;
*Reads the first string of nonwhite characters on a line and
*returns that string. The rest of the line is discarded. If
*the line contains only white space, then the user is asked
*to reenter the line.
public static String readLineWord()
String inputString = null,
result = null;
boolean done = false;
while(!done)
inputString = readLine();
StringTokenizer wordSource =
new StringTokenizer(inputString);
if (wordSource.hasMoreTokens())
result = wordSource.nextToken();
done = true;
else
System.out.println(
"Your input is not correct. Your input must");
System.out.println(
"contain at least one nonwhitespace character.");
System.out.println(
"Please, try again. Enter input:");
return result;
*Precondition: The user has entered a number of type int on
*a line by itself, except that there may be white space before
*and/or after the number.
*Action: Reads and returns the number as a value of type int.
*The rest of the line is discarded. If the input is not
*entered correctly, then in most cases, the user will be
*asked to reenter the input. In particular, this applies to
*incorrect number formats and blank lines.
public static int readLineInt()
String inputString = null;
int number = -9999;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Integer.parseInt(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be");
System.out.println("a whole number written as an");
System.out.println("ordinary numeral, such as 42");
System.out.println("Minus signs are OK,"
+ "but do not use a plus sign.");
System.out.println("Please, try again.");
System.out.println("Enter a whole number:");
return number;
*Precondition: The user has entered a number of type long on
*a line by itself, except that there may be white space
*before and/or after the number.
*Action: Reads and returns the number as a value of type
*long. The rest of the line is discarded. If the input is not
*entered correctly, then in most cases, the user will be asked
*to reenter the input. In particular, this applies to
*incorrect number formats and blank lines.
public static long readLineLong()
String inputString = null;
long number = -9999;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Long.parseLong(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be");
System.out.println("a whole number written as an");
System.out.println("ordinary numeral, such as 42");
System.out.println("Minus signs are OK,"
+ "but do not use a plus sign.");
System.out.println("Please, try again.");
System.out.println("Enter a whole number:");
return number;
*Precondition: The user has entered a number of type double
*on a line by itself, except that there may be white space
*before and/or after the number.
*Action: Reads and returns the number as a value of type
*double. The rest of the line is discarded. If the input is
*not entered correctly, then in most cases, the user will be
*asked to reenter the input. In particular, this applies to
*incorrect number formats and blank lines.
public static double readLineDouble()
String inputString = null;
double number = -9999;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Double.parseDouble(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be");
System.out.println("an ordinary number either with");
System.out.println("or without a decimal point,");
System.out.println("such as 42 or 9.99");
System.out.println("Please, try again.");
System.out.println("Enter the number:");
return number;
*Precondition: The user has entered a number of type float
*on a line by itself, except that there may be white space
*before and/or after the number.
*Action: Reads and returns the number as a value of type
*float. The rest of the line is discarded. If the input is
*not entered correctly, then in most cases, the user will
*be asked to reenter the input. In particular,
*this applies to incorrect number formats and blank lines.
public static float readLineFloat()
String inputString = null;
float number = -9999;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Float.parseFloat(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be");
System.out.println("an ordinary number either with");
System.out.println("or without a decimal point,");
System.out.println("such as 42 or 9.99");
System.out.println("Please, try again.");
System.out.println("Enter the number:");
return number;
*Reads the first nonwhite character on a line and returns
*that character. The rest of the line is discarded. If the
*line contains only white space, then the user is asked to
*reenter the line.
public static char readLineNonwhiteChar()
boolean done = false;
String inputString = null;
char nonWhite = ' ';//To keep the compiler happy.
while (! done)
inputString = readLine();
inputString = inputString.trim();
if (inputString.length() == 0)
System.out.println(
"Your input is not correct.");
System.out.println("Your input must contain at");
System.out.println(
"least one nonwhitespace character.");
System.out.println("Please, try again.");
System.out.println("Enter input:");
else
nonWhite = (inputString.charAt(0));
done = true;
return nonWhite;
*Input should consist of a single word on a line, possibly
*surrounded by white space. The line is read and discarded.
*If the input word is "true" or "t", then true is returned.
*If the input word is "false" or "f", then false is returned.
*Uppercase and lowercase letters are considered equal. If the
*user enters anything else (e.g., multiple words or different
*words), then the user is asked to reenter the input.
public static boolean readLineBoolean()
boolean done = false;
String inputString = null;
boolean result = false;//To keep the compiler happy.
while (! done)
inputString = readLine();
inputString = inputString.trim();
if (inputString.equalsIgnoreCase("true")
|| inputString.equalsIgnoreCase("t"))
result = true;
done = true;
else if (inputString.equalsIgnoreCase("false")
|| inputString.equalsIgnoreCase("f"))
result = false;
done = true;
else
System.out.println(
"Your input number is not correct.");
System.out.println("Your input must be");
System.out.println("one of the following:");
System.out.println("the word true,");
System.out.println("the word false,");
System.out.println("the letter T,");
System.out.println("or the letter F.");
System.out.println("You may use either upper-");
System.out.println("or lowercase letters.");
System.out.println("Please, try again.");
System.out.println("Enter input:");
return result;
*Reads the next input character and returns that character. The
*next read takes place on the same line where this one left off.
public static char readChar()
int charAsInt = -1; //To keep the compiler happy
try
charAsInt = System.in.read();
catch(IOException e)
System.out.println(e.getMessage());
System.out.println("Fatal error. Ending Program.");
System.exit(0);
return (char)charAsInt;
*Reads the next nonwhite input character and returns that
*character. The next read takes place immediately after
*the character read.
public static char readNonwhiteChar()
char next;
next = readChar();
while (Character.isWhitespace(next))
next = readChar();
return next;
*The following methods are not used in the text, except for
*a brief reference in Chapter 2. No program code uses them.
*However, some programmers may want to use them.
*Precondition: The next input in the stream consists of an
*int value, possibly preceded by white space, but definitely
*followed by white space.
*Action: Reads the first string of nonwhite characters
*and returns the int value it represents. Discards the first
*whitespace character after the word. The next read takes
*place immediately after the discarded whitespace.
*In particular, if the word is at the end of a line, the
*next reading will take place starting on the next line.
*If the next word does not represent an int value,
*a NumberFormatException is thrown.
public static int readInt() throws NumberFormatException
String inputString = null;
inputString = readWord();
return Integer.parseInt(inputString);
*Precondition: The next input consists of a long value,
*possibly preceded by white space, but definitely
*followed by white space.
*Action: Reads the first string of nonwhite characters and
*returns the long value it represents. Discards the first
*whitespace character after the string read. The next read
*takes place immediately after the discarded whitespace.
*In particular, if the string read is at the end of a line,
*the next reading will take place starting on the next line.
*If the next word does not represent a long value,
*a NumberFormatException is thrown.
public static long readLong()
throws NumberFormatException
String inputString = null;
inputString = readWord();
return Long.parseLong(inputString);
*Precondition: The next input consists of a double value,
*possibly preceded by white space, but definitely
*followed by white space.
*Action: Reads the first string of nonwhitespace characters
*and returns the double value it represents. Discards the
*first whitespace character after the string read. The next
*read takes place immediately after the discarded whitespace.
*In particular, if the string read is at the end of a line,
*the next reading will take place starting on the next line.
*If the next word does not represent a double value,
*a NumberFormatException is thrown.
public static double readDouble()
throws NumberFormatException
String inputString = null;
inputString = readWord();
return Double.parseDouble(inputString);
*Precondition: The next input consists of a float value,
*possibly preceded by white space, but definitely
*followed by white space.
*Action: Reads the first string of nonwhite characters and
*returns the float value it represents. Discards the first
*whitespace character after the string read. The next read
*takes place immediately after the discarded whitespace.
*In particular, if the string read is at the end of a line,
*the next reading will take place starting on the next line.
*If the next word does not represent a float value,
*a NumberFormatException is thrown.
public static float readFloat()
throws NumberFormatException
String inputString = null;
inputString = readWord();
return Float.parseFloat(inputString);
*Reads the first string of nonwhite characters and returns
*that string. Discards the first whitespace character after
*the string read. The next read takes place immediately after
*the discarded whitespace. In particular, if the string
*read is at the end of a line, the next reading will take
*place starting on the next line. Note, that if it receives
*blank lines, it will wait until it gets a nonwhitespace
*character.
public static String readWord()
String result = "";
char next;
next = readChar();
while (Character.isWhitespace(next))
next = readChar();
while (!(Character.isWhitespace(next)))
result = result + next;
next = readChar();
if (next == '\r')
next = readChar();
if (next != '\n')
System.out.println(
"Fatal Error in method readWord of class SavitchIn.");
System.exit(1);
return result;
*Precondition: The user has entered a number of type byte on
*a line by itself, except that there may be white space before
*and/or after the number.
*Action: Reads and returns the number as a value of type byte.
*The rest of the line is discarded. If the input is not
*entered correctly, then in most cases, the user will be
*asked to reenter the input. In particular, this applies to
*incorrect number formats and blank lines.
public static byte readLineByte()
String inputString = null;
byte number = -123;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Byte.parseByte(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be a");
System.out.println("whole number in the range");
System.out.println("-128 to 127, written as");
System.out.println("an ordinary numeral, such as 42.");
System.out.println("Minus signs are OK,"
+ "but do not use a plus sign.");
System.out.println("Please, try again.");
System.out.println("Enter a whole number:");
return number;
*Precondition: The user has entered a number of type short on
*a line by itself, except that there may be white space before
*and/or after the number.
*Action: Reads and returns the number as a value of type short.
*The rest of the line is discarded. If the input is not
*entered correctly, then in most cases, the user will be
*asked to reenter the input. In particular, this applies to
*incorrect number formats and blank lines.
public static short readLineShort()
String inputString = null;
short number = -9999;//To keep the compiler happy.
//Designed to look like a garbage value.
boolean done = false;
while (! done)
try
inputString = readLine();
inputString = inputString.trim();
number = Short.parseShort(inputString);
done = true;
catch (NumberFormatException e)
System.out.println(
"Your input number is not correct.");
System.out.println("Your input number must be a");
System.out.println("whole number in the range");
System.out.println("-32768 to 32767, written as");
System.out.println("an ordinary numeral, such as 42.");
System.out.println("Minus signs are OK,"
+ "but do not use a plus sign.");
System.out.println("Please, try again.");
System.out.println("Enter a whole number:");
return number;
public static byte readByte() throws NumberFormatException
String inputString = null;
inputString = readWord();
return Byte.parseByte(inputString);
public static short readShort() throws NumberFormatException
String inputString = null;
inputString = readWord();
return Short.parseShort(inputString);
//The following was intentionally not used in the code for
//other methods so that somebody reading the code could more
//quickly see what was being used.
*Reads the first byte in the input stream and returns that
*byte as an int. The next read takes place where this one
*left off. This read is the same as System.in.read(),
*except that it catches IOExceptions.
public static int read()
int result = -1; //To keep the compiler happy
try
result = System.in.read();
catch(IOException e)
System.out.println(e.getMessage());
System.out.println("Fatal error. Ending Program.");
System.exit(0);
return result;

Similar Messages

  • How to get Input-Ready Cell  Value of Input Ready Query?

    Hi,
    How to get input ready cell value in fox formula?
    for example :
    In Input-Ready Query,
    C_Code Month        Psale(input ready)
    1000          05.2012       800
    now i want Psale 800 in fox formua before value save in cube,
    is it possible?
    Thanks
    Ravi

    Hi,
    as I understand your requirement: you want to execute a planning function before 'save'. This possible, cf. note 1356805
    for more details.
    Regards,
    Gregor

  • Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?

    Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?
    I'm developing an application where a file is need to be saved as pdf. But, if there is already a pdf file with same name in the specified directory, I wish to overwrite it. And in the overwrite case, read-only files should not be overwritten. If the duplicate(old) file is opened in windows (Win7) explorer preview, it is write protected. So, it should not be overwritten. I tried to get the '
    FILE_ATTRIBUTE_READONLY' using MS API 'GetFileAttributes', but it didn't succeed. How Adobe marks the file as read-only for preview? Do I need to check some other attribute of the file?
    Thanks!

    Divya - I have done it in the past following these documents. Please read it and try it it will work.
    Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement) 
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true
    thanks!
    Jason PV

  • Hi, I have this green mark (with pointing arrow looks like a link) on some words show on my window screen when I open a web page, I wonder if it is a virus link or such. Need help how to get rid of it. Thanks

    Hi, I have this green mark (with pointing arrow looks like a link) on some words show on my window screen when I open a web page, I wonder if it is a virus link or such. Need help how to get rid of it. Here's the example:
    WING
    GAMES
    MAJORITY
    Thanks

    If the third link you posted (the link containing the word "majority") does not look like the following then you inadvertently installed adware.
    That particular page should resemble the following:
    The word "majority" in the third paragraph should not be a link and should not have the green icon associated with it.
    To learn how this may have occurred, and how to prevent it from occurring in the future, read How to install adware
    Most so-called "news" websites are nothing more than entertainment outlets that cater to prurient interests, and contain advertisements that leave the user about three clicks away from installing junk. If you decide to frequent those websites, Safari's "Reader" feature helps minimize that exposure.
    Try it:

  • Need Help-How Store the input parameter through java bean

    Hello Sir,
    I have a simple Issue but It is not resolve by me i.e input parameter
    are not store in Ms-Access.
    I store the input parameter through Standard Action <jsp:useBean>.
    jsp:useBean call a property IssueData. this property exist in
    SimpleBean which create a connection from DB and insert the data.
    At run time servlet and server also show that loggging are saved in DB.
    But when I open the table in Access. Its empty.
    Ms-Access have two fields- User, Password both are text type.
    Please review these code:
    login.html:
    <html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>LoginServlet.java:
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String user=request.getParameter("user");
    String pass=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setUserName(user);
    st.setPassword(pass);
    request.setAttribute("user",st);
    request.setAttribute("pass",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }SimpleBean.java:
    package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String user="";
    private String pass="";
    private String s="";
    public String getUserName() {
    return user;
    public void setUserName(String user) {
    this.user = user;
    public String getPassword() {
    return pass;
    public void setPassword(String pass) {
    this.pass = pass;
    public String getIssueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getUserName();
    getPassword();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:simple");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUserName();
    st.setString(1,User);
    String Password=getPassword();
    st.setString(2,Password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s=  "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }submit.jsp:
    This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:getProperty name="st" property="IssueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>issue.jsp</jsp-file>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Please Help me..Thanks.!!!
    --

    Dear Sir,
    Same issue is still persist. Input parameter are not store in database.
    After follow your suggestion when I run this program browser show that:i.e
    This is Submit page Hello Student Name: vijay
    Password: kumar
    <jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
    Please review my code.
    login.html:
    {code}<html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>{code}
    LoginServlet.java:
    {code}import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String userValue=request.getParameter("user");
    String passValue=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setuserName(userValue);
    st.setpassword(passValue);
    request.setAttribute("userValue",st);
    request.setAttribute("passValue",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }{code}
    SimpleBean.java:
    {code}package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String userValue="";
    private String passValue="";
    private String s="";
    public String getuserName() {
    return userValue;
    public void setuserName(String userValue) {
    this.userValue = userValue;
    public String getpassword() {
    return passValue;
    public void setpassword(String passValue) {
    this.passValue= passValue ;
    public String getissueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getuserName();
    getpassword();
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Connection loaded");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
    System.out.println("Connection created");
    PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String userName=getuserName();
    st.setString(1,userName);
    String password=getpassword();
    st.setString(2,password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s= "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }{code}
    submit.jsp:
    {code}This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:setProperty name="st" property="userName" value="userValue/>
    <jsp:setProperty name="st" property="password" value="passValue"/>
    <jsp:getProperty name="st" property="issueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
    Please help me...How store th input parameter in Database through Java Bean                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get input from card reader

    hi, everyone,
    I have a project, which needs me to get input from card reader. My terminal input is IBM POS system, but it didnot provide the API to get the input. How can I get the input? Need your help so much! and thanks a lot

    Now this is a wild idea.... how about searching the IBM site for technical information ?

  • JComboBox    How to get input from JComboBox

    Hi all.
    I have a JComboBox called combobox.
    User can choose one string out of 5 using this JComboBox.
    Whenever the user press a button, I'd like to get an input through this combobox using actionListener.
    How can I get input through JComboBox?
    combobox.getValue() ???
    I appreciate your help !

    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html
    Object getSelectedItem()

  • How to Get Input from Command Prompt?

    How can i get input from command prompt like
    C:\
    or linux ?
    (Here's what I use now)
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String line;
    Whlie((line=in.readLine())!= null)
    { System.out.prinln( line) ; }
    IS THERE A BETTER WAY?

    The main method within a java class accepts command line input through a String array.
    In this example args is the String array. You can access the parameters as args[0] for the first parameter, args[1] for the second parameter, etc....
    The usage for the example below would be :
    c:\EDIFormat file1 file2
    Where args[0] would equal file1 and args[1] would equal file2.
    public class EDIFormat {
    public static void main(String[] args) {
              if (args.length < 0) {
                   System.out.println("No Parameters supplied. Exiting....");
                   // open input and output files
                   EDIFiles(args[0], args[1]);
    Hope that helps!

  • How to get inputs of several JTextFields?

    Hi all,
    I'm writing an application which prompt the user to enter "Customer Information" such as Customer, Name and Tel. I need to use JTextField for these inputs but I don't know how to get the input values. I found some sample code for only input ONE JTextField so I don't know how to apply it for more than one JTextField. Below is part of my coding. What should be add in the "actionPerformed" part to get the inputs? Would anyone help?
    class CustFrame extends JFrame implements ActionListener
    JButton save, cancel;
    JLabel text1, text2, text3;
    JTextField cust_number, name, tel;
    text1 = new JLabel ("Customer Number: ");
    text2 = new JLabel ("Name: ");
    text3 = new JLabel ("Tel: ");
    cust_number = new JTextField (8);
    cust_number.addActionListener (this);
    name = new JTextField (20);
    name.addActionListener (this);
    tel = new JTextField (30);
    tel.addActionListener (this);
    save = new JButton ("Save");
    cancel = new JButton ("Cancel");
    public void actionPerformed (ActionEvent e)
    if (e.getSource()==save)
    else if (e.getSource()==cancel)

    public void actionPerformed (ActionEvent e)
    if (e.getSource()==save){
    innumber = cust_number.getText();
    inname = name.getText();
    intel = tel.getText();
    }.....

  • How to get input from keyboard scanner into an array

    This is probably a very basic question but I'm very new to java..
    My task is to reverse a string of five digits which have been entered using keyboard scanner.
    E.g. - Entered number - 45896
    Output - 69854
    I used the StringBuffer(inputString).reverse() command for this, but i need a more basic method to do this.
    I thought of defining an array of 5
    int[] array = new int [5];
    and then using,
    Scanner scan = new Scanner(System.in);
    to enter the numbers. But I can't figure out how to get the five input numbers into the array.
    If I can do this I can print the array in reverse order to get my result.
    Any other simple method is also welcome.

    Hey thanks for the quick reply,
    But how can I assign the whole five digit number into the array at once without asking to enter numbers separately?
    E.g. - if entered number is 65789
    Assign digits into positions,
    anArray [0] = 6;
    anArray [1] = 5;
    anArray [2] = 7;
    anArray [3] = 8;
    anArray [4] = 9;
    I'm really sorry but I am very new to the whole subject.

  • Help:how to get content of the word(.doc) attachment in a email

    help to all:
    I get the email attachment(.doc or .xls) and it's
    content,using javaMail Api .but output it on the
    computer screen,I see only some sign unreadable.
    Pls how to get the content.
    thanks for you.
    bi tan

    Save the output to a file and open it in Word/Excel thats what documents attached to mail are made for...
    If you really need the contents send them in the body or in a plain text attachment.

  • Help , How to get data from database using recordset with UI API

    I want to get a data from database
    when I want to create recordset i notice that UI API didn't has record set
    so I created recordset using DI API (SAPbobscom.recordset and SAPbobscom.company)
    ======================================================
    Dim oCompanyUI As SAPbouiCOM.Company <<UI API
    Dim oRecSet As New SAPbobsCOM.Recordset << DI API
    Dim oCompanyDI As New SAPbobsCOM.Company << DI API
    '=====================================================
    oCompanyDI.Connect
    Set oRecSet = oCompanyDI.GetBusinessObject(BoRecordset)
    oRecSet.DoQuery ("SELECT T0.CardCode, T0.CardName FROM OCRD T0")
    SBO_Application.MessageBox oRecSet.Fields.Item(1).Value
    ======================================================
    but I got an error it said "you are not connected to company"
    I'm really don't have an idea about how to get a data from using UI API (exp I want to get a date or costumer code)
    can someone help me please, I really need it
    Thanks

    you need a single sign on
            Dim oDICompany As SAPbobsCOM.Company
            Dim sCookie As String
            Dim sConnStr As String
            Dim ret As Integer
            oDICompany = New SAPbobsCOM.Company
            sCookie = oDICompany.GetContextCookie
            sConnStr = SBO_Application.Company.GetConnectionContext(sCookie)
            If oDICompany.Connected Then
                oDICompany.Disconnect()
            End If
            ret = oDICompany.SetSboLoginContext(sConnStr)
            If Not ret = 0 Then
                SBO_Application.MessageBox("set Login Context failed!")
                Exit Sub
            End If
            ret = oDICompany.Connect()
            If Not ret = 0 Then
                SBO_Application.MessageBox("Company Connect failed!")
            End If

  • Help: how  to get text from IFRAME

    <!-- The box where we type-->
    <IFRAME class="mytext" width="100%" ID="mytext" height="200">
    </IFRAME>
    someone can tell me how i get text in my servlet from
    <IFRAME>
    thankx in advance...

    someone can tell me how i get text in my servlet from
    <IFRAME>
    thankx in advance...Hmm. I think you are mixing something up here. Why would you use an IFrame for entering text? IFrame is used for including content from different HTML-pages inside your page.
    If you want to have a textbox for an user to enter text into and submit it to a server, you need a form and a textarea inside that. Like this:
    <form action="myServlet" method="post">
    <textarea name="myArea">
    </textarea>
    <input type="Submit" value="Ok">
    </form>Change the action in the form to reflect the mapping to your servlet.
    Then you can just do a String enteredText = request.getParameter( "myArea" ); inside your servlet.
    If you insist that you need to use an IFrame, I guess the only way to do it would be to write a Javascript function, that copies the contents from the IFrame to a hidden field before the page is submitted to your servlet. In your servlet you would read the value from the hidden field.
    .P.

  • Help:  How to get rid of the default None from Radio buttons?

    Hi, I searched the forum and found a work around for inputSelect. It seemed it does not work for Radio buttons, i.e., inputSelectGroup with multiple=false.
    Please anyone help us to get rid of the none choice for gender among female and male. Thank you very much in advance.
    ZD

    The 'none' choice is automatically displayed for fields that allow nulls.

  • Help: How to get the enddate as February28 or january 31

    Hello Folks,
    Am trying to get the data 2 months prior. So i was wondering how to get the enddate as 02/28/2010 or 01/31/2010.
    Thanks a lot
    Edited by: user11961230 on Apr 21, 2010 11:50 AM

    SQL> SELECT TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-2)),'DDMONTHYYYY') dates FROM DUAL;
    DATES
    28FEBRUARY 2010
    SQL> SELECT TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-2)),'MONTHYYYY') dates FROM DUAL;
    DATES
    FEBRUARY 2010
    SQL> SELECT TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-3)),'DDMONTHYYYY') dates FROM DUAL;
    DATES
    31JANUARY  2010
    SQL> SELECT TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-3)),'MONTHYYYY') dates FROM DUAL;
    DATES
    JANUARY  2010
    SQL>

Maybe you are looking for

  • Domains and Logical Types in Data Modeler

    Been out of serious design work for a long time. Can someone provide a good pointer to descriptions on Domains and Logical Types and presented in the Data Modeling tool? For instance I am having trouble tracking the following distinctions: Domain Log

  • Recovering changes made in develop

    I just finished editing 458 dng files in develop. I had not saved metadata to original files on disc. I selected all pictures to do a slideshow and review all changes. After exiting the slideshow, I saw a photo I wanted deleted but inadvertantly sent

  • Making Current Values Default While VI is Running

    Is there a way to 'make the current values default' while a VI is running?

  • ERROR occured when update the ""Rescue and Recovery 4.2"".....​.

    dear all, i'm a newbie with the TP notebook, and i'm a chinese , sorry for my POOR english !! hope you all will understand what i explain now...... i just buy a T61 last nite, but when i try to "UPDATE" my system, two error message shown to me.......

  • Dvd import

    have dvd content with no macro protection that i own and am trying to import using mpeg streamclip into fcp....my fcp is set up for dv ntsc so i made the mpeg files export in dv format..it does work but i have to render....is there any way to do this