File problem using jsp

I need help. I need to create a file browser for user to select the file in the explorer. How can i add one in jsp page? Also, how can i open and read the file?

Caiyun,
Look at the multipart request servlet example in oreilly.com or in any of the server packages./ Those examples do exactly what u want. Show a File box, read the contents and store it in the server.

Similar Messages

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • File download using jsp

    I am trying to download a file from the server using jsp but it always shows the file in the browser.I want a Save/Open dialog box to allow the user to save this file in the local system. any feedback is welcome.
    thanks in advance
    vinod

    Basically out frame work is in struts.........
    In struts for file down load I wrote the code as
    String fileName = <file name>;
    String filePath = <file path>;
    String fileType = fileName.substring(dotIndex+1,fileName.length());
    ServletOutputStream out = httpservletresponse.getOutputStream();
    if (fileType.trim().equalsIgnoreCase("doc"))
    httpservletresponse.setContentType( "application/msword" );
    else if (fileType.trim().equalsIgnoreCase("xls"))
    httpservletresponse.setContentType( "application/vnd.ms-excel" );
    else if (fileType.trim().equalsIgnoreCase("pdf"))
    httpservletresponse.setContentType( "application/pdf" );
    else if (fileType.trim().equalsIgnoreCase("ppt"))
    httpservletresponse.setContentType( "application/ppt" );
    else
    httpservletresponse.setContentType( "application/octet-stream" );
    httpservletresponse.setHeader("Content-disposition", "attachment; filename=" +actualName );
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filePath));
    BufferedOutputStream bos = new BufferedOutputStream(out);
    byte[] buff = new byte[2048];
    int bytesRead;
    while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
    bos.write(buff, 0, bytesRead);
    I hav written this in seperate function which returns boolean true If this works correctly otherwise fase.
    If it is 'true ' I am forwarding it to 'success.jsp' else'fail.jsp'....................
    Now problem is It is not forwarding to any other pages and giving error as "Illegal state .can not forward.Response already committed."
    I think this error is coming becos of 'response.setHeader()' and using out object.........
    Please give me any solution for this problem.........Since I am strucked here.It is urgent for me to do...................................
    I don't mind If u giv any alteernative code for this..............
    Thanx in advance..................
    Plz. respond quickly...................

  • Error in File uploading using jsp

    I am tring to upload files to a mysql database using jsp.I have used BLOB type to store files.Iam using the JDBC driver mysql-connector-java-2.0-14-bin to connect the database with the jsp API.My problem is when i try to transfer a file of size which is less than the possible capacity through blob ,which is 1048576 bytes ( for example when a file of size 916KB is attempted to transfer) the following error is being generated.
    java.lang.IllegalArgumentException: Packet is larger than max_allowed_packet from server configuration of 1048576 bytes
         at com.mysql.jdbc.Buffer.ensureCapacity(Unknown Source)
         at com.mysql.jdbc.Buffer.writeBytesNoNull(Unknown Source)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(Unknown Source)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(Unknown Source)
         at org.apache.jsp.file3$jsp._jspService(file3$jsp.java:110)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:484)
    java.lang.IllegalArgumentException: Packet is larger than max_allowed_packet from server configuration of 1048576 bytes
         at com.mysql.jdbc.Buffer.ensureCapacity(Unknown Source)
         at com.mysql.jdbc.Buffer.writeBytesNoNull(Unknown Source)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(Unknown Source)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(Unknown Source)
         at org.apache.jsp.file3$jsp._jspService(file3$jsp.java:110)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:484)
    My uploading code in jsp is as follows.
         <% try{
              Class.forName("org.gjt.mm.mysql.Driver").newInstance();
              Connection dbCon = DriverManager.getConnection("jdbc:mysql:///uoc");
              out.println("Connection done !");
              Statement stmt = dbCon.createStatement();
              out.println("Statement Created !");
    ResultSet rs = stmt.executeQuery("SELECT * FROM blob_test)
    stmt.close();
    dbCon.close();
    out.println("<br><br> <b>Data Successfully selected !<b>");
    } //try
    catch(SQLException e){
         out.println(" <br> ");
         out.println("Sorry ! problem in selecting a data "+e.toString());
         out.println(" <br> ");
                   e.printStackTrace();
    %>
    Please help .I thank You in advance for any help .

    Have you tried increasing the BLOB field greater than 1048576 or using a smaller file of say 1 or 2k as a test? There is no guarantee that the database will store the file with exactly the same size as the file on the filesystem, so the file might be more than 916k in the database.
    Using BLOBs is a great way to destroy the performance of your database by the way :)

  • Problem using jsp:forward in java script

    hi,
    when I use jsp forward tag inside java script i'm getting a problem that
    when the jsp is invoked it is getting forwarded to the page specified in the forward tag, without checking the if conditions. Following code may give you a better idea.
    <html>
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    <jsp:forward page="success.jsp" />
    </script>
    <body>
    <form name="f" method=post>
    <input type=text name=htemp value="true">
    <input type=button onclick="test()">
    </form>
    </body>
    </html>
    please help me,thanks inadvance
    regards
    chandu

    What pgeuens means is that you can't mix javascript and jsp/java code in this way.
    ALL of the jsp/java code gets executed at the server end.
    This produces an HTML page (with embedded javascript) which gets sent to the client.
    The client then runs javascript code in response to events (onLoad, onClick, onChange etc etc)
    So in this case, the jsp:forward will always be executed, because as far as the server is concerned, the javascript is just template text.
    If you WANT to do a conditional forwarding on the server side you do it in java ie (horribly using scriptlet)
    <%
    if (testCondition){
    %>
      <jsp:forward>
    %<
    %>Or if you want to test what the client has entered client side, all you can do is submit the form, or navigate to a URL
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    document.f1.action="success.jsp";
    document.f.submit();
    </script>You cannot run JSP code based on your javascript code.
    Java. Javascript. Not the same thing.
    Hope this helps,
    evnafets

  • A peculiar problem using jsp:include conditionally

    Hi,
    This is regarding usage of jsp:include in Myfaces 1.1.4.
    lets say the page containing the jsp:include statements as PARENT PAGE
    I have a requirement to display some components in the PARENT PAGE which are continued from the same form using different JSPs since the components are different based on a condition.
    I used the following code:
    <h:panelGrid id="CandidateRequestorView" rendered="#{RgsViewRequirementBB.displayCandidateView}" columns="1">
         <jsp:include page="/RGSPages/requestorViewReq.jsp"/>
    </h:panelGrid>
    <h:panelGrid id="CandidateMatcView" rendered="#{!RgsViewRequirementBB.displayCandidateView}" columns="1">
         <jsp:include page="/RGSPages/matcViewReq.jsp"/>
    </h:panelGrid>Now if I use only 1 panel grid (any one out of the above 2) it works. I didnt even use <f:subview> any where( neither in the PARENT PAGE nor in the included jsps), but it works.... Also for your knowledge these jsps contain only JSF elements( no plain HTML code is used)
    But if I am using the above displayed code to have both the jsps (actually only one will be displayed bcoz the same condition is used)
    then its not displaying all the contents of included jsp. (YES I AM ABLE TO GET TO THE JSP...THERE IS NO ERROR) There is a datatable inside this jsp which is not rendered......
    I have used <f:subview> when i faced this problem.......
    I have tried every combination....writing <f:subview> in the PARENT PAGE ....writing in included jsps and removed it from PARENT PAGE.....also some of the articles in the forum mentioned that <f:subview> element should not be used inside <h:panelgrid> .....i even tried that....but final result is same as I was getting the first time...
    I am able to reach the jsp page (with or without <f:subview>) but i am not able to display all the contents....but if i use only one of the included jsps(by removing any one of the panel grids) I am able to view them. Since I am able to view all the contents when i view these pages inside the PARENT PAGE one at a time, that indicates there is no problem in datatable contained in these pages.....
    ( Also I have not used <f:view> inside my included jsps.)
    Please help to solve this problem...
    Thanks
    Avner

    Hi BalusC,
    The RgsViewRequirementBB is already in the session scope.
    Also I am using the setDisplayCandidateView(true) or setDisplayCandidateView(false ) explicitly as depicted below. The page is still under construction thats why the rendered attribute is explicitly set.
    public RgsViewRequirementBackingBean() {
    super();
    // TODO Auto-generated constructor stub
    try{
                setDisplayCandidateView(true);
                 // some more code goes in here
         catch(Exception){
               ResourceBundle bundle = null;
               bundle = ResourceBundle.getBundle("resources.ErrorMessages", FacesContext.getCurrentInstance().getViewRoot().getLocale());
                 //some more code goes in here
    }

  • Jar File Problem Using External Packages

    I am having problems creating an Executable jar file that imports classes from my own package.
    I can create an exe jar no problem without using any external packages, but when I use an external package the jar will not execute.
    I am using WindowsXP, my package is in,
    C:/MyClasses/Database
    the class files are stored loose, not in a jar file
    I have tried altering the class-path in the manifest file, but to no joy - I may have not changed the classpath correctly!
    Please help
    Magic

    This is a mine field of "correct programming style."
    External jars, if very general, could be placed in the directory jre/lib/ext.
    In some cases you can unzip the external jars and add them to your own jar.
    The manifest.mf migth be looked into, and of course you need to communicate your patching!
    As you remarked, it might be a problem of class path usage.
    For that the jar tool documentation might explain it better than I.

  • Problem using jsp to query MS SQL server database

    I have a database already set up with columm EventID being int (integer). I use the following code to retrieve data:
    int TestNumber=123;
    String sqlqry = "select Date, starttime, endtime from timeTable where EventID = TestNumber";
    PreparedStatement pstmt = null;
    ResultSet result = null;
    pstmt = con.prepareStatement(sqlqry);
    result = pstmt.executeQuery();     
    It does not work. But in String statement, I replace TestNumber by a specific number as follows, it works fine
    String sqlqry = "select Date, starttime, endtime from timeTable where EventID = 123";
    Anybody can help, thanks a lot.

    Learning how to program by using JDBC and JSP is going to be very difficult.
    It does not work.It tells you why if you print the exception.
    1. int TestNumber=123;
    2. String sqlqry = "select ... from timeTable where EventID = TestNumber";
    The literal 'TestNumber' in lines 1 and 2 have absolutely NOTHING to do with each other. In line one it is a java variable. In line two it is an sql identifier which has no meaning and thuse it will cause an exception.

  • I can't get a 'real' file excel using jsp

    I have a page as this:
    <%
         response.setContentType("application/vnd.ms-excel");
         response.setHeader("Content-Disposition","attachment;filename=c.xls");
    %>
    <html><head></head><body>
    i'm writing on a excel file
    </body></html>
    when the browser execute this page there are 2 options:
    open the file c.xls or save it.
    i have noticed that if i save (or i open and then save) this file on my computer i don't get a 'real' excel file.
    in fact if i open this file with notepad and look at the code i find this code:
    <html><head></head><body>
    i'm writing on a excel file
    </body></html>
    then i open the file saved on my computer and i save it again with the file-type set on Cartella di lavoro Microsoft Excel(i don't know the translation for the english/american version of Excel); now i have a 'real' file excel and if i open with notepad the code is something as a lot of strange characters.
    Why by default the file is saved as Pagina Web(the translation is Web Page)??
    And how can i get(if it is possible) that the file is saved by default as a Cartella di lavoro Microsoft Excel(a 'real' file excel)???
    thanks and sorry for my bad english

    No kidding? Really?! I'm shocked as sh*t.
    It's saving exactly, no more and no less, then you are giving it. You are writing out:
    <html><head></head><body>
    i'm writing on a excel file
    </body></html>
    So that's what you get. ....
    I think I see you're mistake. I guess that you think that by specifying this line:
    response.setHeader("Content-Disposition","attachment;filename=c.xls");
    That the server is magically going to open this file for you and attach it to the response. Well, that's not in any way shape or form how it works. Setting headers set's a header in the response that the server sends to the browser. The browser looks at it and says "oh, the content of this page is a file called "c.xls". The content of the file is the "<html> ..." stuff that you write. If you want to write an Excel file, then you should open the Excel file and write it out.
    But you should also probably not do this in a JSP page, but in a servlet for several reasons, all of which are discussed in several threads in this forum which you could undoubtedly find by searching for "download servlet".

  • Data upload to .XLSX file - problem using OLE2 object ?

    Hi all,
    Currently my abap program is able to upload data from .xls excel file  to internal table using OLE2 object.
    But it is not doing the same with the .XLSX excel 2007 file.
    I need to upload data from .XLSX file to internal table using OLE2 objects.
    Is it possible ?. If yes kindly help me in solving this issue.

    Yes it is Possible

  • Compile source file problem using Windows ME

    After editing the variable value PATH to,
    c:windows;c:\windows\command;c:\jdk1.3.1\bin and saving file HelloWorldApp.java(from First Cup of Java;Sun tutorial)to c:\java .I proceed with the tutorial but haven't got a clue what command to put after c:\windows> (in the MS-DOS Prompt window I am now at)..in order to view HelloWorldApp.java so that I can compile.(I've tried putting cd as per tutorial but get 'bad command or file name' appearing on the screen).
    Detailed help very much appreciated!!

    If I may ask:
    How new to java are you?
    I remember the feeling well.
    If you have installed the java SDK and set your path, then restarted your machine so that the startup process recognizes your new path.
    ... probably done, since time has gone by...
    Then saved your : something.java file to a directory.
    You start a dos session and navigate to your :
    C:\documents\javaStuff directory where you will see:
    Something.java exists.
    Then you ask the java compiler to compile your code with:
    javac something.java
    which creates something.class
    [look familiar from the first line    class something{  etc.
    then run the program with:
    java something   [ it knows to only run a .class file]
    Is this the level of information which youseek??
    Hope so!
    Remember! Stay in the Puzzle Somehow!

  • Help in using JSP: Urgent As Project dues soon

    Hello Guys, i am new here. I got some problems using jsp. My main project is about a webpage where there is login and password for users. But, I can GO to a certain JSP page without LOGINING in. For example, i got a jsp page for customer to buy and sell things, the page that process my buy & sell can be viewed without the customer logging in. Anyone can help me? Thanks Alot.

    Hello Guys, i am new here. I got some problems using jsp. My main project is about a webpage where there is login and password for users. But, I can GO to a certain JSP page without LOGINING in. For example, i got a jsp page for customer to buy and sell things, the page that process my buy & sell can be viewed without the customer logging in. Anyone can help me? Thanks Alot.

  • Bizarre thread problem with JSP

    I'm having a strange problem using JSPs whereby a single method call to a
              bean results in 2 execute threads being created each executing the method
              called.
              I have a bean reference in the jsp that has session scope declared like this
              (package names left off):
              <jsp:useBean id="deployment" class="Deployment" scope="session">
              <% deployment.init(application); %>
              </jsp:useBean>
              I've also set the isThreadSafe value to "false" (since I'm trying to
              prevent/figure out what's going on):
              <%@ page isThreadSafe="false" %>
              Within the JSP body I have code that makes the method call on the deployment
              bean:
              if (action.equals("Send"))
              int status = deployment.send();
              Then, within my form I have:
              <INPUT TYPE="image" SRC="../images/Deploy.gif"
              onClick="confirmAndSubmit('Send',
              'Deploying Application to server <%=
              deployment.getServer() %>')"/>
              Where the functions called are:
              function setActionSubmit(action) {
              document.deployForm.actionPerformed.value = action;
              document.deployForm.submit();
              function confirmAndSubmit(action, promptString) {
              if (confirm(promptString)) {
              setActionSubmit(action);
              Tracing, thread dumping, et al, have confirmed that although I have a single
              session, I end up with two threads each executing the deployment.send()
              method.
              Any ideas? I'm stumped.
              Thanks,
              Jim
              

    I found the problem, although I don't completely understand the behavior:
              The FORM was not handling the submit event, leaving it to the whim of the
              browser to have its way with the event. Although it sometime ended up
              having two threads serving the request, it didn't always.
              The solution was to put an onSubmit=="return false;" in the <form>
              Hope this helps someone else.
              Jim
              "Jim Gish" <[email protected]> wrote in message
              news:[email protected]...
              > I'm having a strange problem using JSPs whereby a single method call to a
              > bean results in 2 execute threads being created each executing the method
              > called.
              >
              > I have a bean reference in the jsp that has session scope declared like
              this
              > (package names left off):
              >
              > <jsp:useBean id="deployment" class="Deployment" scope="session">
              > <% deployment.init(application); %>
              > </jsp:useBean>
              >
              > I've also set the isThreadSafe value to "false" (since I'm trying to
              > prevent/figure out what's going on):
              > <%@ page isThreadSafe="false" %>
              >
              > Within the JSP body I have code that makes the method call on the
              deployment
              > bean:
              > if (action.equals("Send"))
              > {
              > int status = deployment.send();
              > }
              >
              > Then, within my form I have:
              > <INPUT TYPE="image" SRC="../images/Deploy.gif"
              > onClick="confirmAndSubmit('Send',
              > 'Deploying Application to server <%=
              > deployment.getServer() %>')"/>
              >
              > Where the functions called are:
              > function setActionSubmit(action) {
              > document.deployForm.actionPerformed.value = action;
              > document.deployForm.submit();
              > }
              >
              > function confirmAndSubmit(action, promptString) {
              > if (confirm(promptString)) {
              > setActionSubmit(action);
              > }
              > }
              >
              > Tracing, thread dumping, et al, have confirmed that although I have a
              single
              > session, I end up with two threads each executing the deployment.send()
              > method.
              >
              > Any ideas? I'm stumped.
              >
              > Thanks,
              > Jim
              >
              >
              >
              >
              >
              

  • How to open a pdf file in a web browser using jsp

    Hi,
    I have a problem opening pdf file in browser using jsp.the following is my code.Can anyone help me.Thanks
    response.setContentType("application/pdf");
    String filename="C:\\FictPos\\mypdf.pdf";
    File file = new File(filename);
    FileInputStream in = new FileInputStream(file);
    OutputStream out1=response.getOutputStream();
    byte[] buf = new byte[4096];
    int count = 0;
    while ((count = in.read(buf)) >= 0)
    out1.write(buf, 0, count);
    in.close();
    out1.close();
    }

    Don't know the problem specifically, but here are some suggestions to investigate:
    Does it show anything in the page when you view source on it?
    I would recommend using a servlet rather than a JSP page for this, if only for the fact the JSPs can insert carriage returns into places where you might not want them to. This might screw up the PDF file format?
    Try setting the a link to the jsp, right-click and "save target as..." just to see if it gets any response at all - ie bypass the browser display.
    Good luck,
    evnafets

  • Problem using Resource Bundle in XSLT File

    Hi All,
    I've been trying to use Resource Bundle on my XSLT file with no success for the last 2 weeks. So I would like some help to definitely end this problem.
    The fact is that i have a property file that i would like to read and it works fine when i use jsp or a servlet however when i try to call the same property file using my XSL i get the message below:
    java.util.MissingResourceException: Can't find bundle for base name thoth, locale en_US
    Follow the code from my Stylesheet that i'm calling the resource bundle:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="java.util.ResourceBundle" exclude-result-prefixes="java" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" indent="yes" version="4.0"/>
    <xsl:output encoding="ISO-8859-1"/>
    <xsl:template match="page">
    <html>
    <body>
    <xsl:apply-templates select="paragraph"/>
    <xsl:variable name="resources" select="java:getBundle('thoth')"/>
    <xsl:value-of select="java:getString($resources,'general.title')"/>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet. Should i have to put it some other place? Do i have some other way to read this file and show the information from the file?
    I would appreciate any help
    thanks in advance and Regards
    Fabio

    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet.
    Is the property file in your classpath? or whether the directory where the property file is residing is in your classpath. Please put only the directory where the property file is located in the classpath and try again.
    It may be working fine with the servlet because j2ee servlet containers put the classes and lib directory automatically in the classpath therefore resource bundle gets loaded even without putting it explicitly in the classpath. This doesn't happen when you try to test some component from the console.
    Let me know if this does not work.
    regards,
    Abhishek.

Maybe you are looking for

  • Lock ups and general lag

    Hi guys, Has anyone had any issue with the phone locking up/freezing on them? Its happened to me the last couple of nights now... I've been browsing the menus and it just slows down and becomes unresponsive and laggy. Barely usable! I have to shut do

  • How can I change the default save folder in MP Navigator for saved scans?

    I am using MP Naqvigator with my Canon MP600 multifunction device and saving to an external drive is clunky because each time I save a document I have to browse to the device and the destination folder. I have tried to find a way of setting the defau

  • Passing Variable in CFGRID

    Hi I am usin coldfuison 9 and have a grid that gets poplulated by a query in a .cfc The queries work and the grid poplulates except when I try to add a hyperlink to a field that should link to a detail page. Here is my code I am an beginner working o

  • How create SQL for Cross tab in template

    Hi, I have been starting to build data templates using SQL to select the data I require. I noticed in the word template-building tool there is an option to create cross tab table. I have tried looking at the standard documentation. I have been unable

  • OpenCL disabled in CC2014 PS but active in CC PS and CS6 PS ?

    Mac Pro 5,1 48GB, Radeon 7950 Mac version, OpenCL is disabled in CC2014 but active in both CC PS and CS6 PS. I also ran the OceanWave benchmark and it appears to be within spec. I think that all drivers are in OS and none available to install indepen