How to get from data entered on a form to a session attribute

I have a jsp with a form with fields that are updated by the user.
The values are in the fields value as I expected.
Example. document.frm.Name.value = "Me"
How do I populate a session variable with document.frm.Name.value?
I think I have to do a request.getParameter("Name") followed by a
session.SetAttribute. But the request.getParameter does not get populated with the latest value in document.frm.Name.value.
Any idea is welcomed. Thanks
Claudiine

Below is the code:
What I want to do is save in the session attribute "mailToAddressList" whatever the user types in the textarea "MailTo"
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
import java.text.*;
import java.io.*;
import com.cname.apl.*;
public class DealTeamServlet extends HttpServlet {
private appUtil util ;
private java.sql.Connection conn ;
private static String dbUrl ;
private static String dbUid ;
private static String dbPwd ;
private static String mailFromAddressList ;
private static String mailToAddressList ;
private static String mailCcAddressList ;
private static String mailBccAddressList ;
private static String mailSubject ;
SimpleDateFormat SDF = new SimpleDateFormat("d-MMM-yyyy");
public void init(ServletConfig config) throws ServletException {
super.init(config);
dbUrl = config.getInitParameter("dbUrl");
dbUid = config.getInitParameter("dbUid");
dbPwd = config.getInitParameter("dbPwd");
mailFromAddressList = config.getInitParameter("mailFromAddressList");
mailToAddressList = config.getInitParameter("mailToAddressList");
mailCcAddressList = config.getInitParameter("mailCcAddressList");
mailBccAddressList = config.getInitParameter("mailBccAddressList");
mailSubject = config.getInitParameter("mailSubject");
if (dbUrl == null)
dbUrl = "*" ;
if (dbUid == null)
dbUid = "*" ;
if (dbPwd == null)
dbPwd = "*" ;
if (mailFromAddressList == null || mailFromAddressList.equals("*"))
mailFromAddressList = "" ;
if (mailToAddressList == null || mailToAddressList.equals("*"))
mailToAddressList = "" ;
if (mailCcAddressList == null || mailCcAddressList.equals("*"))
mailCcAddressList = "" ;
if (mailBccAddressList == null || mailBccAddressList.equals("*"))
mailBccAddressList = "" ;
if (mailSubject == null || mailSubject.equals("*"))
mailSubject = "" ;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
HttpSession session = request.getSession(true) ;
String msgBody = (String) request.getParameter("msgBody");
String uid = (String) request.getParameter("uid");
String key = (String) request.getParameter("key");
Boolean isAuthorized = (Boolean) session.getAttribute("isAuthorized");
java.io.PrintWriter out = response.getWriter();
if (msgBody == null) msgBody = "" ;
response.setContentType("text/html");
if (uid == null || key == null) {
isAuthorized = new Boolean(false);
if ( isAuthorized == null ) {
util = new appUtil();
conn = util.getConnection(dbUrl, dbUid, dbPwd) ;
isAuthorized = util.isAuthorized(conn, uid, key);
util.closeConnection(conn) ;
if ( isAuthorized.booleanValue() ) {
session.setAttribute("isAuthorized", new Boolean(true));
java.sql.Timestamp serverTime = util.getServerTime(conn) ;
java.sql.Date now = new java.sql.Date(serverTime.getTime());
int idEntry = Integer.parseInt(msgBody);
mailToAddressList = request.getParameter("MailTo");
out.println("<html>");
out.println("<head>");
out.println("<title>Team Members</title>");
out.println("<SCRIPT LANGUAGE=JavaScript>");
out.println("function open_window() {");
out.println("document.domain = \"ny.cname.com\"");
out.println("var loc = \"http://peoplelkp.ny.cname.com/peoplelkp/PDLookupService?&emil2=eMail&form=frm&launch=myRoutine()&csr=1&srch=1&adv=1&wc=y&pump=\"");
out.println("loc = loc + document.frm.Name.value");
out.println("var w = window.open(loc,\"Model_Details\",\"scrollbars,width=400,height=450,resizable=yes\")");
out.println("return;");
out.println("}");
out.println("function myRoutine() {");
out.println("document.frm.MailTo.value=document.frm.MailTo.value+\",\"+document.frm.eMail.value;");
out.println("}");
out.println("function submitForm() {");
out.println("alert('submit form')");
out.println("var mailAdd = document.frm.MailTo.value");
out.println("alert('mailAdd='+mailAdd);");
out.println("if ( mailAdd.length == 0 || mailAdd.indexOf(' ') == 0 || mailAdd.indexOf('.com') == -1 || mailAdd.indexOf('@') == -1 ) {" );
out.println("alert('The To: field must be populated. No space are allowed. Email addresses must have valid format. Example: [email protected]')");
out.println("document.all.frm.MailTo.focus();");
out.println("return false;");
out.println("}");
out.println("return true;");
out.println("}");
out.println("function UpdateMailTo() {");
out.println("alert ('I am in UpdateMailTo='+document.frm.MailTo.value);");
out.println("}");
out.println("</SCRIPT>");
out.println(util.getStyleSheet());
out.println("</head>");
out.println("<body bgcolor='silver'>");
out.println("<form name='frm' action='SendMail' method='post'>");
out.println("<b>Team Members</b>");
out.println("<tr>");
out.println("<TABLE cellpadding='0' cellspacing='0' border='0'>");
out.println("<tr>");
out.println("<td align='right'><b>Subject:  </b></td>");
out.println("<td>Deal Team Members Cleared by Conflicts</td>");
out.println("</tr><br>");
StringBuffer bod = new StringBuffer("");
SimpleDateFormat SDF = new SimpleDateFormat("d-MMM-yyyy");
try {
/*get header information*/
CallableStatement st = conn.prepareCall("{call apl_get_sp ?}");
st.setInt(1, idEntry);
ResultSet rs = st.executeQuery();
int id = 0;
int dw = 0;
String cde_proj = "";
String nm_title = "";
String nm_long = "";
String empl = "";
String sid = "";
int userid = 0;
String email_pr = "";
while ( rs.next() ) {
id = rs.getInt("id_entry");
dw = rs.getInt("id_dealworks");
cde_proj = rs.getString("cde_proj");
nm_title = rs.getString("nm_title");
nm_long = rs.getString("nm_long");
empl = rs.getString("empl_name");
sid = rs.getString("id_standard");
email_pr = rs.getString("id_email_ext_unix");
mailToAddressList = email_pr.trim();
out.println("<tr><td align='right'><b>To:  </b></td>");
out.println("<td><textarea name='MailTo' cols='50' rows='2'>"+mailToAddressList+ "</textarea></td>");
out.println("<td>  </td>");
out.println("<td><input type='button' value='Save' onClick='UpdateMailTo()'></td>");
out.println("</tr>");
// out.println("request.setAttribute('mailadd',document.frm.MailTo.value);");
// mailToAddressList = request.getParameter("mailadd");
out.println("<tr><td align='right'><b>Name:  </b></td>");
out.println("<td><INPUT NAME='Name' VALUE='' size=65 ></td>");
out.println("<td>  </td>");
out.println("<td><input type='button' value='Search' onClick='open_window()'></td>");
out.println("</tr>");
out.println("<tr><td align='right'><b>EMail:  </b></td>");
out.println("<td><INPUT NAME='eMail' VALUE='' size=65'></td>");
out.println("</tr>");
if (rslt != null) rslt.close() ;
if (stmt != null) stmt.close() ;
}/*end try*/
catch ( Exception e) {
System.out.println(e) ;
getServletContext().log(e.toString());
out.println("<td colspan='5' align='right'><input type='submit' value='Send email' onClick='submitForm()'></td>");
out.println("</tr>");
out.println("</table>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
mailSubject = "Team Members";
String body = "testing";
session.setAttribute("mailFromAddressList", mailFromAddressList);
session.setAttribute("mailToAddressList", mailToAddressList);
session.setAttribute("mailCcAddressList", mailCcAddressList);
session.setAttribute("mailBccAddressList", mailBccAddressList);
session.setAttribute("mailSubject", mailSubject);
session.setAttribute("mailBody", body);
else {
session.setAttribute("isAuthorized", new Boolean(false));
out.println("You are not authorized.");
//out.close();
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
public String getServletInfo() {
return "Short description";
}

Similar Messages

  • How to get call data entered at IVR from Jtapi?

    Hi all,
    I need help regarding retrieving data entered by caller at IVR to the agent desktop screen.
    Setup is Avaya AES server with Jtapi service and Avaya Voice Portal.
    Application is to be developed using Avaya Jtapi and required to show data entered/keyed in by customer at IVR to agent's screen pop, as soon the call lands to an agent.
    I tried to find out API for that within Avaya Jtapi library, however couldnt find any suitable way to achive the requirement.
    Pls suggest what could be the possible solution for this scenario.
    Thanks,
    Amit

    I would say to find a
    [Avaya Jtapi|http://www.avaya.com/devconnect]
    forum, and not a general Java forum. You are liable to get better and quicker answers.

  • How to get from Apple (officially) details on my iphone 5 (knowing the serial number): model, date of sale, the date of activation, etc.

    How to get from Apple (officially) details on my iphone 5 (knowing the serial number): model, date of sale, the date of activation, etc. I bought a new iphone 5 on ebay.com - he was used. For a decision on my case ebay asks for this information ...

    Apple will never reveal that info to you, since you were not the originally purchaser. However, you can get the date of sale by entering the SN here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    Warranty starts on the date of sale, which is most likely the date of activation, but not necessarily so.

  • How to get all data from nokia to i5s

    how to get all data from nokia E71 to i5s???

    if you can put those data in your computer then add it in iTunes. your iPhone 5s should get it thru syncing.

  • How to get the data from multiple nodes to one table

    Hi All,
    How to get the data from multiple nodes to one table.examples nodes are like  A B C D E relation also maintained
    Regards,
    Indra

    HI Indra,
    From Node A, get the values of the attributes as
    lo_NodeA->GET_STATIC_ATTRIBUTES(  IMPORTING STATIC_ATTRIBUTES = ls_attributesA  ).
    Similarily get all the node values from B, C, D and E.
    Finally append all your ls records to the table.
    Hope you are clear.
    BR,
    RAM.

  • How to get the data from pcl2 cluster for TCRT table.

    Hi frndz,
    How to get the data from pcl2 cluster for tcrt table for us payroll.
    Thanks in advance.
    Harisumanth.Ch

    PL take a look at the sample Program EXAMPLE_PNP_GET_PAYROLL in your system. There are numerous other ways to read payroll results.. Pl use the search forum option & you sure will get a lot of hits..
    ~Suresh

  • How to get the data from Pooled Table T157E.

    Hi Experts,
    How to get the data from Pooled Table T157E.
    Any help.
    Thanks in Advance,
    Ur's Harsha.

    create some internal table similar to T157E and pass all data as per SPRAS.
    After that use internal table in your program as per the requirement.
    Regds,
    Anil

  • How to get purchasing data from SAP R/3 to OWB (Oracle warehouse builder).

    Hi,
    My name is Pavan Tata. I work as a SAP BW developer. Here is the situation at my client place. Client decided to retire BW system and wants to replace with OWB(Oracle warehouse). In all this currently we have purhchasing application in BW production system and wants to move this application to OWB for the same type of reporting what they are getting currently.
    Here is my question:
    How to get purchasing data from SAP R/3 to OWB(Warehouse) with initial full loads and deltas mechanism in the same way as we do in BW.
    Please help on this, also send me any documentation about this if you have.
    Thanks,
    Pavan.

    Hello,
    here is a short report which converts S012 entries to strings with separator semicolon. Perhaps this will help you?
    Regards
    Walter Habich
    REPORT habitest2 LINE-SIZE 255.
    TYPES:
      strtab_t TYPE TABLE OF string.
    CONSTANTS:
      separator VALUE ';'.
    DATA:
      it_s012 LIKE s012 OCCURS 0,
      wa_s012 LIKE s012,
      strtab TYPE strtab_t,
      strele TYPE string.
    SELECT * FROM s012 INTO TABLE it_s012 UP TO 100 ROWS.
    PERFORM data_to_string
      TABLES
        strtab
      USING
        'S012'. "requires it_s012 and wa_s012
    LOOP AT strtab INTO strele.
      WRITE: / strele.
    ENDLOOP.
    *&      Form  data_to_string
    FORM data_to_string TABLES strtab TYPE strtab_t
                        USING  ittab TYPE any.
      DATA:
        h_zaehler TYPE i,
        line_str TYPE string,
        l_tabellenname(10) TYPE c,
        l_arbeitsbereichsname(10) TYPE c,
        h_string TYPE string,
        h_char(255) TYPE c.
      FIELD-SYMBOLS: <l_tabelle> TYPE ANY TABLE,
                     <l_arbeits> TYPE ANY,
                     <feldzeiger> TYPE ANY.
      CLEAR strtab.
      CONCATENATE 'IT_' ittab INTO l_tabellenname.
      ASSIGN (l_tabellenname) TO <l_tabelle>.
      CONCATENATE 'WA_' ittab INTO l_arbeitsbereichsname.
      ASSIGN (l_arbeitsbereichsname) TO <l_arbeits>.
      LOOP AT <l_tabelle> INTO <l_arbeits>.
        CLEAR: h_zaehler, line_str.
        line_str = ittab.
        DO.
          ADD 1 TO h_zaehler.
          ASSIGN COMPONENT h_zaehler OF
            STRUCTURE <l_arbeits> TO <feldzeiger>.
          IF sy-subrc <> 0. EXIT. ENDIF.
          WRITE <feldzeiger> TO h_char LEFT-JUSTIFIED.          "#EC *
          h_string = h_char.
          CONCATENATE line_str separator h_string INTO line_str.
        ENDDO.
        APPEND line_str TO strtab.
      ENDLOOP.
    ENDFORM.                    "data_to_string

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • How to get the date starting from 1 to the current date from the system dat

    Dear all,
    Please tell me how to get the date starting from 1 based on the system date
    and it should come with respect of time also.
    example.
    suppose today is 6 Dec, 2006
    so ABAP report should find the 1 dec. 2006.
    Please help me as soon as possible.
    Regards,

    concatenate sy-datum0(2) '01' sy-datum4(4) into v_firstdate.
    or yo ucan use the fm:
    HR_JP_MONTH_BEGIN_END_DATE
    usage:
        call function 'HR_JP_MONTH_BEGIN_END_DATE'
             exporting
                  iv_date             = sy-datum
             importing
                  ev_month_begin_date = gv_begda
                  ev_month_end_date   = gv_endda.
    Regards,
    Ravi
    Message was edited by:
            Ravi Kanth Talagana

  • How to get the user entered data?

    Hi all,
    I have created an HTMLB DynPage component.
    In That i have created my input screen with textboxes using response.write method.
    i have added one onConfirm event on which the data whould validate.
    so onConfirm method im trying to get the data with request.getParameter method which returns null...
    how to do...how to get the user entered data to do my validations...can anyone plz advice.
    Thanks,
    Viswes

    Hi
    inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
    to create portal input field (ie HTMLB), you should do something like
    this in the doProcessBeforeOutput member function
    InputField field1 = new InputField("Id1");
    field1.setSize(8); // 8 characters
    this.getForm().addComponent(field1);
    and in doProcessAfterInput member function
    InputField field1 =
    (InputField) this.getComponentByName("Id1");
    you can then manipulate the content of the field.
    Hope this help,
    Guillaume

  • How can get formatted data from hard drive

    how can get formatted data from hard drive?

    No chance without special tools/knowledge. There are companies that can do it, unless you use multiple format or rewrite data with special erase ustility or unless you have done low level format.
    Regards
    Milos

  • How to get the data from multiple tabes into single table

    hi all,
    here i am having 10 data base tables,how to get the data into a single table.
    regards,
    subba reddy

    hi,
    non XI/PI related
    Regards,
    Michal Krawczyk

  • How to get changed data in ALV in Web Dynpro for ABAP

    METHOD on_data_check .
    DATA:
        node_spfli                          TYPE REF TO if_wd_context_node,
        node_sflight                        TYPE REF TO if_wd_context_node,
        itab_sflight2                        TYPE if_display_view=>elements_sflight.
      node_spfli = wd_context->get_child_node( name = if_display_view=>wdctx_spfli ).
      node_sflight = node_spfli->get_child_node( name = if_display_view=>wdctx_sflight ).
      CALL METHOD node_sflight->get_static_attributes_table
        IMPORTING
          table = itab_sflight2.
    this code is ..get all data(changed and not changed)
    but i want get changed data only, not all data.
    how to get changed data?
    Edited by: Ki-Joon Seo on Dec 27, 2007 6:04 AM

    Hi,
    To get only the changed data in the ALV grid of a WD, you need to capture the "ON_DATA_CHECK" of the ALV grid.
    To this please do the following in the ALV initialization of the ALV table settings :
        lr_table_settings->set_data_check(
                IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CELL_EVENT ).
    You may also do this:
        lr_table_settings->set_data_check(            IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CHECK_EVENT)
    The above two ways would depend on when do you need to check for the changed data. If you want to check the data as soon as it is entered, then use the first method. Else, use the second method.
    You need to register an EVENT HANDLER for this event.(You may do this in your VIEW or Component Controller).
    In this Event handler, you would find an importing parameter R_PARAM which is a ref type of      IF_SALV_WD_TABLE_DATA_CHECK.
    The attribute T_MODIFIED_CELLS of this interface IF_SALV_WD_TABLE_DATA_CHECK will contain the modified cells of the ALV with the old & new values.

  • How to get the date of first day of a week for a given date

    Hi gurus
    can any one say me how to get the date of first day(date of Sunday) of a week for a given date in a BW transformations. For example for 02/23/2012 in source i need to get 02/19/2012(Sunday`s date) date in the result. I can get that start date of a week using  BWSO_DATE_GET_FIRST_WEEKDAY function module. But this function module retrieves me the  start date as weeks monday(02/20/2012) date. But i need sundays(02/19/2012) date as the start date. So it would be really great if anyone sends me the solution.
    Thanks
    Rav

    Hi,
    The simplest way would be to subtract 1 from the date date which you are already getting in transformation routine, but instead of doing that subtraction manually which might need bit of errort, you can simply use another FM to subtract 1 from given date.
    RP_CALC_DATE_IN_INTERVAL
    Regards,
    Durgesh.

Maybe you are looking for

  • Standby database error

    Hi Guys.. I am using oracle 10.2.0.4.0 on windows 2003 server. I created a physical standby database successfully. On standby database, I fired the following query SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE# SEQUENC

  • How to get selected item value and display text in selectOneChoice ?

    Hi Thank you for reading my post I bind the a selectOneChoice component to my backing bean so i have an object which represent this component in the backing bean. now i need to find which item is selected by use , i know that i can use getSelect_serv

  • SQL developer to debug a cursor data ?

    In the SQL Developer, how to debug a cursor ? In the debug mode, can I see its data what the cursor points to ? Thanks CURSOR C_EMP (DEPT_NUM_1  NUMBER)     IS     SELECT E.EMPLOYEE_ID, E.LAST_NAME, D.DEPARTMENT_NAME     FROM EMPLOYEES E JOIN DEPARTM

  • Test for se37 BAPI_ACC_DOCUMENT_POST

    Dear Sapgurus, i am testing in se37 with functional module for BAPI_ACC_DOCUMENT_POST in this one i gad given header date, account receivale table, g/l account, amount in currency after execute this one below getting message E RW                   60

  • Code Completion on library class

    I appologize if I have posted this to the wrong forum, I am very new to Java and don't usually post to forums. I have created class and then added it to the Libraries in a second project from within NetBeans. When I call the method, it doesn't comple