[MapViewer] MapClient.jsp to Servlet?

Hi,
Has anybody ever tried to convert the demo that comes with MapViewer into a servlet?
Right now the MapClient.jsp demo is very slow here, and I hope to get some speed improvements with a servlet. I also think it's a little easier to add some extra functionallity with a servlet...
So, has anybody done it?

You may want to first find out what's slowing down the jsp client. Most likely its the database query time dominating the performance, in which case converting the jsp into servlet wont help much.
you can change the logging level of MapViewer to "finest" and check the logs while doing a few zoom/pans from the client. see how much time is spent in loading the data from db and what's the percentage of that in the overall process.
lj

Similar Messages

  • MapViewer mapclient.jsp?

    Hi,
    I've been working with MapViewer for a while now, and now is the time de make my own .jsp page. So I'm trying to figure out how the mapclient.jsp page works.
    I can't figure the part out about the "click to recenter". How does the applet knows where my mousepointer is? Where is imageCenter.x and .y defined?
    How does the Servlet make the new image url?
    Can anyone explain?

    HI:
    An input element of the "image" type in the form is set up as follows:
    <input type="image" src="<%= imgURL %>" name="imageCenter"
    width="<%= width %>" height="<%= height %>"
    alt="Click to Recenter at This Position">
    This input field creates a graphical "submit" button. The value of the src attribute specifies the URI of the image that will decorate the button. The alternate text provides a tool tip when the mouse is on the image. The width and height are are size of of the image when it is displayed in a browser. The name attribute gives a name to this control.
    When a mouse is used to click on the image, the form is submitted and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. (The upper-left corner of the image is at coordinate (0,0).) The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.
    At the beginning of the mapclient.jsp source code, the x and y are fetched from the standard input stream, and the new map center (cx, cy) is computed.
    if (request.getParameter("imageCenter.x")!=null &&
    request.getParameter("imageCenter.y")!=null &&
    cx!=0.0 && cy!=0.0) {
    imgCX = Integer.valueOf(request.getParameter("imageCenter.x")).intValue();
    imgCY = Integer.valueOf(request.getParameter("imageCenter.y")).intValue();
    //mapResponse = mapResponse +
    // "Computing new center from screen coords("+imgCX+","+imgCY+")\n";
    cx = boxLLX+imgCX/width*(boxURX-boxLLX);
    cy = boxURY-imgCY/height*(boxURY-boxLLY);
    Hope it help.
    Regards,

  • MapViewer Demo - mapclient.jsp

    Hi,
    I have installed mapviewer demo on a standalone OC4J. I added a datasource "mvdemo". I can get other jsp's to work: jview.jsp, mapinit.jsp and tagmap.jsp but when I go to mapclient.jsp and enter the datasource field along with Map Center X and Y, I just get a blue blank screen. Do I need to enter anything for Map Base field. Also, I am not getting any error messages.
    On OC4J window, I get only message that says "no theme to render".
    here is the request:
    <?xml version="1.0" standalone="yes"?>
    <map_request
    datasource="mvdemo"
    width="500"
    height="375"
    bgcolor="#a6caf0"
    antialiase="false"
    format="GIF_URL">
    <center size="100.0">
    <geoFeature>
    <geometricProperty typeName="center">
    <Point>
    <coordinates>-74.0,43.0</coordinates>
    </Point>
    </geometricProperty>
    </geoFeature>
    </center>
    </map_request>
    and response:
    <?xml version="1.0" encoding="UTF-8"?>
    <map_response>
    <map_image>
    <map_content url="http://localhost:8888/mapviewer/images/omsmap2_11.gif?refresh=9095605334584782896" />
    <box srsName="default">
    <coordinates>
    null </coordinates>
    </box>
    <xfm matrix="1.0 0.0 0.0 1.0 0.0 0.0" />
    <WMTException version="1.0.0" error_code="SUCCESS">
    </WMTException>
    </map_image>
    </map_response>
    Also, here is more info on what I am using:
    mapviewer for 10.1.2
    Stand alone OC4J - J2EE 10g (9.0.4.0.0)
    Database - 10g Release 1
    Thanks,
    -A

    I do not see basemap in your XML request. You are trying to see entire US extents. Try with smaller size such 1.00.
    The following is the XML request I used.
    <?xml version="1.0" standalone="yes"?>
    <map_request
    title="test"
    basemap="demo_map"
    datasource="mvdemo"
    width="500"
    height="375"
    bgcolor="#a6caf0"
    antialiase="false"
    format="GIF_URL">
    <center size="100.0">
    <geoFeature>
    <geometricProperty typeName="center">
    <Point>
    <coordinates>-74.0,43.0</coordinates>
    </Point>
    </geometricProperty>
    </geoFeature>
    </center>
    </map_request>
    The following is the XML response.
    <?xml version="1.0" encoding="UTF-8"?>
    <map_response>
    <map_image>
    <map_content url="http://mycomputer:8888/mapviewer/images/omsmap35_110.gif?refresh=8522609524205187237" />
    <box srsName="default">
    <coordinates>
    -140.66666666666666,-7.0 -7.333333333333343,90.0 </coordinates>
    </box>
    <xfm matrix="0.2666666666666666 0.0 0.0 -0.2666666666666666 -140.66666666666666 91.49999999999999" />
    <WMTException version="1.0.0" error_code="SUCCESS">
    </WMTException>
    </map_image>
    </map_response>

  • Display map in mapclient.jsp

    i really have done create base map and theme using map builder. i can display map using sample map request. but when i want to dispaly map using mapclient.jsp there is no map, only background and title were display. how i can dispaly map using mapclient.jsp?

    Verify the parameters that you entered on mapclient.jsp page.
    1) Data source name must exists on MapViewer service
    2) Base map name must exist on data source
    3) Center and size should define an area that intersects with base map data.
    If you think the parameters that you entered are right, then take a look on MapViewer's log for additional messages.

  • PL/SQL vs JSP vs Servlets

    We are in the stage of deciding which language to develop portlets. I lean towards JSP or servlets for the wide array of Java libraries we can use. I think the only advantage of PL/SQL is speed. Thanks.

    It depends. If your developers are mainly Java developers, you'll probably prefer building web portlets. But if you have a strong PL/SQL skill set you could choose the latter. Additionally, if you're developing content that is database intensive you may want to build PL/SQL portlets since they transact with the database faster. If you're going to aggregate content from various web sites, using web providers is preferable. It's a matter of choice based on your requirements and preferences.

  • Deploying a WAR file containing .jsp and servlets (also uses JNI)

    Deploying a WAR file containing .jsp and servlets (also uses JNI) on Windows 2000
    We had problems making it initially work on Sun ONE Web Server 6.0 Service Pack 1 because of lack of good iPlanet Web
    Server documentation on deploying such files.
    This is how we went about it:
    1) Make one of the servlet and JSP (must call another Java Class) web application (.war) examples work with iPlanet Web
    Server.
    C:\iPlanet\Servers\plugins\servlets\examples\web-apps\HelloWorld\HelloWorld.war
    and
    C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    a) Go to your Web Server Administration to deploy the application using GUI Web Application Deploy.
    (We usually use command line, we experienced some issues with the GUI version, but maybe it is fixed in the new Web Server
    service packs)
    From browser, open http://yourserver:8888/
    Click on Select a Server:Manage
    Click on Virtual Server Class
    Click on https-yourserver
    Click on the Web Applications Tab
    Then, click on Deploy Web Application
    Enter the following -
    WAR File On: Local
    WAR File Path: C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    Application URI: /jakarta
    Installation Directory: c:\iPlanet\examples\jakarta-examples
    By clicking on OK it deployed the application.
    I can verify that it is deployed by selecting "Edit Web Applications" and I see the following entry:
    Edit     /jakarta     c:/iPlanet/examples/jakarta-examples
    Also, c:/iPlanet/examples/jakarta-examples should have the similar following directory structure ..
    - [images]
    - [jsp]
    - index.html
    - [servlets]
    - [META-INF]
    - [WEB-INF]
    - [classes]
    - [tlds]
    - web.xml
    - index.html
    I restarted the server and accessed it using the following URL from my IE browser:
    http://yourserver/jakarta/index.html
    Then I clicked on the JSP Examples and tried some JSP examples.
    b) Alternatively, you can also deploy the same example from the command-line.
    Make sure C:\iPlanet\Servers\bin\https\httpadmin\bin\ is in your path
    wdeploy deploy      -u /jakarta
              -i yourserver
              -v https-yourserver
              -d c:\iplanet\examples\jakarta-examples
              C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    Restart the web server (I don't think you have to restart, but .. might as well).
    2)Deploy your web-application
    My Foo.war has the following structure.
    You can use jar tf Foo.war to look at the file contents from command line (assuming you have JDK installed and the bin is
    in your PATH)
    Foo.war
    - [META-INF]
    - [WEB-INF]
    - web.xml
    - [classes]
    - Bar.class
    - MoServlet.class
    - [lib]
    - ThirdParty.jar
    - [natlib]
    - extlib.dll
    - foo.jsp
    Here is our application scenario:
    foo.jsp uses a class call Bar (it is not in any package). The Bar java class uses classes from ThirdParty.jar. The
    ThirdParty.jar in turn uses JNI to load library extlib.dll. foo.jsp also calls /servlet/Mo as well.
    Now to deploy it, do the following:
    (a) Make sure that within foo.jsp, you import the Bar class ( I don't know why you have to do it, but if you don't you get
    JSP compile error).
    <%@page language="java" import="Bar" contentType="text/html"%>
    (b) Check web.xml (for Servlets)
    Within web.xml, make sure you have the following mappings:
    <servlet>
    <servlet-name> MoLink </servlet-name>
    <servlet-class> MoServlet </servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> MoLink </servlet-name>
    <url-pattern> /servlet/Mo </url-pattern>
    </servlet-mapping>
    (c) Deploy the application
    Using command line:
    wdeploy deploy      -u /foo
              -i yourserver
              -v https-yourserver
              -d c:\iplanet\examples\foo-dir
              Foo.war
    (d) Change web-apps.xml file (for picking up ThirdParty.jar)
    It is located in
    C:\iPlanet\Servers\https-yourserver\config
    You should see something similar to following after successful deployment.
    <web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true"/>
    Change it to look like following to pick up the ThirdParty.jar
    <web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true">
    <class-loader reload-interval="300"
              classpath="C:/iPlanet/examples/foo-dir/WEB-INF/lib/ThirdParty.jar"
              delegate="false"/>
    </web-app>
    (e) Change jvm12.conf file (for JNI)
    It is located in
    C:\iPlanet\Servers\https-yourserver\config
    Add or uncomment the following lines:
    #optional - just helps with instrumenting the jsp and servlet code
    jvm.include.CLASSPATH=1
    jvm.enableDebug=1
    nes.jsp.enabledebug=1
    jvm.trace=7
    jvm.verboseMode=1
    #required for JNI
    java.compiler=NONE
    jvm.classpath=.;C:\JDK1.3.1\lib\tools.jar;C:/iPlanet/Servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar;
    jvm.option=-Xrs
    jvm.option=-Xnoagent
    # not sure if this is needed for iPlanet web server
    jvm.option=-Djava.library.path=C:/iPlanet/examples/foo-dir/natlib/ -Djava.compiler=NONE
    (f) Change magnus.conf file (for JNI)
    We HAD to change this file in order for ThirdParty.jar file to pick up the native C++ code using JNI. Apparently, the
    iPlanet Web Server doesn't pick the Environment Variable Path. Because when we had the directory containing the DLL just
    in Path, it didn't work.
    Change Extrapath directive:
    ExtraPath C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
    to
    ExtraPath c:/iPlanet/examples/foo-dir/natlib;C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
    (g) Apply changes from the Web Server Administration Console and Restart the web server.
    You should be able to see the behaviour that you want from your application.
    http://yourserver/foo/foo.jsp
    Hope this was helpful!!!
    Sonu

    Deploying a WAR file containing .jsp and servlets (also uses JNI) on Windows 2000
    We had problems making it initially work on Sun ONE Web Server 6.0 Service Pack 1 because of lack of good iPlanet Web
    Server documentation on deploying such files.
    This is how we went about it:
    1) Make one of the servlet and JSP (must call another Java Class) web application (.war) examples work with iPlanet Web
    Server.
    C:\iPlanet\Servers\plugins\servlets\examples\web-apps\HelloWorld\HelloWorld.war
    and
    C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    a) Go to your Web Server Administration to deploy the application using GUI Web Application Deploy.
    (We usually use command line, we experienced some issues with the GUI version, but maybe it is fixed in the new Web Server
    service packs)
    From browser, open http://yourserver:8888/
    Click on Select a Server:Manage
    Click on Virtual Server Class
    Click on https-yourserver
    Click on the Web Applications Tab
    Then, click on Deploy Web Application
    Enter the following -
    WAR File On: Local
    WAR File Path: C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    Application URI: /jakarta
    Installation Directory: c:\iPlanet\examples\jakarta-examples
    By clicking on OK it deployed the application.
    I can verify that it is deployed by selecting "Edit Web Applications" and I see the following entry:
    Edit     /jakarta     c:/iPlanet/examples/jakarta-examples
    Also, c:/iPlanet/examples/jakarta-examples should have the similar following directory structure ..
    - [images]
    - [jsp]
    - index.html
    - [servlets]
    - [META-INF]
    - [WEB-INF]
    - [classes]
    - [tlds]
    - web.xml
    - index.html
    I restarted the server and accessed it using the following URL from my IE browser:
    http://yourserver/jakarta/index.html
    Then I clicked on the JSP Examples and tried some JSP examples.
    b) Alternatively, you can also deploy the same example from the command-line.
    Make sure C:\iPlanet\Servers\bin\https\httpadmin\bin\ is in your path
    wdeploy deploy      -u /jakarta
              -i yourserver
              -v https-yourserver
              -d c:\iplanet\examples\jakarta-examples
              C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
    Restart the web server (I don't think you have to restart, but .. might as well).
    2)Deploy your web-application
    My Foo.war has the following structure.
    You can use jar tf Foo.war to look at the file contents from command line (assuming you have JDK installed and the bin is
    in your PATH)
    Foo.war
    - [META-INF]
    - [WEB-INF]
    - web.xml
    - [classes]
    - Bar.class
    - MoServlet.class
    - [lib]
    - ThirdParty.jar
    - [natlib]
    - extlib.dll
    - foo.jsp
    Here is our application scenario:
    foo.jsp uses a class call Bar (it is not in any package). The Bar java class uses classes from ThirdParty.jar. The
    ThirdParty.jar in turn uses JNI to load library extlib.dll. foo.jsp also calls /servlet/Mo as well.
    Now to deploy it, do the following:
    (a) Make sure that within foo.jsp, you import the Bar class ( I don't know why you have to do it, but if you don't you get
    JSP compile error).
    <%@page language="java" import="Bar" contentType="text/html"%>
    (b) Check web.xml (for Servlets)
    Within web.xml, make sure you have the following mappings:
    <servlet>
    <servlet-name> MoLink </servlet-name>
    <servlet-class> MoServlet </servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> MoLink </servlet-name>
    <url-pattern> /servlet/Mo </url-pattern>
    </servlet-mapping>
    (c) Deploy the application
    Using command line:
    wdeploy deploy      -u /foo
              -i yourserver
              -v https-yourserver
              -d c:\iplanet\examples\foo-dir
              Foo.war
    (d) Change web-apps.xml file (for picking up ThirdParty.jar)
    It is located in
    C:\iPlanet\Servers\https-yourserver\config
    You should see something similar to following after successful deployment.
    <web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true"/>
    Change it to look like following to pick up the ThirdParty.jar
    <web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true">
    <class-loader reload-interval="300"
              classpath="C:/iPlanet/examples/foo-dir/WEB-INF/lib/ThirdParty.jar"
              delegate="false"/>
    </web-app>
    (e) Change jvm12.conf file (for JNI)
    It is located in
    C:\iPlanet\Servers\https-yourserver\config
    Add or uncomment the following lines:
    #optional - just helps with instrumenting the jsp and servlet code
    jvm.include.CLASSPATH=1
    jvm.enableDebug=1
    nes.jsp.enabledebug=1
    jvm.trace=7
    jvm.verboseMode=1
    #required for JNI
    java.compiler=NONE
    jvm.classpath=.;C:\JDK1.3.1\lib\tools.jar;C:/iPlanet/Servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar;
    jvm.option=-Xrs
    jvm.option=-Xnoagent
    # not sure if this is needed for iPlanet web server
    jvm.option=-Djava.library.path=C:/iPlanet/examples/foo-dir/natlib/ -Djava.compiler=NONE
    (f) Change magnus.conf file (for JNI)
    We HAD to change this file in order for ThirdParty.jar file to pick up the native C++ code using JNI. Apparently, the
    iPlanet Web Server doesn't pick the Environment Variable Path. Because when we had the directory containing the DLL just
    in Path, it didn't work.
    Change Extrapath directive:
    ExtraPath C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
    to
    ExtraPath c:/iPlanet/examples/foo-dir/natlib;C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
    (g) Apply changes from the Web Server Administration Console and Restart the web server.
    You should be able to see the behaviour that you want from your application.
    http://yourserver/foo/foo.jsp
    Hope this was helpful!!!
    Sonu

  • How do I restrict access to JSP or servlet only through SSL Port

    Hi
    I want to restrict the access to few jsp and servlet only through SSL port,
    so how can I block the acces to those jsp and servlet through normal port??? We
    are using weblogic 5.1.
    Any help on this highly appreciated.
    Aruna

    Hi,
    To restrict access(56 bits or less). follow the below steps.
    1. Go to your Webserver instance ServerManager
    2. Click Preferences Tab ------> Encryption Preference
    ------> There disable "DES with 56 bit
    encryption and MD5 message authentication."
    for SSL 2.0 ciphers or SSL3.0 Ciphers. Which ever
    needed.
    3. Save and Restart the Webserver instance.
    The above steps are for 4.x version.
    Thanks,
    Daks.

  • Getting to next JSP from Servlet

    I am getting a 404 when I try to redirect from my servlet to an error page. The code that I am testing is....
    catch (SQLException es)
    LOG.error("Unexpected error in Login.createUser.Error
    message = " + es);
    session.setAttribute(Constants.MESSAGE, es.getMessage());
    session.setAttribute(Constants.ERROR_TITLE, "Login error: " + Constants.SQL_ERROR);
    resp.sendRedirect(Constants.ERROR_PATH);
    I have a compiled java class called Constants where the ERROR_PATH is defined as
    /** Constant name used in obtaining the path to the error page. */
    public static final String ERROR_PATH = "/Jsp/error.jsp";
    My JSP pages are located at the root...
    myapp
    ....Jsp
    ....WEB-INF
    ........classes
    My web.xml looks like this
    <servlet>
    <servlet-name>errorPage</servlet-name>
    <jsp-file>/Jsp/errorPage.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>error</servlet-name>
    <url-pattern>/Jsp/error.jsp</url-pattern>
    </servlet-mapping>
    Can anyone point me in the right direction....Thanks

    I tend to use a utility method called redirectToResource in particular to redirect from any servlet to any JSP :
    /** This method will still work when the server is configured to
    *   listen to  port 80 rather than port 8080 (default in Tomcat)
    public void redirectToResource (HttpServletRequest req,
                                     HttpServletResponse resp,
                                  String resourceName)
                         throws ServletException, IOException
       int serverPort    = req.getServerPort();
       String scheme     = req.getScheme();
       String serverName = req.getServerName();
       StringBuffer urlBuffer = new StringBuffer(40);
       urlBuffer.append(scheme + "://" + serverName);
       urlBuffer.append(":" + serverPort);
       urlBuffer.append(resourceName);
        String location = resp.encodeRedirectURL(urlBuffer.toString());
        resp.sendRedirect(location);
    }

  • Need help in JSP and Servlets

    Hi friends,
    [please forgive me if i am posting this in the wrong forum, all seems same to a fresher]
    Now, to my problem..i need a suggestion, a way or a method to implement the following!
    I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task?
    Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSP
    Thanks in adavance

    arun_ramachandran wrote:
    [please forgive me if i am posting this in the wrong forum, all seems same to a fresher]Then you should learn to be more observant - after all, we have JSP and Servlet fora, further down the list. :)
    I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task? You can store the data in your session object. You can even use JavaBeans and the jsp:usebean tag.
    [http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html]
    Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSPA wise approach - I wish more prople woiuld be as thoughtful.

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • Deploying web applications - jsp generated servlet's may be written over the same file!

    Hi, I have made the following test:
    Created two simple web applications with one jsp page, and deployed it
    with different context names, in weblogic.properties I have:
    weblogic.httpd.webApp.weirdApp=\java\weblogic\myserver\weirdApp.war
    weblogic.httpd.webApp.weirdAppTwo=\java\weblogic\myserver\weirdAppTwo.war
    (Note: I have used two diferent war files, because I have a different
    implementation of the jsp page, I could have used the same warfile, and
    deployed it two times with the same different names I have used)
    These two applications have a jsp named myHomePage.jsp
    If I access the first application, like this:
    http://myServer:7001/weirdApp/myHomePage.jsp
    the servlet for myHomePage is created in
    /java/weblogic/myserver/WEB-INF/_tmp_war/jsp_servlet/_myhomepage.class
    If I access the second application, like this:
    http://myServer:7001/weirdAppTwo/myHomePage.jsp
    the servlet for myHomePage is created in
    /java/weblogic/myserver/WEB-INF/_tmp_war/jsp_servlet/_myhomepage.class
    It overrides the first one! Because the servlets are keeped in memory by
    a different class loader this seems to not affect the other servlet, but
    I am wondering what may happen with this strange beaver from weblogic!
    Bruno Antunes,
    Java Software Engineer
    email: mailto:[email protected]
    Phone: +351.21.7994200
    Fax : +351.21.7994242
    WhatEverSoft - Java Center
    Centro de Competencia Java
    Praca de Alvalade, 6 - Piso 4
    1700-036 Lisboa - Portugal
    URL: http://www.whatevernet.com
    ****************** Internet Mail Footer ****************************
    A presente mensagem pode conter Informação considerada Confidencial.
    Se o receptor desta mensagem não for o destinatário indicado, fica
    expressamente proibido de copiar ou endereçar a mensagem a terceiros.
    Em tal situação, o receptor deverá destruir a presente mensagem e
    por gentileza informar o emissor de tal facto.
    Privileged or Confidential Information may be contained in this
    message. If you are not the addressee indicated in this message,
    you may not copy or deliver this message to anyone. In such case,
    you should destroy this message and kindly notify the sender by
    reply email.

    I have a separate java class that gets my data and returns a Result object. Do you mean java.sql.ResultSet?
    In my main servlet I do the following:
    request.setAttribute("supporttracker",
    supporttracker.findsupporttracker(monthYear));
    and then in my JSP I can iterate through the Result
    like the following with no problems:
    <c:forEach var="supporttracker" begin="0"
    items="${supporttracker.rows}" varStatus="counter">
    My problem is that I can only iterate through this
    once in the page whereas I have no problem doing
    multiple forEach loops through other types of
    lists/collections such as an ArrayList. Right, because a ResultSet is a database cursor and doesn't act the same way that an ArrayList does. It's more like an InputStream - once you read it, you close it. If you want to re-read it, you have to re-initialize it again.
    Iterators behave that way, too. Once you walk through them, you have to re-initialize them.
    I've looked
    on the web and in a couple of books, I first thought
    it may be scope or some attribute in forEach that I
    was missing but I'm stumped. It seems like it's
    because the pointer to the result set is at the end
    of the result set when trying the second iteration,
    but I thought by using the begin="0" would put the
    pointer at the first row again, on my second
    iteration I'm getting no rows/data outputed.
    Please help and thanks in advance!The better thing to do is for your method to return a List of objects, one per row, that represent what the ResultSet returns. Have that method iterate through the ResultSet, loading the rows into the List, and close it before you leave in a finally block. A database cursor is a scarce resource, so it's a good idea to close it as soon as you can.
    %

  • Implement SSL in JSP and servlets

    hi there,
    i needed some help in implementing ssl in JSPs and servlets. My idea was to have a login page and also use it where sensitive data is being sent. I have used the basic socket programming (socket.class and serverSocket.class) in GUI applications using threads to listen and send simultaniously and understand how it works but how do I implement it in JSP and servlets and where do i store the certificate?
    i do know that using SSL sockets is very much the same as using the normal sockets.
    can anyone tell me any useful links or give me a step by step guide how to implement it and which classes to use
    your help would be very much appreciated.
    mani

    hi,
    soory for late reply.
    i think you need to use keytool program in your JDK to generate a certificate signature file and you need to configure the server.xml to open and use the HTTPS port. I have not had any additional info on this but i would assume that you simply enter https:// on the file you wish to load in your form and it should use the HTTPS port provided it can find the certificate which must be stored somewhere in your tomcat web server. i would recommend you see tomcat website or search on google for "ssl support in tomcat".i hav not had time to look into this but i will as soon as i am free from my work load.
    mani

  • Converting JSP to servlet

    Hi,
    Can anyone show me how to convert my jsp to servlet. Then, from servlet to classes. Thanks.
    cheers,

    well, jsp pages are converted at run-time to servlets, e.g. if you are using tomcat as jsp engine, you will find the servlet java files somewhere under $TOMCAT_HOME/work/localhost. you can compile these java files to class files.
    PS: There is a forum in here for JSP, and I would recommend that you post your questions there in the JSP forum (this one is about databases)

  • How to setup my computer to run JSP and Servlets

    I want to setup my computer to run JSP and Servlets.
    What kind of Servers and other tool i need to install to run JSP and Servlets.
    Plz, Help me to start my work on JSP.
    Regards,
    Usman Ali

    hello
    JSP and servlet is web programming, may be little bit different to development local application.
    1st, you should have two computers: one is server and the other is local workstation. This server should have a static IP address, that other people can go into your server. Workstation is any computer normal you use it.
    2nd, you need to setup your server in: OS(linux or windows 2000), web server (jrun, apach or Tomcat etc. ), as well as install JDK, servlet.
    3rd, your local workstation just use as programming editor and open a browser to testing, anytime you write your code, then ftp to server to test.
    Reality, you have many technical thing to solve, eg setup web server etc. However, you can write your source code and test it, then open to outside people.
    hope to helpness, if anything don't uderstand, you can post again or send email to me [email protected] Since I just have setup this configuration in my university for my project.

Maybe you are looking for

  • Problems with ICQ Nokia Lumia 720

    There's a problem with ICQ on Nokia Lumia 720. The fact is that being minimized (not closed) it loses connection, after maximizing it, you have to launch the program again. Who faced this problem, did ya find any decision?

  • Acrobat XI - hyperlink properties is changing when the file is moves

    02 final file 01 initial file Good day Support, Kindly advice the procedure to create documents from MS Word 2010 using the PDF maker add-on and keeping the links absolute. When created the file, the link in pointing to the initial file as specified

  • Plant to Plant Stock Trasfer

    Hi Gurus, We are having two plants A and B. For a particular customer we have produced X qty in Plant A. But the customer has raised ARE3 for Plant B. So We transfer the Stock from Plant A to Plant B using Stock Transfer Invoice and we billed in Plan

  • Replicating settings across multiple computers

    I am deploying CS6 Design Standard over to about 200 workstations and I need to be able to replicate the same color settings, same workspaces, general settings to all of them. Does anyone has a list of files containing these settings that need to be

  • OS/X RDP client feature request - Applescript support

    The new OS/X RDP client is very nice overall, but it can't be easily scripted. You can get most of the way there using OS/X UI scripting: tell application "Microsoft Remote Desktop" activate tell application "System Events" set frontmost of process "