String to SY-UNAME

hi all,
I'm new to Java WD. As my scenario, i implement GetSAPUser() then i already get a USER NAME. Firstly, i convert the user name to String. After that, i want to call bapi which imports SY-UNAME to SAP. In other word, from userName(type String) to sy-uame (type Syuname).
Please help me to figure out the solution.
Thanks a million in advance.
Peerasit

Hi,
Could you please clarify the type of the input used in the Function module specified?
If that is String you can pass without any typecasting otherwise typecast is needed.
Kind regards,
Saravanan K

Similar Messages

  • Compose a String with sy-uname

    I have a String 'PerNr=', and now i will compose this string with sy-uname so that it look like PerNr=123. But it may be only one variable.
    Can someone help me?

    hi,
    chk this.
    <b>CONCATENATE 'PERNR .' sy-uname INTO fs_text SEPARATED BY ' '</b>
    rgds
    anver
    if hlped mark points

  • I am trying to use java  file as Model layer and jsf as presentation layer

    I am trying to use java file as Model layer and jsf as presentation layer and need some help
    I successfully get the value of h:outputText from java file by doing simple binding operation but I am facing problems when I am trying to fill h:dataTable
    I create java file
    package oracle.model;
    import java.sql.;*
    import java.util.;*
    *public class TableBean {*
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    *public List getperInfoAll() {*
    perInfoAll.add(0,new perInfo("name","username","blablabla"));
    return perInfoAll;
    *public class perInfo {*
    String uname;
    String firstName;
    String lastName;
    *public perInfo(String firstName,String lastName,String uname) {*
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    *public String getUname() {*
    return uname;
    *public String getFirstName() {*
    return firstName;
    *public String getLastName() {*
    return lastName;
    right click on the file and choose 'create data control'
    then i wrote the jsf file:
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<f:view>*
    *<h:dataTable id="dt1" value="#{bindings.perInfoAll}"*
    var="item" bgcolor="#F1F1F1" border="10"
    cellpadding="5" cellspacing="3" rows="4" width="50%"
    dir="LTR" frame="hsides" rules="all"
    *>*
    *<f:facet name="header">*
    *<h:outputText value="This is 'dataTable' demo" id="ot6"/>*
    *</f:facet>*
    *<h:column id="c2">*
    *<f:facet name="header">*
    *<h:outputText value="First Name" id="ot1"/>*
    *</f:facet>*
    *<h:outputText style="" value="#{item.firstName}"*
    id="ot2"/>
    *</h:column>*
    *<h:column id="c4">*
    *<f:facet name="header">*
    *<h:outputText value="Last Name" id="ot9"/>*
    *</f:facet>*
    *<h:outputText value="#{item.lastName}" id="ot8"/>*
    *</h:column>*
    *<h:column id="c3">*
    *<f:facet name="header">*
    *<h:outputText value="Username" id="ot7"/>*
    *</f:facet>*
    *<h:outputText value="#{item.uname}" id="ot4"/>*
    *</h:column>*
    *<f:facet name="footer">*
    *<h:outputText value="The End" id="ot3"/>*
    *</f:facet>*
    *</h:dataTable>*
    *</center>*
    *</af:document>*
    *</f:view>*
    but nothing is appear in my table
    I know that there is something wrong in calling the binding object
    I need help pls and where can i find some help to deal with another tag types
    thanks

    i dragged the "perInfoAll" from my "Data Controls" and choosed adf table (even I know that new table with adf tags well be generated and i want table with jsf tags)
    and this code is generated
    *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"*
    *"http://www.w3.org/TR/html4/loose.dtd">*
    *<%@ page contentType="text/html;charset=UTF-8"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>*
    *<f:view>*
    *<af:document id="d1">*
    *<af:messages id="m1"/>*
    *<af:form id="f1">*
    *<af:table value="#{bindings.perInfoAll1.collectionModel}" var="row"*
    *rows="#{bindings.perInfoAll1.rangeSize}"*
    *emptyText="#{bindings.perInfoAll1.viewable ? 'No data to display.' : 'Access Denied.'}"*
    *fetchSize="#{bindings.perInfoAll1.rangeSize}"*
    *rowBandingInterval="0"*
    *selectionListener="#{bindings.perInfoAll1.collectionModel.makeCurrent}"*
    *rowSelection="multiple" id="t1">*
    *<af:column sortProperty="uname" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.uname.label}"*
    *id="c1">*
    *<af:inputText value="#{row.bindings.uname.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.uname.label}"*
    *required="#{bindings.perInfoAll1.hints.uname.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.uname.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.uname.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.uname.tooltip}"*
    *id="it3">*
    *<f:validator binding="#{row.bindings.uname.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="firstName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.firstName.label}"*
    *id="c2">*
    *<af:inputText value="#{row.bindings.firstName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.firstName.label}"*
    *required="#{bindings.perInfoAll1.hints.firstName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.firstName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.firstName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.firstName.tooltip}"*
    *id="it2">*
    *<f:validator binding="#{row.bindings.firstName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="lastName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.lastName.label}"*
    *id="c3">*
    *<af:inputText value="#{row.bindings.lastName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.lastName.label}"*
    *required="#{bindings.perInfoAll1.hints.lastName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.lastName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.lastName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.lastName.tooltip}"*
    *id="it1">*
    *<f:validator binding="#{row.bindings.lastName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *</af:table>*
    *</af:form>*
    *</af:document>*
    *</f:view>*
    but when run it i see the following errors
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    :(

  • Problem with Long and BigDecimal DataType convertion

    HI,
    I have an application which talk to MySQL database with Spring JDBC layer and everything runs like a champ :)
    Now I am converting the same application with the same DAO implementation to communicate with oracle database and I am having some trouble converting DataType from database to my java code.
    For example before with MySQL I would convert any Integer coming from the database to Long datatype and it worked. Now it seems that Int datatype from oracle comes as a BigDecimal type.
    I am thinking about two approaches writing an additional implementation to implement my dao interfaces or if there is some trickery that I can bypass doing that and work around these datatype incompatibility from MYSQL to Oracle.
    I can also put bunch of try and catch statements and if fails with Long try with BigDecimal, but still don't buy it as the best solution.
    Here use also code snippet:
    User u = new User();
                        u.setObjectId((Long) m.get("oid"));//This works with MYSQL backend but not with Oracle so the raw object seem to be coming as BigDecimal datatype
                        u.setLogon((String) m.get("logon"));
                        u.setPassword((String) m.get("password"));
                        u.setName((String) m.get("uname"));
                        u.setCompany(companyDAO.getById((Long) m.get("cOid")));Any help will be appreciated.
    Edited by: kminev on Mar 3, 2010 12:25 PM

    //This is my entity class
    public class User implements Comparable<User>  {
        private Long objectId = 0L;
        private Company company;
        private String logon = "";
        private String password = "";
        private String name = "";
        private boolean hasAdminRights=false;
        private boolean hasMaintenanceRights=false;
    //This is my bean class
    <bean id="userDAO" class=" com.myorg.myapp.dao.jdbc.UserImpl">
            <property name="transactionManager">
                <ref local="transactionManager"/>
            </property>
            <property name="companyDAO">
                <ref local="companyDAO"/>
            </property>
            <property name="companyAccessDAO">
                <ref local="companyAccessDAO"/>
            </property>
        </bean>

  • Plz help me ragarding Struts

    when i have given a request for http://localhost:7001/Finance/loginForm.jsp
    i am getting the following error:
    javax.servlet.jsp.JspException: No getter method for property Dbname of bean org.apache.struts.taglib.html.BEAN
    please tell me wat might be the reason for this
    thanking you

    i have defined getters method in the formbean class which extends ActionFrom
    This is code plz check it
    package com.innova.reports.forms;
    import javax.servlet.ServletRequest;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.taglib.html.*;
    public class LoginFormBean extends ActionForm {
         // --------------------------------------------------------- Instance Variables
         /** Pwd property */
         private String Pwd;
         /** Uname property */
         private String Uname;
         /** Server property */
         private String Server;
         /** Dbname property */
         private String Dbname;
         // --------------------------------------------------------- Methods
         * Method validate
         * @param mapping
         * @param request
         * @return ActionErrors
         public ActionErrors validate(
              ActionMapping mapping,
              HttpServletRequest request) {
              // TODO Auto-generated method stub
              return null;
         * Method reset
         * @param mapping
         * @param request
         public void reset(ActionMapping mapping, HttpServletRequest request) {
              // TODO Auto-generated method stub
         * Method validate
         * @param mapping
         * @param request
         * @return ActionErrors
         * Returns the Pwd.
         * @return String
         public String getPwd() {
              return Pwd;
         * Set the Pwd.
         * @param Pwd The Pwd to set
         public void setPwd(String Pwd) {
              this.Pwd = Pwd;
         * Returns the Uname.
         * @return String
         public String getUname() {
              return Uname;
         * Set the Uname.
         * @param Uname The Uname to set
         public void setUname(String Uname) {
              this.Uname = Uname;
         * Returns the Server.
         * @return String
         public String getServer() {
              return Server;
         * Set the Server.
         * @param Server The Server to set
         public void setServer(String Server) {
              this.Server = Server;
         * Returns the Dbname.
         * @return String
         public String getDbname() {
              return Dbname;
         * Set the Dbname.
         * @param Dbname The Dbname to set
         public void setDbname(String Dbname) {
              this.Dbname = Dbname;
    struts-config.xml
    <struts-config>
    <data-sources />
    <form-beans >
    <form-bean name="UserLoginForm" type="com.innova.reports.forms.LoginFormBean" />
    </form-beans>
    <global-exceptions />
    <global-forwards />
    <action-mappings >
    <action
    attribute="UserLoginForm"
    input="/loginForm.jsp"
    name="UserLoginForm"
    path="/userLoginForm"
    scope="request"
    type="com.innova.reports.actions.LoginAction" />
    </action-mappings>
    <message-resources parameter="com.innova.reports.utils.ApplicationResources" />
    </struts-config>
    PLease go through i ahev given it but still its giving the same problem

  • Using predefined JDBC database connection in runtime for BC4J

    I've created an aplication using BC4J context, however I want to have several distinct users acessing this aplication, so I create the connection to the database using stantart JDBC 2.0, and now I want my application to use this connection instead of the one defined for BC4J.
    The database user owner of the objects must be locked.
    Is this possible?
    Many thanks.
    Nuno

    In Forms I used the following code to change the user at runtime. I created 3 char fields 'u','p' and 'c' for username, password and connect string respectively.
    declare
    uname varchar2(10);
    begin
    uname := get_application_property(username);
    -- To display your current username
    message(uname);
    pause;
    logout;
    logon(:u,:p&#0124; &#0124;'@'&#0124; &#0124;:c);
    end;
    Have a nice day,
    Abhijith Unnikannan,
    Oracle Support Services

  • Global variable to capture username with Form 6i

    Hi everyone,
    I have a menu created with Forms 6i and the shortcut that I use to call the menu has in its target the following: C:\orant\BIN\ifrun60.EXE userid=username/password MYFORM.FMX
    When I remove the username and password from the shortcut target it asks me for the username and password so when I typed, I am allowed to go into the application, but I want to be able to store the username on a global variable and put the value on a item when the user chooses the program that he or her wants to use, so they don't go to see other users information.
    Can anyone please help me to do this step by step?
    Thanks in advance!!

    user626836 wrote:
    Hi everyone,
    I have a menu created with Forms 6i and the shortcut that I use to call the menu has in its target the following: C:\orant\BIN\ifrun60.EXE userid=username/password MYFORM.FMX
    When I remove the username and password from the shortcut target it asks me for the username and password so when I typed, I am allowed to go into the application, but I want to be able to store the username on a global variable and put the value on a item when the user chooses the program that he or her wants to use, so they don't go to see other users information.
    Can anyone please help me to do this step by step?You can developed a form named Login_form
    Create On-Logon trigger at form level and provide the connection string like
    declare
             uname varchar2(10);
             pass  varchar2(10);
         begin
             uname := 'user_name';
             pass  :='password';
             logon(uname, pass||'@orcl');
         end;now call only this form at your target... like C:\orant\BIN\ifrun60.EXE login_form
    Hope this will help
    If someone's response is helpful or correct, please mark it accordingly.

  • User validation for the BSP application

    I wanted a user to access the bsp application.
    I already have the user names maintained in the database who will be using the application.
    i am using the application class for my application.
    where should i do the user validation and how.
    i know tst if i would had used the model class then i can do it in the request method of the model class.
    but where to do it when using the application class.
    Thanks

    Hi Din,
    I assume that the usernames that are present in your Database also exists in the WAS Server.
    i.e. The database has a part of users that are present in the WAS Server.
    Your need is to allow only those users in the database to access your bsp application and not others correct!
    If your first BSP Page is a ...
    <b>View</b>
    1.In the DO_INIT method of the Corresponding Controller Class populate the internal table that is present in the Application Class with the usernames that are present in the database.
    2. In the DO_REQUEST method of the Corresponding Controller Class check for the username who runs your BSP Application is present in the Database.
    You can get the username who run the bsp application using the system field...
    data: username type string.
    username = sy-uname.
    So if the <i>username</i> is in the database show your bsp page else show an error page.
    <b>You can directly check for the sy-uname is present in the database.</b>
    <b>Page with Flow Logic</b>
    It is same as MVC only thing is that method name changes...
    Place the code in the DO_INIT of MVC in onCreate of Page with Flow logic.(Populate the internal table of the application class with the usernames from the database)
    Place the code in the DO_REQUEST of MVC in onRequest of Page with Flow logic.(Check whether the sy-uname is present in the itab or directly in the database).
    Hope it solves your problem
    Regards,
    Maheswaran.B

  • Jsp database access using odbc - please help

    Hi friends,
    I�m trying a very simple database access program in jsp data base access using odbc. Odbc has to be used because thin driver or other drivers may not be available in every system of our college and as you know it's not that easy to make changes to those systems. My problem is so simple. I always get an exception in my program.
    My jsp content is as simple as:
    <%@ page import="java.lang.*,java.sql.*,java.io.*,registerbean" %>
    <jsp:useBean id="db" class="registerbean" scope="session"/>
    <%
    String str="insert into reg values('" + db.getName() + "','" + db.getUname() + "','" + db.getPass() + "'," + db.getAge() + ",'" + db.getSex() + "','" + db.getAdd() + "','" + db.getUgcourse() + "','" + db.getUgqual() + "'," + db.getPer() + ",'" + db.getIadd() + "')";
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:yogaesh","scott","tiger");
    Statement stmt=con.createStatement();
    stmt.executeUpdate(str);
    }catch(Exception e1){out.println(str);};
    %>
    the table reg has the structure:
    Name Null? Type
    CNAME VARCHAR2(20)
    UNAME VARCHAR2(20)
    CPSWD VARCHAR2(20)
    CONFPASS VARCHAR2(20)
    CAGE NUMBER
    CSEX VARCHAR2(5)
    CADD VARCHAR2(100)
    COURSE NUMBER
    CQUAL VARCHAR2(10)
    CPER NUMBER
    IADD VARCHAR2(100)
    The registerbean.java file is as below: (This seems to work fine because I tried printing the values using <%= %> tag and it worked out fine and moreover the query string is intact.)
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class registerbean
    private String name,uname,pass,cpass,age,sex,add,ugcourse,ugqual,per,iadd,otherugqual,ccode;
    public void setName(String a)
    name=a;
    public void setUname(String a)
    uname=a;
    public void setPass(String a)
    pass=a;
    public void setCpass(String a)
    cpass=a;
    public void setAge(String a)
    age=a;
    public void setSex(String a)
    sex=a;
    public void setAdd(String a)
    add=a;
    public void setOtherugqual(String a)
    otherugqual=a;
    public void setCcode(String a)
    ccode=a;
    public void setUgcourse(String a)
    ugcourse=a;
    public void setUgqual(String a)
    ugqual=a;
    public void setPer(String a)
    per=a;
    public void setIadd(String a)
    iadd=a;
    public String getName()
    return(name);
    public String getUname()
    return(uname);
    public String getPass()
    return(pass);
    public String getCpass()
    return(cpass);
    public String getAge()
    return(age);
    public String getCcode()
    return(ccode);
    public String getSex()
    return(sex);
    public String getAdd()
    return(add);
    public String getUgcourse()
    return(ugcourse);
    public String getUgqual()
    return(ugqual);
    public String getPer()
    return(per);
    public String getIadd()
    return(iadd);
    public String getOtherugqual()
    return(otherugqual);
    I initially thought the problem was with str but then str seems to be perfect and I get a string of the form �insert into reg values('c','c','c',98,'Male','c','B.Tech, Applied Artificial Neural Networks','HSC',9898,'h')� which I verified through a javascript debugger. The session scope used is to get values through the db bean from another jsp file. The problem is in the executeUpdate() line of this code. I even tried changing the updation table, but in vain. What could be done to rectify this? Please help me out and please do remember that I have no option but to use odbc.
    Thanks in advance.
    R. Yogaesh.

    I didn't verify the type of exception and i'm now going to do that, but then when the string is as perfect as needed, what is the need for a prepared statement? What is the basic difference between the two? And basically what is the problem with this piece of code which creates an exception? Please reply as soon as possible.
    Thankyou very much.
    R. Yogaesh.

  • How to display array

    Hi, I have a problem to display array from my database. The following are the two files that I tried to input multiple values in mailaddress database in the second file and I tried to display the values from the database when the user login the first file. The values are recorded in the database well but I always got java.lang.NullPointerException error in my first file. I checked the code, it shows that array display wrong. Would you please help me? Thanks a lot in advance.
    <zhangmailinputtest.jsp>
    <%@ page language="java" contentType="text/html; charset=Shift_JIS" %>
    <%@ page import="beanYama.*,java.sql.*,java.util.*,java.text.*" %>
    <%@ include file="inc_conv_char.jsp" %>
    <%
    String uid =(String)session.getAttribute("uid");
    String unam =(String)session.getAttribute("unam");
    String depart =(String)session.getAttribute("depart");
    String perms =(String)session.getAttribute("perms");
    String flag =(String)session.getAttribute("flag");
    if(flag==null){
         response.sendRedirect("index.jsp");
    }else{
    %>
    <html>
    <body>
    <%!      String[] name;
         String[] departa;
         String[] email;
    %>
    <%
              Connection con = null;
              Statement stmt1 = null;
              ResultSet rsq = null;
              Class.forName("org.gjt.mm.mysql.Driver");
              con=DriverManager.getConnection("jdbc:mysql://localhost/progress?user=ntjs&password=ntjs&useUnicode=true&characterEncoding=Shift_JIS");
              stmt1=con.createStatement();
         rsq=stmt1.executeQuery("SELECT name AS name1 from mailaddress;");
              if(rsq.next()){
                   for (int i=0;i<name.length;i++) {
                   name[i] = rsq.getString("name1");
                   rsq.next();
              stmt1.close();
              con.close();     
    %>
    <form action="zhangmailtestfinal.jsp" method="post">
    <table width="60%" border="1" cellpadding="1" cellspacing="1" bordercolor="#000099">
    <tr>
    <td width="20%"><div align="center">Name</div></td>
    <td width="20%"><div align="center">Department</div></td>
    <td width="50%"><div align="center">Address</div></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" value="<%=name[0]%>" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    <tr>
    <td><input type="text" name="name" size="25" align="middle"></td>
    <td><input type="text" name="departa" size="25" align="middle"></td>
    <td><input type="text" name="email" size="53"align="middle"></td>
    </tr>
    </table>
    <input type="submit" name="save_button" value="Save">
    </body>
    </CENTER>
    </html>
    <%
    %>
    <zhangmailtestfinal.jsp>
    <%@ page language="java" contentType="text/html; charset=Shift_JIS" %>
    <%@ page import="beanYama.*,java.sql.*,java.util.*,java.text.*" %>
    <%@ include file="inc_conv_char.jsp" %>
    <%
    String uid =(String)session.getAttribute("uid");
    String unam =(String)session.getAttribute("unam");
    String depart =(String)session.getAttribute("depart");
    String perms =(String)session.getAttribute("perms");
    String flag =(String)session.getAttribute("flag");
    if(flag==null){
         response.sendRedirect("index.jsp");
    }else{
    %>
    <html>
    <body>
    <%!
         Connection con = null;
         PreparedStatement ps = null;
         ResultSet rs = null;
    %>
    <%
         String[] name = request.getParameterValues("name");
         String[] departa = request.getParameterValues("departa");
         String[] email = request.getParameterValues("email");
    try{          
              Class.forName("org.gjt.mm.mysql.Driver");
              con=DriverManager.getConnection("jdbc:mysql://localhost/progress?user=ntjs&password=ntjs&useUnicode=true&characterEncoding=Shift_JIS");
              Statement stmt0=con.createStatement();
              stmt0.executeUpdate("delete from mailaddress");
              String query ="INSERT INTO mailaddress (mail_userid,name,departa,email) VALUES (?,?,?,?)";
              ps = con.prepareStatement(query);
                   for (int i=0;i<name.length;i++){
                   ps.setString(1,uid);
                   ps.setString(2, name);
                   ps.setString(3, departa[i]);
                   ps.setString(4, email[i]);
                   ps.addBatch();
              ps.setString(4,uid);
              int[] results = ps.executeBatch();
              Statement stmt1=con.createStatement();
              ResultSet rsq=stmt1.executeQuery("SELECT name AS name1 from mailaddress where mail_userid=" + "'" + uid + "'" + ";");
              if(rsq.next()){
                   for (int i=0;i<name.length;i++) {
                   name[i] = rsq.getString("name1");
                   rsq.next();
    } catch (Exception e) {
                   throw new ServletException(e);
              } finally {
                   try {
                        if(rs != null) {
                             rs.close();
                             rs = null;
                        if(con != null) {
                             con.close();
                             con = null;
                   } catch (SQLException e) {}
    %>
    </html>
    <%
    %>

    Where exactly is the exception being generated?
    My guess is this bit here:
    if(rsq.next()){
      for (int i=0;i<name.length;i++) {
        name = rsq.getString("name1");
        rsq.next();
    }I don't think your name array has been initialised in this file. Plus it assumes that the name array has exactly the same number of items as the query returns. To me thats rather dubious...
    I would suggest this instead
    while (rsq.next()){
        name = rsq.getString("name");
    }I'm still not entirely certain what you are trying to accomplish, but thats probably the cause of the null pointer.
    good luck,
    evnafets

  • Walkthrough: Displaying Data from Oracle database in a Windows application.

    This article is intended to illustrate one of the most common business scenarios such as displaying data from Oracle database on a form in a Windows application using DataSet objects and .NET Framework Data Provider for Oracle.
    You can read more at http://www.c-sharpcorner.com/UploadFile/john_charles/WalkthroughDisplayingDataOracleWindowsapplication05242007142059PM/WalkthroughDisplayingDataOracleWindowsapplication.aspx
    Enjoy my article.

    hi,
    this is the code :
    public class TableBean {
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    public List getperInfoAll() {
    int i = 0;
    try
    con = DriverManager.getConnection("url","root","root");
    ps = con.createStatement();
    rs = ps.executeQuery("select * from user");
    while(rs.next()){
    System.out.println(rs.getString(1));
    perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2),rs.getString(3)));
    i++;
    catch (Exception e)
    System.out.println("Error Data : " + e.getMessage());
    return perInfoAll;
    public class perInfo {
    String uname;
    String firstName;
    String lastName;
    public perInfo(String firstName,String lastName,String uname) {
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    public String getUname() {
    return uname;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    ADF table code:
    <af:table value="#{tableBean.perInfoAll}" var="row"
    binding="#{backing_Display.table1}" id="table1">
    <af:column sortable="false" headerText=""
    align="start">
    <af:outputText value="#{row.firstName"/>//---> Jdeveloper 11g doesn't allow me to use this.. it says firstName is an unknown property..
    </af:column>
    </af:table>
    Please tell me is this the way to do it.. or is it a must to use the DataCollection from the data controls panel...
    Thanks...

  • Hiding the business partner search parameter from search criteria

    Hi,
    I have business partner search parameter whose value is hardcoded in the lead search..
    I would like to hide the business partner search parameter from displaying only..
    I need to achieve it programatically and not in configuration and all.
    Do I need to write the code in P method or which method?
    Thanks
    Madhukar

    Hi,
    The code is as below and I just need to have the functionality of BP search field intact but hide it from display in web UI..if any correction is required let me know..
    ***current date is populated into LV_DATE
      DATA lv_date TYPE string.
      lv_date = sy-datum.
    ***current user login name is populated into LV_SUNAME
      DATA lv_suname TYPE string.
      lv_suname = sy-uname.
    ***Fetching the BP ID of the current user who logged into L_PARTNER
      DATA:l_partner TYPE bu_partner.
      CALL FUNCTION 'CRM_ERMS_FIND_BP_FOR_USER'
        EXPORTING
          iv_user_id = sy-uname
        IMPORTING
          ev_bupa_no = l_partner.
    ***structure for BUT051
      TYPES : BEGIN OF ty_data,
               relnr    TYPE bu_relnr,
               partner1 TYPE bu_partner,
               partner2 TYPE bu_partner,
               date_to  TYPE bu_datto,
             END OF ty_data.
    ***work area for BUT051
      DATA wa_but051 TYPE ty_data.
    ***Fetching Dealer BP ID which is 'PARTNER1' field in BUT051
      SELECT relnr
             partner1
             partner2
             date_to
      FROM but051
      INTO wa_but051
      UP TO 1 ROWS
      WHERE partner2 = l_partner.
      ENDSELECT.
    ***Geting the dealer BP ID into LV_DEALER
      DATA lv_dealer TYPE string.
      lv_dealer = wa_but051-partner1.
      DATA: lr_qs          TYPE REF TO cl_crm_bol_dquery_service,
            lr_search_node TYPE REF TO cl_bsp_wd_context_node_asp,
            lr_col         TYPE REF TO if_bol_bo_col ,
            lr_iterator    TYPE REF TO if_bol_bo_col_iterator ,
            lr_param       TYPE REF TO if_bol_bo_property_access,
            ls_selection   TYPE genilt_selection_parameter,
            lv_low         TYPE sy-datum,
            lv_attr_name   TYPE name_komp ,
            lv_value_set   TYPE abap_bool .
      IF iv_first_time EQ abap_true.
    * to initialize the search view.
        CALL METHOD super->do_prepare_output
          EXPORTING
            iv_first_time = iv_first_time.
    * fetch the search node and its content.
        lr_qs = me->get_current_dquery( ).
        lr_col = lr_qs->get_selection_params( ).
    * check the currently visible search attributes.
        lr_iterator = lr_col->get_iterator( ).
        lr_param    = lr_iterator->get_first( ).
        WHILE lr_param IS BOUND.
    * get the parameters
          lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
          IF ls_selection-attr_name = 'VALID_FROM'.
    * SET_PROPERTIES
            ls_selection-low = lv_date.
            CALL METHOD lr_param->set_properties
              EXPORTING
                is_attributes = ls_selection.
            lv_value_set = abap_true .
            EXIT.
          ENDIF.
          IF ls_selection-attr_name = 'BU_PARTNER'.
    * SET_PROPERTIES
            ls_selection-low = lv_suname.
            CALL METHOD lr_param->set_properties
              EXPORTING
                is_attributes = ls_selection.
                lv_value_set = abap_true .
            EXIT.
          ENDIF.
          lr_param = lr_iterator->get_next( ).
        ENDWHILE.
        IF lv_value_set EQ abap_false .
    * it was not part of the visible attributes, then add it at the end.
          CALL METHOD lr_qs->add_selection_param
            EXPORTING
              iv_attr_name = 'VALID_FROM'
              iv_sign      = 'I'
              iv_option    = 'EQ'
              iv_low       = lv_date.
          CALL METHOD lr_qs->add_selection_param
            EXPORTING
              iv_attr_name = 'BU_PARTNER'
              iv_sign      = 'I'
              iv_option    = 'EQ'
              iv_low       = lv_dealer.
        ENDIF.
    * for a proper display of the added / changed attribute.
        lr_search_node = get_dquery_cnode( ).
        lr_search_node->build_parameter_tab( ).
      ELSE.
    * non first time call - just delegate to superclass.
        CALL METHOD super->do_prepare_output
          EXPORTING
            iv_first_time = iv_first_time.
      ENDIF.

  • Identity propagation with EJB

    How to propagation identity to Remote EJB if client application is not deployed on WLS, but just standalone application.
    I found some document on the web in regards to identity propagation with remote EJB ( EJB security mechanisms)
    I follow it and have the following code:
    package oracle.bpel.services.workflow.samples;
    import java.security.Principal;
    import java.security.PrivilegedExceptionAction;
    import java.util.List;
    import javax.security.auth.Subject;
    import javax.security.auth.callback.Callback;
    import javax.security.auth.callback.CallbackHandler;
    import javax.security.auth.callback.NameCallback;
    import javax.security.auth.callback.PasswordCallback;
    import javax.security.auth.callback.UnsupportedCallbackException;
    import javax.security.auth.login.LoginContext;
    import weblogic.security.auth.callback.URLCallback;
    import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
    import oracle.security.jps.util.SubjectUtil;
    public class RemoteWFClientWithIdentityPropagationSample {
    public void runRemoteClient() {
    try {
    PrivilegedExceptionAction<List> privilegedExceptionAction = new PrivilegedExceptionAction<List>() {
    public List run() throws Exception {
    for (Principal pr : SubjectUtil.getCurrentSubject().getPrincipals()) {
    System.out.println("Current Principals: " + pr.getName());
    return RemoteWFClientSample.runWithUserPropagation(WorkflowServiceClientFactory.REMOTE_CLIENT); // it calls Remote EJB
    SampleCallbackHandler handler = new SampleCallbackHandler("jcooper", "welcome1", "t3://stapj73.us.oracle.com:7001");
    LoginContext loginContext = new LoginContext("Sample",handler);
    loginContext.login();
    Subject subject = loginContext.getSubject();
    List result = (List) Subject.doAs(subject, privilegedExceptionAction);
    System.out.println("runRemoteClient is " + result);
    } catch (Exception e) {
    System.out.println("Error occur");
    e.printStackTrace();
    class SampleCallbackHandler implements CallbackHandler {
    private String uname = null;
    private String passwd = null;
    private String url = null;
    public SampleCallbackHandler(String uname, String passwd, String url) {
    this.uname = uname;
    this.passwd = passwd;
    this.url = url;
    public void handle(Callback[] callbacks) throws
    java.io.IOException, UnsupportedCallbackException {
    for (int i = 0; i < callbacks.length; i++) {
    if (callbacks[i] instanceof NameCallback) {
    NameCallback nc = (NameCallback) callbacks;
    nc.setName(uname);
    } else if (callbacks[i] instanceof URLCallback) {
    URLCallback uc = (URLCallback) callbacks[i];
    uc.setURL(url);
    } else if (callbacks[i] instanceof PasswordCallback) {
    PasswordCallback pc = (PasswordCallback) callbacks[i];
    pc.setPassword(passwd.toCharArray());
    } // for
    } // handle()
    public static void main(String args[]) {
    RemoteWFClientWithIdentityPropagationSample sample = new RemoteWFClientWithIdentityPropagationSample();
    sample.runRemoteClient();
    I run test with JVM system option : -Djava.security.auth.login.config=C:\Work\JavaTry\login.conf
    where C:\Work\JavaTry\login.conf has the following lines:
    Sample {
    weblogic.security.auth.login.UsernamePasswordLoginModule required
    debug=false;
    Client shows pincipals in the Subject:
    But still, on server side sessionContext.getCallerPrincipal() returns '<anonymous>' instead of 'jcooper'
    What is wrong now?

    OK I have got a little further.
    code snippetString contextServiceURL = "corbaloc:iiop:10.230.180.69:7002/NameService";
    Hashtable table = new Hashtable();
    table.put(InitialContext.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    table.put(InitialContext.PROVIDER_URL, contextServiceURL);
    InitialContext context = new InitialContext(table);
    Object ref = context.lookup("ejb.myejbRemoteHome");
    myejbRemoteHome home = (myejbRemoteHome)PortableRemoteObject.narrow(ref, myejbRemoteHome.class);
    myejbRemote obj = home.create();
    obj.testUnsecureMethod();
    obj.testSecureMethod();
    <<<<<<<<
    The unsecure call works fine, the secure call gives me:
    java.rmi.AccessException: CORBA NO_PERMISSION 0 Maybe; nested exception is:
         org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: Maybe
    If i set defaultiiop username and password in WebLogic under Environment -> Server -> protocals -> IIOP to weblogic/password then the secure call works. This makes me think that the Subject is not propagating properly.
    In the request in Tomcat I have a GenericPrincipal with user and group info. In the Session i have a Subject with only WLSUserImpl, but not the WLSGroupImpl's that I expect. They are there when the login happes, I see the weblogic Authenticate method populate the subject with the groups okay.
    Any help much appreicated.
    Edited by lnoton at 04/24/2008 2:56 AM
    Edited by lnoton at 04/24/2008 2:57 AM

  • How can I extract a km-iView out the portal to redefine it?

    Hello folks,
    I want to redefine the com.sap.km.cm.navigation-iView to serve generic access to the users home drive by using the <User.UserID>-variable. Therefore I have to extract/download the iView out of the Portal. I wasn't able to find KM-Content in Systemadministration->Support->Portal Runtime->Browse Deployment. What do I have to do?
    How can I extract a km-iView out the portal to redefine it?
    Regards
    Steffen

    Just as an example:
    package com.btexx.proxy;
    import com.sapportals.portal.prt.component.*;
    import com.sapportals.portal.prt.pom.IEvent;
    import com.sapportals.wcm.repository.ResourceException;
    import com.sapportals.wcm.repository.ResourceFactory;
    import com.sapportals.wcm.service.IServiceTypesConst;
    import com.sapportals.wcm.service.urlgenerator.IURLGenerator;
    public class Example extends AbstractPortalComponent
         protected void doOnNodeReady(IPortalComponentRequest request, IEvent event){
              String uname = request.getUser().getLogonUid();
              String path = "/userhome/"+uname;
              String rndLayoutSet = "ConsumerExplorer";
              String explorerServletPath = "/irj/servlet/prt/portal/prtroot/com.sap.km.cm.navigation";
                   try {
                        IURLGenerator ug = (IURLGenerator) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
                        explorerServletPath = ug.getExplorerServletPath();
                   } catch (ResourceException e) {
              request.redirect(explorerServletPath+path+"?rndLayoutSet="+rndLayoutSet);
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    + portalapp.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="usermanagement, knowledgemanagement"/>
      </application-config>
         <components>
              <component name="Example">
         <component-config>
              <property name="ClassName" value="com.btexx.proxy.Example"/>
              </component-config>
                   <component-profile>
                        <property name="com.sap.portal.reserved.iview.Redirect" value= "true"/>
                   </component-profile>
              </component>
         </components>
    <services/>
    </application>
    all the best,
    dimitry

  • SESSIONS are NOT Maintained

    Hello Everyone!
    I am using Servlets, JSP and JDBC for my Web Application.
    I am using SESSION Variables. My entry point is Login Screen "www.man.com/proj/servlet/login" where user enters USERNAME/PASSWROD.
    This FORM calls PROCESS.JAVA Servlet which creates a SESSION for them as shown:
    HttpSession session = req.getSession(true);
    String uname = (String)session.getValue("uname");
    // code coonects to JDBC and see if they match
    // IF MATCH
    session.putValue("uname",req.getParameter("username"));
    String uid = "";
    uid = uid.valueOf(rs.getInt("uid"));
    session.putValue("uid",uid);
    //I then redirect to MENU Page ....which list options availabe for this user.
    res.sendRedirect(menuURL);
    on my menu page (MENU.JAVA), I have following:
    HttpSession session = req.getSession(true);
    String uname = (String)session.getValue("uname");
    String uid = (String)session.getValue("uid");
    if (uname == null)
         PRINT ERROR.....
    Later then user selects one of the MENU options and it takes to another Servlet (say OPT1.JAVA)...
    OPT1 Servlet is processed and at the end it displays a LINK which will take a User back to MENU.JAVA Page....
    But When users clicks this LINK (A HREF) it takes to MENU.JAVA Page but shows UNAME as NULL...... How is it possible...? SHOULD IT NOT RETAIN the SESSION....?
    HOW CAN I RETAIN my PREVIOUS Session Variables...?
    Any related informaiton on this is appreciated.
    THANKS!

    on my menu page (MENU.JAVA), I have following:
    HttpSession session = req.getSession(true);
    String uname = (String)session.getValue("uname");
    String uid = (String)session.getValue("uid");
    if (uname == null)
    PRINT ERROR.....
    Here when you are getting the Session from the Request object you need to use
    HttpSession session = req.getSession(false);
    to retain the old Session. If you use true, it creates a new Session

Maybe you are looking for

  • How to display the ALV output in a Group format

    Hello Experts, I have my current ALV report output like this: GROUP DESCRIPTION group1 adsfadsfadsfa group1 lkjadsfjlajdsfla group1 adsfadsfadsf group1 adsfadsfadfa group2 adsfadsfafaa group2 oiueworuowe group2 zxvzcxvzvcsd group2 oiuqoewruqw And I n

  • [SOLVED] dual booting windows 7 with btrfs on grub-bios -- core.img

    I am trying to install arch in a dual boot configuration with an existing windows 7 partition. I have everything from the beginner's guide done but the bootloader. When I run grub-install it tells me that core.img is too big. Some googling tells me t

  • Issue getting WDS to Install for PXE in SCCM 2012 SP1 Primary Site

    Hi All I'm trying to get PXE boot working from our SCCM 2012 box but it never actually gets to the point of installing WDS when I check the box for PXE booting. I don't have  SMSPXE.log since it never gets to that point and the distmgr.log  never rea

  • In Production system Infocube mange screen selection changed

    Dear Experts, I have problem with my production system. Problem:In Prod system for all the Infocube settings has changed may yesterday because of that we are not able to see in the manage screen Tranferred and Added records colums. Could you please s

  • Qosmio X775-3DV78 no optical drive in setup

    Yesterday I put a DVD in my drive and it didn't run.  I noticed the power was off so I assumed it was the annoying Toshiba utility turning it off and FN-Tab didn't work, so I rebooted.  After rebooting it still didn't come back.  I noticed that it wa