Displaying output to jsp

I am trying to display userList from my struts action to jsp page,what's the code to do it using java beans or something simple?
part code:
action class
public ArrayList userList = new ArrayList();
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
//get connection from database
javax.sql.DataSource dataSource;
java.sql.Connection myConnection = null;
// Here the method that connects to the datasource is called:
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
UserDAO dao = DAOFactory.createUserDAO(myConnection);
userList = dao.getUser();
HttpSession session = request.getSession();
// extract data
if(userList !=null){
return mapping.findForward("success");
}else{
return mapping.findForward("fail");
}

Check java.lang.Runtime API.

Similar Messages

  • Junk characters like" � � "displayed in the jsp page please help.

    Hi,
    I am getting junk characters like � � displayed in the jsp page.
    In the JSP page i used javascript "& nbsp" for appending spaces to a string "CCR" to get "CCR " .
    Now the Resultant string "CCR " has three spaces appended to its right.
    This String is set in session in that JSP page.
    In the next JSP page i am getting that string from session.
    After getting the string the "substring" function is performed to get only the first 5 charcters of the string. Now the result is displayed as " CCR� � " with has last 2 characters as junk values � � insteed of displaying as "CCR ". Please help me in solving this issue.
    Please note that initially the sting "CCR" is got from the Oracle database in Solaris Machine.
    Regards,
    Vijay

    have you tried:
    strenuously inspecting the string that is coming from the db? do an actual loop over the string, character by character, dumping to System.out to make sure the characters are EXACT coming out of the db.
    note you have to append " " not just "& nbsp"
    post the code that is doing the output. the relevant bean code, the jsp, everything relevant - WITH COMMENTS discussing where things are happening.
    Also, is it "weird characters" in the browser only? have you done a view source on the actual html source that the browser is rendering (right click in IE and click view source). browsers can act odd if you don't feed then exactly what they want, and it looks like you're feeding it escaped characters that it is rendering as something else.

  • Display image on jsp page

    I have to display image on jsp page with some text output. This image is already saved at a location parallel to web-inf and is generated dynamically using a servlet. I have used img tag html to display the image. Other outputs are taking their values from database.
    First problem is that image will be taking time to display in comparision of other outouts from database. I have to refresh the page to get imageon my page.
    Second is that if I save image in a folder parallel to web-inf in my project then it will not be displaying the image.
    Can I use any jsp functionality to display image with other outputs from database. I have used "*include*". but it shows only that image and other outputs.

    Best way is to use a servlet for this.
    <img src="path/to/imageservlet?id=someidentifier">
    <!-- or -->
    <img src="path/to/imageservlet/someidentifier">In the servlet's doGet() just write code which gets an InputStream of the image (either directly generated, or just read from the local disk file system, if necessary with help of ServletContext#getRealPath(), or even from the DB by ResultSet#getBinaryStream()) and writes it to the OutputStream of the response. That's basically all. Don't forget to buffer the streams properly to speedup performance and to save memory.
    You can find here a basic example: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • Problem in Retrieve Image from DB and display in the JSP page

    Hi All,
    I did one JSP Program for retriveing image from DB and display in the JSP Page. But when i run this i m getting "String Value" output. Here i have given my Program and the output. Please any one help to this issue.
    Database Used : MS Access
    DSN Name : image
    Table Name: image
    Image Format: bmp
    Output : 1973956
    Sample Program:_
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.io.*" %>
    <%
         try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection conn = DriverManager.getConnection("jdbc:odbc:image");
              Statement st = conn.createStatement();
              ResultSet rs = st.executeQuery("SELECT images FROM image");
              String imgLen="";
              if(rs.next()){
                   imgLen = rs.getString(1);
                   out.println(imgLen.length());
              if(rs.next()){
                   int len = imgLen.length();
                   byte [] rb = new byte[len];
                   InputStream readImg = rs.getBinaryStream(1);
                   int index=readImg.read(rb, 0, len);
                   System.out.println("index"+index);
                   st.close();
                   response.reset();
                   response.setContentType("image/jpg");
                   response.getOutputStream().write(rb,0,len);
                   response.getOutputStream().flush();
         }catch(Exception ee){
              out.println(ee);
    %>
    Thanks,
    Senthilkumar S

    vishruta wrote:
    <%
    %>Using scriptlets is asking for trouble. Java code belongs in Java classes. Use a Servlet.
                   out.println(imgLen.length());Your JSP was supposed to write an image to the output and you wrote some irrelevant strings to the output before? This will corrupt the image. It's like opening the image in a text editor and adding some characters before to it.
                   byte [] rb = new byte[len];Memory hogging. Don't do that.
              out.println(ee);You should be throwing exceptions and at least printing its trace, not sending its toString() to the output.
    You may find this article useful to get an idea how this kind of stuff ought to work: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • To Display Output in Grid ALV with change of some field display total with

    Hi Masters,
    I m working on ALV in which  i have to display output with the following format.
    Header
    "Some String"                                                             date/time                                                                               
    User:XYZ01       page 1 
    Line
    1st field    2nd    3rd     4th       5th   6th    7th   8th   9th  10th field
    x               y       z        A        B     C       D     E      F       G
    BLANK..............................................................................                            
                          "total 3rd+4TH"           P        Q     R      S        T       
    same thing for every change of 4th field .
    So the problem is with inserting the line with string "Total of 3rd+4th" in the output .
    Can Anyone help me out?
    Thanks ,
    Varlani Amit

    Hi,
    Use control-break statement ON-CHANGE for the 4th field, and do the changes.
    regards,
    sri

  • Display image in JSP Portlet

    I create a JSP portlet. But The portlet can't display image(gif file, jpg file). I have modified the provider.xml and the following line is added:
    <imageURL>URL_Path</imageURL>
    But, the image still cannot be displayed.
    How can I display image in JSP portlet?

    Leo Cheung,
    You could try the following :
    1. Add a virtual directory path Alias 'imgf' in the Apache configuration file httpd.conf to load the image file. Add the following line under the alias section :
    Alias /imgf/ "<your directory>\images/"
    2. Place your gif/jpg files (eg., work.gif) in the images directory.
    3. Use the IMG tag of HTML :
    <IMG src="/imgf/work.gif" border=0 width=80 height=80> in the JSP file at the location where you need to display the image.
    Hope this helps
    Pushkala

  • How to Download displayed output to Excel Using Bsp Application

    Hi Experts,
    please give me some idea because I am New In BSP.
    How to Download displayed output to Excel Using Bsp Application.
    If any sample code please do send me.
    In my condition I am getting data in  2-3 table view formats on one page and i want download that in Excel.
    please help me.
    Regards & Thanks,
    Yogesh

    Hi,
    This is more a question for the BSP forum.
    Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
    runtime->server->response->set_header_field( name = 'Contnet-Type'
    value = 'application/vnd.ms-excel' ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    runtime->server->response->delete_header_field( name = 'Pragma' ).
    Also check threads like
    Download BSP data into Excel
    export bsp-table to excel
    Export BSP Table to Excel
    Eddy
    PS. Reward useful answers and earn points yourself

  • How to display photo in jsp through blob from oracle

    i am struggling here to retrieve an image which is stored in oracle-blob data type through jdbc-type-1.and i am unable to display that in jsp.i had a rich code library for this problem.but nothing gave me the exact solution.
    please give me exact the solution..
    pls ...

    What have you tried?
    What happened?

  • How to display PDF in JSP using Iframe

    Hi All,
    I am using Struts 2. I am building my file in ActionClass with seperate Method like getGeneratedPDF() in which, I am setting header of response and writing into PDF.
    This method will be called from JSP by this way
    s:property value="getGeneratedPDF()" />
    But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.
    I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?
    questions 2 -- How to display it in Iframe?
    Please help me , If you know the solution.
    Thanks in Advance,
    Jimmy

    jamy_26 wrote:
    But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.A PDF file is a binary file, not a text file, and you're trying to display it as String. Of course you would get "junk characters". Have you ever tried opening a binary file (pdf, doc, jpg, xls, etc) using a text editor like Notepad?
    I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?Display it as binary stream, not as text stream. You can display it standalone, just let the link/form/addressbar URL point to some Servlet which writes the InputStream of the PDF file to the OutputStream of the response, along with a correct set of response headers (at least content-type, content-disposition and content-length), so that the browser can open it in the correct application (which is usually Acrobat Reader). If you want to embed the PDF file in a JSP, then one of the ways is indeed using the HTML <iframe> tag.
    questions 2 -- How to display it in Iframe? Just let the iframe URL point to the aforementioned Servlet.
    You can find here an example of a generic file servlet, you may find it useful to get the idea how to do it: [http://balusc.blogspot.com/2007/07/fileservlet.html].

  • Plz help me, no display output during boot up of 715 workstation

    now i have a HP 715 model workstation,today, conneted hp monitor..but can't display output during system boot up so i tried  solve this problem,1)changed battery2)removed HDD after reboot system and press ESC key    => now can't use Keyboard..not working key board3)Press Tap key.. Just i think, this problem is system configulation problem. not monitor problem..so i found internet website..but now i can not change configulation who know this problem.plz help me  

    one question in html submit the reslut stored jdbc that value shows barchartAll your base are belong to us!
    You know, while I understand that English isn't your first language (neither is it mine) and there's no need to be perfect: if you can't write an understandable post yourself, consider asking someone to do it for you.

  • Turn off external display output?

    I've bought a nice big LCD TV mainly for consoles. Because I have it next to my iMac i've also connected that to the TV using a mini-dvi adapter and a dvi-hdmi cable.
    It works great but I only want to use it for playing downloaded video and the like on the big tv.
    When I'm not using it I want my iMac to free up the resources it must be using to achieve screen spanning but I cannot figure out a way to tell the iMac to disable external display output.
    I've tried display mirroring figuring that it won't be eating up video RAM, but it causes page tearing on my mac when dragging windows around for example.
    Even when the TV is unplugged from the mains the mac seems to be outputting to the dvi out, the only way to stop it is the yank the mini-dvi connecter from the back.
    Are there any hacks or utilities that can manually turn dvi support on and off?

    Hello Mark
    I'm using a 27" flat screen TV, mini DVI and 12' S-Video cable.
    Mostly I watch DVD movies on that Display while working at the iMac's 17" it's also great for iPhoto Slideshows and PowerPoint.
    Not to worry the TV supports it's own display and all you are doing is sending a signal to it's video card. Just turn it off or change the channel.
    I tend to stay away from mirroring for the same reasons, but also because the TV's across the room.
    Again not to worry the TV supports it's own display and all you are doing is sending a signal to it's video card. Just leave it connected up to prevent damage to DVI port, Adapter and cable. "yank not"
    Just be sure to gather up all your windows back to the iMac Display befor shutting off or changing the channel.
    Dennis
    17" iMac Intel Core Duo 1.5GB Ram   Mac OS X (10.4.9)   Maxtor 300GB FireWire Creative Inspire 2.1 2G Nano

  • Display Output similar to SPRO (IMG)

    Hi Experts,
    Can we develop a display output similar to the view which we have in SPRO (IMG).
    Any Function Module or Sample Program.
    Regards,
    Abhijit G. Borkar

    Thanx David,
    Can u help tell me the difference between the Transaction Code: SHI3  & SE43 & SE43N.
    Since they look similar to what you have suggested.
    Regards,
    Abhijit G. Borkar

  • Thunderbolt Display output only 800 x 600!!?!?!?!

    Just got the Mac Book Pro Quad Core, 15", 8 gig ram.
    I'm using the display output adapter in the Tunderbolt port. It outputs and syncs to my Image Pro switcher, but the options for the display output for the external only go up to 800 x 600.
    Anyone know anything about this?
    My old MacBook Pro could go up to the full resolution with the same video switcher and the same mini display output adapter.

    It's possible that the switcher isn't compatible. Safe to presume that without the switcher you can achieve the desired resolution?

  • When I unplug Apple headphones from my MacBook Pro sond from internal speakers not work, and system soud preferences displayed: Output: optical digital out port only

    When I unplug Apple headphones from my MacBook Pro sond from internal speakers not work, and system soud preferences displayed: Output: optical digital out port only

    If you see a red light in the audio output port, then the internal switch is stuck.  Insert the earphone plug a few times and see if you can trip the switch.  If that fails, insert a cocktail stirrer and the like and jiggle it around inside.  If that fails, take it to an Apple store and have the technicians at the genius bar do it for you.
    Ciao.

  • [GTX770]No display output HDMI/Displayport when booting

    I've recently upgraded to an Haswell setup with a MSI Z97 pc mate and MSI GTX770. The card seems to work fine when I use DVI output. However, when i try to use either hdmi or displayport I only get display output once i'm in windows. The bios and booting process give no output on either connection.
    Is there something wrong with the GFX card, is there some bios setting i can try?

    Quote
    Thanks for the quick reply. Will this GOP UEFI bios make Displayport work on boot?
    don't know, maybe
    Quote
    I've never heard of GOP UEFI bios, so I don't have a clue what advantages I get with that.
    its related to Win8 features, ultra fast boot and so on if you decide to use such

Maybe you are looking for

  • Reg usage of XSLT Mapping

    Hi All, We need to build an interface from PI to some database using JDBC adapter to send out emails to business users of the exception records created in the table.please help in using the xslt mapping for this interface. Thanks in Advance,

  • Contact info not showing in messages

    Since upgrading to IOS7 my ipad will not show contact info for messages. On my iphone the upgrade works fine.

  • How to remove leading ' in workbook?

    Hi, we are reporting queries via workbooks. Yet, all values in the workbook (in the data area) start with 'xxx. eg. Instead of showing 3 it's showing: '3 as the content of excel cell. How can I change my workbook in such a way (maybe via Format -> St

  • Printing as PDF changes Doc?????

    Hey everyone, I have hit a wall and I need some serious help. I have a rather large word 2007 document with pictures, graphs, page breaks etc.. when I go to print and select print to PDF, like I normally do, it will give me the PDF file and it looks

  • Where is the slideshow feature in the Photos app? (iOS7)

    Since upgrading to iOS7, I haven't been able to figure out how to run a simple slideshow of one of my Photos albums. Has this been removed/moved?