Passing value from jsp to java

Hi
Thanks for reading my query.I am having a jsp page which gets the input from the user from a confirm box(javascript). This input i need to process in my java class.how can i do that
Regards
Venki

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/

Similar Messages

  • How to pass value from jsp to java bean

    I have huge problem . How to pass value from jsp value to java bean.Please replay me soon

    Use the <jsp:setProperty> tag. There are several ways to use it. The one you probably want is:
    <jsp:setProperty name="bean_name"  property="property_name"  value="the_value_you_want_to_set"/>

  • Passing value from JSP to JApplet

    Hello,
    I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page
    to a JApplet,
    and the parameter passed through JSP should be displaed in the JTextArea.
    It would be kindful if any of you could help.
    Thanks
    Sanam

    hello,
    thanks for reply.
    I know how to pass parameters from html,
    I want to pass values from jsp page,
    and i dono how to do it, may be we cann pass values through url connection but i dono how.
    if anone knows plz help me in solving this.
    i hvae posted my applet code.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    </applet>
    public class DocApplet extends JApplet
         private JPanel jp;
         private Container cp;
         private JTextArea jt;
         private JToolBar tb;     
         private JScrollPane sp;
         private String annotation;
         private String url;
         private Connection con;
         private Statement stmt;
         public void init()
              jp = new JPanel();
              cp = getContentPane();
              jt = new JTextArea();
              tb = new JToolBar();
              sp = new JScrollPane(jt);
              repaint();
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
              jt.setBackground(Color.BLACK);
              jt.setForeground(Color.WHITE);
              setContentPane(jp);
              addButtons(tb);
              repaint();
         public void run()
              repaint();
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
              tb.add(button);
    }

  • Passing value from JSP to scriptlet

    Hi
    I am trying to find a way to pass a value from jsp to the scriptlets, i.e.
    <c:set var="testValue" value="123" />
    <%
    System.out.println(testValue);
    %>
    the above code just demonstrates what I was trying to achieve, by passing the value from the jsp into the scriptlet.
    Can someone tell me if there's an easy way to do this?
    Thank you.

    Note, using scriptlet code on your page is generally something to be avoided. 99% of what you should be doing on a JSP page can be done with EL/JSTL. If you can't do it with EL/JSTL then it probably belongs in a servlet/bean.
    I always aim for 100% scriptlet free jsp pages.
    Having said that, I can still answer your question: EL attributes are stored in the scope - page, request, session, application
    ${testValue} is equivalent to pageContext.findAttribute("testValue").
    The <c:set> tag example doesn't specify a scope, so therefore you could get it like this:
    <c:set var="testValue" value="123" />
    <%
    String testValue = (String)pageContext.getAttribute("testValue");
    System.out.println(testValue);
    %>alternatively exploit the feature of the useBean tag that creates a scriptlet variable:
    <c:set var="testValue" value="123" />
    <jsp:useBean id="testValue" type="java.lang.String"/>
    <%
    System.out.println(testValue);
    %>Note that the EL variable and the Scriptlet variable are initially pointing at the same String.
    But changing the string in scriptlet code will change the value it is pointing at, while leaving the EL variable untouched.
    If you have a List in scope, and sharing it between EL and scriptlet variables then any changes to the list would be reflected because they both point at the same List object.
    cheers,
    evnafets

  • Passing value from JSP to Action in Struts

    Hi,
    I am populating JSP page with rows retrieved from the database and
    represented as a List of Beans in forEach loop:
    <c:forEach var="list" items="${OperationsForm.OperationsList}">
    <c:choose>
    <c:when test="${list.isCompleted =='Y'}" >
    <td width="100">Completed</td>
    <td width="100"> </td>
    </c:when>
    <c:otherwise>
    <td width="100">Pending</td>
    <td width="100"><input type="image" onclick="
    rowId=value; form.action='action.do?command=notify'"
    value="${list.OperationId}" />
    </td>
    </c:otherwise>
    </c:choose>
    </tr>
    </c:forEach>
    Have hidden field: html:hidden property="rowId" value="-1"/>
    User is clicking the button corresponding to one of the rows
    and I need to pass the value of that rowId to the Action class, so it does
    something in the database [action completed]
    Now how do I pass it , is that the right way of doing it with calling
    request.getSession().getAttribute(rowId) in the Action class ?
    As of now I am getting Javascript error "Object doesn't support this
    property or method", complaining about rowId=value;
    Using Struts 1.3
    Please help !
    TIA,
    Oleg.

    So what you are saying is that I should add rowId here:
    <input type="image" onclick="form.action='action.do?command=notify&rowId='
    ${list.OperationId}"/> , correct ?
    I am not sure that it will work, especially with Struts tag.
    I will probably try something like:
    <html:submit onclick="form.action='action.do?command=notify'" value="${list.OperationId}">
    I am relatively new to Struts, so now sure what will work or not and how to do it better. How do I catch the submitted value in the Action in either of these 2 cases, via action.getSession().getProperty("rowId") /
    action.getSession().getProperty("submit") ?
    I would probably do it as a URL rather than changing the action of the form.I will have to create a new action anyway to process that row [which is sending user e-mail regarding that row data/event].
    Is the id the only thing you have to pass in?
    Or do you need other values from the screen?Selected rowId is probably the only thing I care about, can access values from the Form in Action.
    Thank you,
    Oleg.

  • Problem in passing values from AS to Java

    Hi,
    I am using Remote Object(Flex 3) for passing the data
    between java and flex. I am using the BlazeDS as the bridge. I have
    to pass an array collection containing value objects to the java
    method. I have created the value object in both the client side(AS)
    and server side (java) and registered my AS value object using
    [RemoteClass(alias="class name")]. Now the problem is the
    array collection is goinhg to the back end but when i try to get
    the values in the value objects using the corresponding getters, i
    am getting null values. Can some one suggest me the solution.
    Following is my AS value object
    package ascript
    [RemoteClass(alias="com.category.dao.CatgVO")]
    public class CatgVO
    private var catg_id:String;
    private var parent_catg_id:String;
    private var catg_name:String;
    private var catg_desc:String;
    private var created_by:String;
    private var created_date:String;
    private var catg_status:String;
    private var blooper:String;
    private var catg_modifieddate:String;
    private var catg_modifieduserid:String;
    * @return the catg_id
    public function getCatg_id():String {
    return catg_id;
    * @param catg_id the catg_id to set
    public function setCatg_id(catg_id:String):void {
    this.catg_id = catg_id;
    * @return the parent_catg_id
    public function getParent_catg_id():String {
    return parent_catg_id;
    * @param parent_catg_id the parent_catg_id to set
    public function setParent_catg_id(parent_catg_id:String):void
    this.parent_catg_id = parent_catg_id;
    * @return the catg_name
    public function getCatg_name():String {
    return catg_name;
    * @param catg_name the catg_name to set
    public function setCatg_name(catg_name:String):void {
    this.catg_name = catg_name;
    * @return the catg_desc
    public function getCatg_desc():String {
    return catg_desc;
    * @param catg_desc the catg_desc to set
    public function setCatg_desc(catg_desc:String):void {
    this.catg_desc = catg_desc;
    * @return the created_by
    public function getCreated_by():String {
    return created_by;
    * @param created_by the created_by to set
    public function setCreated_by(created_by:String):void {
    this.created_by = created_by;
    * @return the created_date
    public function getCreated_date():String {
    return created_date;
    * @param created_date the created_date to set
    public function setCreated_date(created_date:String):void {
    this.created_date = created_date;
    * @return the catg_status
    public function getCatg_status():String {
    return catg_status;
    * @param catg_status the catg_status to set
    public function setCatg_status(catg_status:String):void {
    this.catg_status = catg_status;
    * @return the blooper
    public function getBlooper():String {
    return blooper;
    * @param blooper the blooper to set
    public function setBlooper(blooper:String):void {
    this.blooper = blooper;
    * @return the catg_modifieddate
    public function getCatg_modifieddate():String {
    return catg_modifieddate;
    * @param catg_modifieddate the catg_modifieddate to set
    public function
    setCatg_modifieddate(catg_modifieddate:String):void {
    this.catg_modifieddate = catg_modifieddate;
    * @return the catg_modifieduserid
    public function getCatg_modifieduserid():String{
    return catg_modifieduserid;
    * @param catg_modifieduserid the catg_modifieduserid to set
    public function
    setCatg_modifieduserid(catg_modifieduserid:String):void {
    this.catg_modifieduserid = catg_modifieduserid;
    Regards
    Kranthi

    Hi there. That's a perfectly reasonable question.
    Take a look at the section of the Flex documentation with the title "Explicitly mapping ActionScript and Java objects" in the Data Access section of the doc.
    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html
    Your BananaVO ActionScript class needs a RemoteClass metadata tag that will tell the AMF deserialization code on the server what Java class to map the object to.
    Hope that helps.
    -Alex

  • Passing value from JSP to JSPDynPage onclick of link

    Hi,
    I have extracted a value in the JSP page and i want to send this value back to the JSPDynPage on click of a link(the link is dependent on the value).
    How can i do that?

    hi Sujoy,
    you can pass values by using beans and display the passed data in a new jsp page.
    firstly create a jsp page,that accepts user data,say for example i am placing a text box and a button,
    next,create a jspdyn page---
    private final static int INITIAL_STATE = 0;
        private final static int FINAL_STATE = 1;
        private int state = INITIAL_STATE;
        private final static String BEAN_KEY="nameBean";
        public void doInitialization(){
          IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
          IPortalComponentContext ctxt=request.getComponentContext();
          displayNameBean mybean = new displayNameBean();
          ctxt.putValue(BEAN_KEY,mybean);
    public void doProcessAfterInput() throws PageException {
             InputField myInputField = (InputField) getComponentByName("user_name");
    if (myInputField != null) {
    IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
    IPortalComponentContext ctxt = request.getComponentContext();
                 displayNameBean mybean1=(displayNameBean)ctxt.getValue(BEAN_KEY);
                   mybean1.setName(myInputField.getValueAsDataType().toString());
        public void doProcessBeforeOutput() throws PageException {
          switch (state){
               case INITIAL_STATE:
               this.setJspName("loginPage.jsp");
               break;
               case FINAL_STATE:
               this.setJspName("successloginPage.jsp");
               break;
        public void onButtonClick(Event event) throws PageException {
             state=FINAL_STATE;       
    finally display this value in a new jsp page as follows--
    <jsp:useBean id="nameBean" scope="application" class="NewProject.bean.displayNameBean" />
    <%@ taglib uri= "tagLib" prefix= "hbj"%>
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
    <hbj:textView
         id="welcome_note"
         design="HEADER2">
         <% 
         welcome_note.setText
         (nameBean.getName());
         %>
    as simple as that!!
    regards
    SwarnaDeepika
    P.S:Please reward points for helpful answers.

  • How to pass value from JSP to Javascript?

    I want to pass 2 integers to Javascript to do checking? How can I do that?

    Well, it is very simple, Follow these steps.
    1. Have a form with fields
    2. On submit validate the form using javascript
    3. If the javascript returns false do not submit the form
    4. if the javascript returns true submit the form
    5. The destination jsp page will handle the db operations.
    1. <form name="frm1" action="dbcheck.jsp">
    <input type="text" name="txt1">
    <input type="button" value="submit" onClick="return validate();">
    </form>
    put the above piece of code in the <body> tag
    2. Upon submit the js function validate() will be called :
    <script language="javascript">
    function validate() {
    if(document.frm1.txt1.value="") {
    alert("enter text");
    return false;
    else {
    document.frm1.submit(); // i am not sure whether the () after submit is required or not
    put the above piece of code in the <head> tag.
    3. Now when the submit happens, the control goes to the dbcheck.jsp
    this is dbcheck.jsp:
    <%
    String str = (String) request.getParameter("txt1");
    ------other db operations go here --------
    %>
    "txt1" is the field name of the textbox from the form u previously submitted.
    all da best

  • How to Pass values from XML to JSP??? Urgent Please Help me

    Hi guys,
    I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
    Looking for ur favourable reply.
    Thanks in advance,
    Sridhar

    in a servlet :
    parse your xml file (see how at the end of the post) and
    put the values you want in the request attributes
    request.setAttribute("value1", value1);
    ...redirect to the jsp
    in the JSP:
    get the wanted attributes:
    String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data
    http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm

  • Passing value from one jsp to another?

    how to pass value from one jsp to another? i have a value assigned in the link, i want to pass that value to another jsp page?
    please help with code?

    Instead of the value being passed, i am getting a null value.
    Here is my calendar code:
    <%@page import="java.util.*,java.text.*" %>
    <html>
    <head>
    <title>Print a month page.</title>
    </head>
    <body bgcolor="white">
    <%
                  boolean yyok = false;
                  int yy = 0, mm = 0;
                  String yyString = request.getParameter("year");
                  if (yyString != null && yyString.length() > 0)
                      try
                          yy = Integer.parseInt(yyString);
                                  yyok = true;
                       catch (NumberFormatException e)
                          out.println("Year " + yyString + " invalid" );
                  Calendar c = Calendar.getInstance( );
                  if (!yyok)yy = c.get(Calendar.YEAR);  
                         mm = c.get(Calendar.MONTH);
    %>
                  <table align="center">
                      <tr>
                  <td>
                       <form method=post action="calendar.jsp">
                          Enter Year : <select name="year">
    <%         
                 for(int i= yy;i<=2010;i++)
    %>
                  <OPTION VALUE= <%=i%> > <%=i%> </option>
    <%       
    %>
              </select>
                      <input type=submit value="Display">
                      </form>
                      </td>
                    </tr>
    <tr>
                     <table>
    <%!
    String[] months = {"January","February","March",
                    "April","May","June",
                    "July","August","September",
                    "October","November", "December"
    int dom[] =     {
                        31, 28, 31, 30,
                        31, 30, 31, 31,
                        30, 31, 30, 31
    %>
    <%
                int leadGap =0;
    %>
    <div id="t1" class="tip"><table border="4" cellpadding=3 cellspacing="3" width="250" align="center" bgcolor="lavender">
    <tr>
    <td halign="centre" colgroup span="7" style="color:#FF0000;">
    </colgroup>
    <tr>
    <td>
    <%
              GregorianCalendar calendar =null;
              for(int j=0;j<12;j++)
                        calendar = new GregorianCalendar(yy, j, 1);
                  int row = 1 ;
                  row = row + j;
        %>
              <table>
                <tr>
              <colgroup span="7" style="color:#FF0000;">
              </colgroup>
                </tr>
              <tr align="center">
              <th colspan=7>
                  <%= months[j] %>
                  <%= yy %>
              </th>
              </tr>
    <tr>
    <td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td>
    </tr>
    <%
        leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
        int daysInMonth = dom[j];
        if ( calendar.isLeapYear( calendar.get(Calendar.YEAR) ) && j == 1)
        ++daysInMonth;
        out.print("<tr>");
        out.print(" ");
          for (int h = 0; h < leadGap; h++)
           out.print("<td>");
          out.print("</td>");
        for (int h = 1; h <= daysInMonth; h++)
          out.print("<td>");
          out.print("<a href=desc.jsp>" + h + "</a>" );
          out.print("</td>");
        if ((leadGap + h) % 7 == 0)
            out.println("</tr>");
    out.println("</tr></table></div>");
    if( row%3 != 0)
    out.println("</td><td>");
    else
    out.println("</td></tr>\n<tr><td>");
    %>
    </html>I need to pass the value in 'h' to the desc.jsp page.
    my code for desc.jsp is :
    <html>
    <head>
    </head>
    <body bgcolor="lightblue">
    <form method=post action="Calenda.jsp">
    <br>
    <%= request.getParameter("h") %>
    <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
    <BR> <INPUT TYPE=SUBMIT VALUE="submit">
    </form>
    </body>
    </html>But i am not able to pass the value. The 'h' value contains all the date. i want to pass only a single date, the user clicks to the other page. please help

  • Passing values from javascript in pop up window to parent jsp

    Hi
    I am trying to pass values from a pop up window to the main window that popped this child window , with the idea to have the parent window refresh itself with value from pop up window.But the values are not going through.I do a request on the hidden variable but when the parent
    jsp refreshes , the variable is still null...
    The following is the code i have .
    Parent jsp:a.jsp
    <form name='summary'>
    <input type=hidden name=customerid value="">
    <input type="button" class="textButton" name="action" value="customerlist" onClick="javascript:openWin('b.jsp','800','350')">
    <script>
    function openWin(loc, w, h) {
    var newWin = window.openloc,"HTML",'dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h);
    newWin.window.focus();
    </SCRIPT>
    <%
    String optionVal = request.getParameter("customerid");%>
    var user = "<%= optionVal%>";
    </form>
    child jsp- b.jsp (pop up window)
    <script>
    function closer(){
    var val = document.formname.id.selected.value;
    window.opener.document.summary.customerid.value = val;
    window.opener.location.reload();
    </script>
    <form name = formname>
    <input type="text" name="id" value = ''>
    <input type="button" class="textButton" value="select"
    onClick="closer();window.close();">
    </form>
    Any ideas on what i am missing
    Thanks
    Arn

    use window.opener.document.forms[0].filedname.value = 'value u need to set'

  • Pass value from Java to Perl

    Anyone knows how to pass value from Java to Perl program?

    Did you write the perl program? Can you change it? Or are you trying to interface to something that already exists? This will limit your options, of course.
    Anyway the first option is simple. The java program does this:
    System.out.println("This is a line of input.");The perl program does this:
    while(<>)and in that block, $_ is assigned to each line of input.
    Then you can invoke both like this:
    $ java MyJavaProgram | perl MyPerlProgram.pl

  • Java Thread - difficulty while passing value from parent to child thread

    Hi All,
    I am calling a java program from a unix script .
    My oblectives are
    1)to pass value from scripts to main java class
    2)main class should create a child thread and pass data to child and should return control back to script
    3)child thread should run independtly of parent
    The calling unix script is part of process and hence should return control back to its calling script immediately.
    Findings
    1)Without passing data thru setter getter /constructor method to child thread my objectives are met
    2)When I pass the data from parent thread to child thread calling unix scripts wait till child thread finishesh its working
    call.scr
    java Main <list of Arguments>
    Main.java
    public class Main
                 public static void main(String args[]) throws Exception
                 String data2="Z";
                 String data1=null;
                 for(int i=0;i<args.length;i++)
                      data2=data2+","+args;
    data1=data2;
    Child cu=new Child();
    cu.setData(data1);
    data2=null;
    data1=null;
    cu.start();
    Child.javaclass Child extends Thread
    public String data;
    void setData(String data)
    this.data=data;
    public void run()
    ----------> processing on data
    I think due to passing of data from parent thread to child thread (Inter thread data communication/Inter process communication)
      the threads are not working as desired.
    Plz anybody can suggest something.....
    Thanx.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    aschin,
    You seem to be confusing Java Threads with Operating System Processes.
    If you want you're java program to run in the unix background then you'll need to run it in the unix background. Java (being o/s agnostistic) doesn't provide process manipulation functionality (which would include the ability to throw itself into the background, as a C program can) in the standard API, and it's hard to imagine any third party producing anything as low level as a process controler... so yeah, just start the java program in the background... and you'll need to workout some interprocess communication protocol... named pipes have worked well for me in the past, as they doesn't suffer from the quit same performance issues as real disk files.
    Good luck. Keith.

  • URGENT: Passing Array from JSP to a Stored Procedure

    Hi,
    Can some one please help me understanding how can I pass array from JSP page to a stored procedure in database.
    Thanks in advance.
    Jatinder

    Thanks.
    I tried ArrayExampla.java and was successful in passing array values to the stored database procedure.
    How can I use this class in JSP? Like I have first JSP where in I will collect input from the user and then submit it to the second JSP - that needs to call the ArrayExample.java to pass the values as array to the database.
    How should I call this java code in my second JSP?
    Thanks in advance.

  • Use context to pass value between JPF and Java Control

    hi,
    Can we use context to pass value between JPF and Java Control? It works if i m using InitialContext in the same machine but i dun think it will works if i put Web server and application server in different machine. Anyone have an idea how to do it?
    I also want to get the method name in the onAcquire callback method. Anyone knows how to do this?
    thks
    ?:|

    Hi.
    Yoy can the next options for make this:
    1. Pass your values in http request.
    example: http://localhost/index.jsp?var1=value1&var2=value2&var3....
    2. You can use a no visible frame (of height or width 0) and keep your variables and values there using Javascript, but of this form, single you will be able to check the values in the part client, not in the server. Of this form, the values of vars are not visible from the user in the navigation bar.
    Greeting.

Maybe you are looking for

  • Excise capture at Depot-J1IG

    Deal All, I am having depot sales scanrio.Steps are as follows Client will do stock transfer from Plant to depot. Say 100 qty I will Do MIGo at depot for 100 qty. then i will do J1IG i.e. capture excise invoice at depot to update RG23D,but in standar

  • Sales office in Customer line items

    Presently using FBL5N for details of customer line items. Now the user wants the customer details Sales office wise. Tried to change the selection views of logical database DDF used in this program but couldn't as it doesn't include table KNVV. SPRO

  • Custom dynamic action not firing

    Using Apex 4.2.2 on 11g I have a standard report A1 There is a column link on report A1 which refreshes chart C1 using a custom dynamic action. The column link on report A1  has the URL set to  javascript:$.event.trigger('RefreshTrend_2', [{key_2:'#C

  • How to set a condition to check if a field is been updated in workflow

    Hi, I have a scenario, wherein a workflow email will be triggered to a person only when a field (of type person/group) from the list is updated with the person's name.  Now I was trying to put a check condition to send the email only when the field i

  • Input Plug Dimensions HP Folio 13-1016TU

    Can anyone tell me the dimensions of the power input plug for the HP Ultrabook Folio 13-1016TU please? I am visiting an area in Africa with a dodgy power supply, so have ourchased an external battery - that way I don't have to connect the laptop to t