Passing an integer from servlet  to PERL

Hi,
I have a one problem. Iam having an film database(SQLPLUS) table and can get particular information from the database using filmId(using servlets).
Now I have to use Perl to know more information about the specific film. So Iam passing the filid to Perl and every time Iam using a different filmID I can see the URL in the perl page change to specific id's so I know the filmid is correctly passed. But for some reason the perl is not able to fetch the information from the database like the servlets. the perl is simply giving a blank HTML Page.
AM I PASSING THE filmis CORRECTLY IN TO PERL FROM SERVLET??
Thanks
The part of the servlet program is below.//Passing the ID(filmsid)
try
//Loop through results of query.
while(rs1.next())
String filmids = rs1.getString("ID");
out.println("<TR>");
out.println("<TD>" + rs1.getString("ID") + "</TD>");
out.println ("<TD><a href=cgi-bin/'trial2.pl?filmids="+filmids+"'>Click here to view comments </a></TD>");
out.println("</TR>");
the perl program is below too.//Getting the filmid's
$reg = "SELECT ID,Title,Price,Availability FROM FILMS1 WHERE ID =
/$filmsid/i
my $sql = $dbh->prepare($reg);
$sql->execute();
while (@row = $sql->fetchrow_array){
print "<TR align = center bgcolor=white> <TD>",$row[0],"</TD> </TR>";
print "</TABLE>";
#$exist=$sql->fetchrow_array();
#print "<H3> $exist is the value </H3>";
$sql->finish();
$dbh->disconnect();
print "</font>";
print "</body>\n";
print "</html>\n";

It doesn't seem to be that you're passing anything to Perl, at least not directly. Rather, you're creating a web page that has a link to a resource on a web server, and the resource is being serviced by a perl script.
This means that you can debug the two separately. First, confirm that the java servlet is producing the page, and in particular the link, correctly.
Then, fix the perl script as a separate step. I notice that you only quoted a fragment from your perl script; what you posted msy not run at all.
If you want help with a perl script, you're better off on a perl-centric forum. Put on your flame-retardant suit and head on over to comp.lang.perl.misc.

Similar Messages

  • How to pass a JavaBean from servlet to JSP?

    Hi there,
    I am working on a project that needs to handle quite a few client requests and I want to use the Front Controller pattern that is described in the J2EE pattern page.
    The steps described in the front controller pattern is that:
    1. A servlet (controller) process the client request.
    2. It calls the appropriate cammand object and the cammand object gets the data from the data source and returns a JavaBean that contains the required data.
    3. The servlet dispatch to the appropriate View (jsp page)
    4. The JSP page displays the data in the JavaBean to the user.
    However, I don't know how to pass the JavaBean from the servlet to the JSP page when the servlet forwards the control to the JSP page. Should I make the JavaBean with a request scope or higher? If so, how to uses it in the JSP page? Just refer by the ID of the JavaBean.
    If any one knows there is an example or tutorial on how to use this pattern, please let me know.
    Thank you !
    Regards
    Edmund

    Could you please give more info? i tried to do this, but always get a "Class not found exception":
    response$jsp.java:65: Class org.apache.jsp.TestBean not found. TestBean bean = null;
    although the class TestBean (no package name => defalt package) is in the WAR file and the Servlet seems to instantiate it (otherwise an exception would occur sooner in the TestServlet code).
    my JSP code is:
    <%@ page language="java" info="Response page" %>
    <jsp:useBean id="bean" class="TestBean" />
    <%
    TestBean bean2 = (TestBean) request.getAttribute("TheBean");
    %>
    <html>
    <body>
    Your value: <%= bean2.getValue() %><BR>
    My val: <%= bean2.getNewValue() %><BR>
    <P>
    Date: <%= new Date() %>
    <P>
    Neuen Wert eingeben
    </body>
    </html>
    --------------

  • Problem in Passing JTree object from Servlet pgm to browser

    Dear all:
    Can anybody help to resolve the problem - pass the JTree obejct from servlet (Tomcat) to IE 6.0. The JTree oject alway shows invalid charcter in IE. Following is my coding.
    import java.io.*;
    import java.awt.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.swing.*;
    import java.net.URL;
    import java.sql.*;
    import java.lang.*;
    import java.util.*;
    import javax.swing.tree.*;
    //* Testing1 give it null
    public class SimpleServer extends HttpServlet
    DefaultMutableTreeNode top;
    DefaultMutableTreeNode EX01;
    DefaultMutableTreeNode EX02;
    DefaultMutableTreeNode QB01;
    DefaultMutableTreeNode QB02;
    DefaultMutableTreeNode N2BS;
    DefaultMutableTreeNode N2TS;
    //StringTokenizer st2, st1;
    String query;
    Connection con ;
    Statement statm;
    ResultSet res, backupRes;
    //RowSet res, backupRes;
    TreeSet treeset ;
    String [] tempArray;
    //ServletContext sc ;
    ObjectOutputStream out ;
    DefaultMutableTreeNode temp_node;
         public void doGet(HttpServletRequest req, HttpServletResponse resp)
         throws ServletException, IOException
    resp.setContentType("text/html");
    // resp.setContentType("application/octet-stream");
    System.out.println("create main node") ;
              out = new ObjectOutputStream(resp.getOutputStream());
              out.writeObject(this.set_NodeMain()); //no DB access,
         public void doPost(HttpServletRequest req, HttpServletResponse resp)
         throws ServletException, IOException
         try
         System.out.println("doPost " );
         doGet(req,resp);
              finally
         public DefaultMutableTreeNode set_NodeMain()
    top = new DefaultMutableTreeNode("Tandem");
    EX01 = new DefaultMutableTreeNode("EX01");
    EX02 = new DefaultMutableTreeNode("EX02");
    QB01 = new DefaultMutableTreeNode("QB01");
    QB02 = new DefaultMutableTreeNode("QB02");
    N2BS = new DefaultMutableTreeNode("N2BS");
    N2TS = new DefaultMutableTreeNode("N2TS");
    top.add(EX01);
    top.add(EX02);
    top.add(QB01);
    top.add(QB02);
    top.add(N2BS);
    top.add(N2TS);
    return top;
    }

    JMO - I hate seeing things like this in code:
    Just use whitespace to separate the methods.
    You can't just send a JTree to a browser. A browser has no idea how to render a Java object.
    Put that JTree inside an applet and make it part of a JSP. That'll work.
    MOD

  • Passing XML payload from Servlet to JMS

    Hi All,
    My requirement is that servlet will receive the HTTP request , convert it into XML format and publish it to JMS queue.
    Now, I am stuck at the part where I need to publish the XML payload to JMS queue.
    Is it possible to send the XML payload from servlet to JMS queue? Is yes, please let me know how can we achieve this.
    Thanks

    I suggest you go to the following page: [http://edocs.bea.com/wls/docs103/pdf.html] .
    In the "Programming" section, download and read at least "Programming WebLogic JMS" and perhaps "Developing Web Applications, Servlets, and JSPs for WebLogic Server" and "Developing Applications with WebLogic Server".

  • Passing a variable from servlet to WML

    i need to send a variable to my wml content from java servlet.Is there any possibility of doing so?
    Thanks in advance

    Check out Help for loadVariables.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Please help how to pass a JavaBean from servlet to jsp?

    Hi there,
    I have got a dispatch servlet and I want the dispatch servlet to get the data and store it in a JavaBean before dispatching to the appropriate JSP page. However, I don't know how to pass the javabean to the JSP when the servlet forward the request to the JSP. Is ServletContext.setAttribute() the only way to pass the javabean to the JSP page?
    Thank you very much!
    Edmund

    You can use HttpServletRequest.setAttribute(String name, Object javabean) to set the javabean into the HTTP request that you are forwarding to the JSP.
    In the JSP, you can access the Javabean using request.getAttribute(String name) and cast it to the right class.

  • Passing database results from servlets to jsp

    Hi everyone,
    I have been trying to do what i thought would be a very simple thing...perform a search based on some criteria, and return the query result back to be displayed on a jsp page.
    I have a jsp page where some dropdown lists are populated on entry to the page. This works fine. I want to (eventually!) perform the search based on what is selected in these dropdowns. When i click the search button, i invoke a servlet called "SearchInventory.java" which gets the result. I then store this result in an ArrayList object. I then set a bean property (bean name->SearchBean, property->inventory) from within the servlet, and redirect back to the search page. This works if the query only gets back one column.
    Unfortunately, when i ask for more than one column in the query, i get a "java.lang.NullPointerException" error.
    Here is my code for all segments:
    JSP:
    <%@ page language="java" import="java.util.ArrayList,java.lang.*,java.sql.*,javax.sql.*,PopLists.PopInvLists,beans.SearchBean"%>
    <%
    SearchBean sbean=new SearchBean();
    ArrayList myAry=sbean.getInventory();
    int size=myAry.size();
    %>
    <%
              for(int i=0;i<size;i++){
                   String pname=(String)myAry.get(i);
         %>               
    <%}%>
    Servlet:
    String QueryStr="select ProdName,ManufName from products";// where ProdID="+ProdID;
    Statement stmt=conn.createStatement();
    rs=stmt.executeQuery(QueryStr);
    while(rs.next()){
         rowAry.add(rs.getString(1));
         rowAry.add(rs.getString(2));
         rowSetAry.add(rowAry.clone());
    sbean.setInventory(rowSetAry);
    req.getSession(true).setAttribute("s_resbean",sbean);
    res.sendRedirect("/DBTest/SearchInventory.jsp");
    In the servlet, i have also tried the following method of redirecting back to jsp page:
    String url="/SearchInventory.jsp";
    RequestDispatcher dispatcher=getServletContext().getRequestDispatcher(url);
    dispatcher.forward(req,res);
    ...this gives me a java.lang.ClassCastException
    here is my "bean" class:
    public class SearchBean extends HttpServlet{
         private int searchFlag=0;
         private static ArrayList inventory;
         public static ArrayList getInventory(){
              return inventory;
         public void setInventory(ArrayList rs){
              this.inventory=rs;
    When i perform a query that selects just one column, and doesn't use any sort of search fields for selecting, it does seem to work. for eg, : "select ProdName from products" as the query will return the product names successfully.
    Now, i realize what i'm doing is not correct....however, i don't know what the correct way of doing this is. Can someone please please show me how i should be going about doing all of this? It really shouldn't be difficult, but I just can't seem to get it to work.
    Thanks in advance,
    Aditya

    U have instantiated a search bean and populated its member variable i.e Array list , and added that bean to the session as an attribute. Then again why u need to instantiate the search bean in the jsp page.
    What has to be done.
    In the jsp page instead of instantiating the search bean ,get the search bean from the session attribute.
    statement to be removed : SearchBean bean=new SearchBean()
    statement to be added : SearchBean bean = session.getAttribute("bean");

  • How can we pass the control from servlet to portlet ?

    Hi,
    we use PortletRequestDispatcher.include method to call the servlet.
    In my servlet, I have the following form information.
    out.println("<form method=\"post\" action=\"http://abc 40acce5.3a.com/portal/dt?display=Command\">");
    out.println("Enter value: ");
    out.println("<input type=\"text\" name=\"UserName\" value=\"\">");
    out.println("<center> "); out.println("<input type=\"submit\" value=\"Go Back Portlet\"> ");
    out.println("</center> ");
    out.println("</form>");
    When user click the submit button, the servlet will go to portlet first, then go to another page.
    is the url (action="http://abc40acce5.3a.com/portal/dt?display=Command) correct ?
    if not, what url we should use ?
    Can you help ?
    Thanks!

    Oh I thought that you have selection-screen and again you are working on dialog programming.
    if you want to use select-option directly in module pool then it is not possible.
    but you can do other way.
    create two varaiables
    data : v_kun_low like kna1-kunnr,
             v_kun_high like kna1-kunnr.
    use these two variables in layout ,let user knows that he can not give options like gt,lt,eq ,it will be always BT.
    and also when you see normal report program,you can use multiple values in either low or high,but here it is not possibel.
    use can enter only low value and high value.
    when you come to program point of view
    declare one range
    ranges r_kunnr for kna1-kunnr.
    do the coding like
    r_kunnr-low = v_kun_low.
    r_kunnr-high = v_kun_high.
    r_kunnr-options = 'BT'.
    r_kunnr-sign = 'I'.
    append r_kunnr.
    now you can use r_kunnr in select query ,it will work like select-option.
    other than this there is no option.
    Thanks
    Seshu

  • Pass data from servlet to jsp using sendRedirect

    Hi,
    I am passing data from servlet to jsp using forward method of request dispatcher but as it doesn't change the url it is creating problems. When ever user refreshes the screen(browser refresh) it's re-loading both servlet and jsp, which i don't want to happen. I want only the jsp to be reloaded.
    Can I pass data from servlet to jsp using sendRedirect in this case. I also want to pass some values from servlet to jsp but without using query string. I want to set some attributes and send to jsp just like we do for forward method of request dispatcher.
    Is there any way i can send data using attributes(without using query string) using sendRedirect? Please let me know

    sendRedirect is meant as a true redirect. meaning
    you can use it to redirect to urls not in your
    context....with forward you couldn't pass information
    to jsps/servlets outside your own context.Actually, you can:
    getServletContext().getContext("/other").getRequestDispatcher("/path/to/servlet").forward(request, response)I think the issue here is that the OP would like to have RequestDispatcher.forward() also update the address in the client's browser. That's not possible, AFAIK. By the time the request is forwarded, the browser has already determined the URL of the servlet, and the only I know of way to have the browser change the URL to the forwarded Servlet/JSP is to send a Location: header (i.e. sendRedirect()). Remember that server-side dispatching is transparent to the client. Maybe there's some tricky stuff you can do with JavaScript to change the address in the address bar without reloading the page?
    Brian

  • 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

  • Best practice from passing messages from servlets

    Is there a best practice for passing user messages (typically errors) back to the page from servlets?
    e.g. http://localhost:4502/content/geometrixx/en.html?message=Some user error message
    Dan

    Well I suppose that answer to that question depends somewhat on your requirements, but I would say using a query string as you have indicated would be less than ideal because the page with the message would not be cached. No depending on your requirements and what sort of message you are passing that might be OK - especially if you message is highly personalized.
    If however you have a limited number of standard messages to display a more common approach is to have each message have it's own page and then to configure the servlet to redirect to the appropriate page based on the desired message.
    If you want the user to end up on the same page they submitted to the servlet from then another common approach would be to have the post to the servlet be AJAX and then display the message client side without having to change the URL.

  • How to pass session from Java to Perl

    Hi,
    I need to pass a session value from Java to Perl, does anyone knows how can I do it?
    Thanks

    If you want to run java code from Perl, and have it return a single value, that's one thing: but having Perl interact with java code - calling methods, returning values - that may not be possible.
    Look into python to see if it may be what you're looking for. It's a scripting language that allows real interaction with java.
    If all you want to do is run java code and have it return some data, that would be trivial, so I assume that's not what you mean. But in case it is heres an idea:
    Set up a network connection between them with your own protocol, seeing as both languages are good at networking.

  • Want to pass 2D integer array from VB 6.0 to LabView (v 8.0) DLL

    I was able to pass 1D arrays from VB 6.0 to LabView 8.0 with no problem.  I checked the literature for help regarding 2D arrays and found
    scant help unless it was for VB.NET, C or single dimensional arrays.  Thanks.
    I wrote a simple test VB program to pass 2D arrays shown below after which I get a memory crash:
    Private Declare Sub Test2D Lib _
        "C:\Documents and Settings\Owner\My Documents\builds\Test2DArray\Test2DArray\Test2DArray.DLL" _
        Alias "Test2darray" (ByRef varInArray As Variant, ByRef varOutArray As Variant)
    Private Sub cmdStart_Click()
        On Error GoTo handle_error
        Dim intInArray(8, 8) As Integer
        Dim intOutArray(8, 8) As Integer
        Dim varInArray As Variant, varOutArray As Variant
        Dim i As Long, j As Long, k As Integer
        For i = 0 To 7
            k = i * 8
            For j = 0 To 7
                intInArray(i, j) = k + j
            Next j
        Next i
        varInArray = intInArray
        varOutArray = intOutArray
        Test2D varInArray, varOutArray
        Exit Sub
    handle_error:
        MsgBox Err.Description, , ""
    End Sub
    In the Labview DLL I have a definition of the exported function call as:
    void Test2darray(TD1Hdl * InArray, TD1Hdl * OutArray)
    (in the Labview DLL I take the input array, add 1 to each of the elements and then stuff it into the output)

    jd162,
    The following discussing forum may help out:Pass array to "Labview 7" DLL in Visual Basic . Let us know if this helps out at all.
    Chris C
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect

  • How to pass parameters/atrributes to Servlet from ALBPM

    HI Friends,
    I am invoking servlet from bpm using server configuration, i am able to invoke servlet, but not able to pass parameters dynamically,
    Also I like to receive response parameters/attributes from servlets?
    Can any body help me on this?
    Look forward for response.
    Cheers

    Some helpful Docs on the WebServer component for you:
    The WebServer component is used to send HTTP requests to an HTTP server and capture the responses. It supports HTTP methods GET and POST.
    The body of the HTTP response is available in the WebServer.response attribute (String).
    Note: This component is superseded by the Fuego.NetX.AdvancedWebServer component, which provides better performance and more functionality like support for proxies and for more HTTP methods (like PUT and DELETE).
    Example: Get Oracle's website home page and save it to a file.
    getFrom(WebServer, url : "http://oracle.com", args : null)
    binaryResponse = Binary(text: WebServer.response,
    encoding: "UTF8")
    BinaryFile.writeFromBinaryTo(data : binaryResponse,
    name : "/tmp/oracle_index.html",
    append : false)

  • Parameter passing from servlet to jsp page

    Hi
    I m facing problem of parameter passing from servlet to jsp ..
    plz help me...
    I m using as ...
    in servlet code I m using ...
    request.setAttribute("string",parameter);
    and in jsp..
    request.getParameter("string");
    regard's
    JAI KUMAR

    Hi Jaykumar
    You should use
    <%= request.getAttribute("sting") %> or
    ${string}
    in your jsp. I think you are trying to retrive the parameter instead of attribute.
    Thanks

Maybe you are looking for

  • When I Drag Loops To The Loop Browser...

    All my loops are in the folder /Library/Application Support/GarageBand/Apple Loops. I dragged them over from the finder to the loop browser in GB, and it looks like it copied all of them to another folder user/Library/Audio/Apple Loops/User Loops/Gar

  • Selecting a Text Frame in another file (JS/CS3)

    Hi, I'm a newbie so this is probably a dumb question. I'm trying to copy the contents of a text frame in another ID file and copy/paste them into another text frame of my active document. Every example I find creates a NEW text frame and copies it an

  • XML show form error

    Hello All, I am trying to develop an XML form wherein Edit form i have an HTML editor and in Show form i want to display the message that in edited in Edit form. But when i run the Show form, i text is displayed like this: <FONT color=#242424><STRONG

  • "Data Left Behind" Does Safari 4 Final resolve this issue from the Beta?

    Sorry for the possibly annoying duplication. I'm making this a separate post, since it's a different topic entirely. Was already included in http://discussions.apple.com/message.jspa?messageID=9587144#9587144 Does anyone know if these issues, where 4

  • Can someone tell me if this is a good product for the mini?

    Go to this website (you have to copy/paste into your web browser): http://cgi.ebay.com/Apple-MAC-mini-80GB-HD-Backup-Firewire-USB2-0-HUB_W0QQitemZ5 808009357QQcategoryZ80044QQtcZphotoQQcmdZViewItem it's an external 80 GB hard drive for the mini, and