A problem to display a jsp Using MVC approach

Hello everybody
I have got a problem with RequestDispatcher and I would like to get your help.
I excpect the servlet to display the index.jsp page but the server displays a blank page. web.xml's <servlet> and <servlet-mapping> are set correctly at this TestServlet servlet. what could be the problem?
my code looks like this:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet{
     public void doGet(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException {     
     String url = "/index.jsp";     
     ServletContext context = getServletContext();
     RequestDispatcher dispatcher = context.getRequestDispatcher(url);
               dispatcher.forward(request, response);     }
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
          //doGet(request,response);
PS: please help me, this step blocks me for several weeks.
thank you.

Hello Thomas, thanks for your answer.
>
Thomas Jung wrote:
> Does this problem happen in IE for all different MIME Types?  I can't recreate your problem as the same functionality works perfectly fine in my installation of IE.
It does happen for Gif-, Jpeg- and Pdf-binaries (other Mime-types I haven't tested yet) and it is IE 7 I am using.
> Do you have any browser plug-ins - like Anti-Virus scanners that might be interupting? 
There are no relevant (as far as I can tell) plug-ins especially no anti-virus scanners loaded.
> >however an export of the binary stream shows the binary is incomplete.
> This could be indicative of the problem or it might be perfectly normal.  What trace tool are you using? 
> It might just be the cause of a multi-part MIME.
The trace-tool is HttpWatch.
I think this correlates with the fact that the tab closes right away (i.e. before the stream has been downloaded completly).
> Can you download attachments in IE from other websites?  There really isn't anything special that SAP is doing in Web Dynpro from a browser side.
I can download/open Pdfs from SDN for example
Unfortunately I still haven't got a clue what happens. The code-snipplet producing the response looks like this
METHOD onactionopen_document .
  DATA: file TYPE zrms_st_file.
  file = wd_this->get_file( ).
  cl_wd_runtime_services=>attach_file_to_response(
      i_filename      = file-filename
      i_content       = file-binary
      i_mime_type     = file-mimetype
      i_in_new_window = abap_true ).
ENDMETHOD.
where the type zrms_st_file has three components: binary (type tr_xstring), filename and mimetype (both dstring). Debugging (breakpoint right before method is called) shows that the mimetype is correct.
Regards,
Sebastian

Similar Messages

  • Problem while displaying Purchase order using me9f

    Hi All,
    I have copied ME9F as ZME9F, and SAPFM06P as ZSAPFM06P (print program of purchase order). Now when I display the PO using ME23n, there is no problem and PO is getting displayed absolutely fine. But When I display the same PO using ZME9F, the vendor address in the PO is getting printed at the item level instead of header level.
    The vendor address should be displayed at the top and not at the item level.
    When I analysed the code, I found in case of ZME9F AND ME23N, the values of NAST structure and ENT_SCREEN are different. These values are passed as input values to the Function Module ME_READ_PO_FOR_PRINTING.
    Please let me know how do I fix this issue, such that vendor address is displayed at the header level instaed of item level.
    Thanks !!!

    Hi,
    First you creat a PO using BAPI_PO_CREATE , once PO is created then you use the FM BAPI_PO_CHANGE and update the condtions in PO. See the code below given.
    Fm lt_cond-condition_no = lvc_knumv.
    lt_cond-itm_number = gt_output-ebelp.
    lt_cond-cond_type = 'FRB1'.
    lt_cond-cond_st_no = '020'.
    lt_condx-condition_no = lvc_knumv.
    lt_condx-itm_number = gt_output-ebelp.
    lt_condx-itm_numberx = 'X'.
    lt_condx-cond_st_no = lt_cond-cond_st_no.
    lt_condx-cond_st_nox = 'X'.
    lt_condx-cond_type = 'X'.
    lt_cond-cond_value = gt_output-frcst.
    lt_condx-cond_value = 'X'.
    lt_cond-currency = p_cndcur.
    lt_condx-currency = 'X'.
    lt_cond-vendor_no = gt_output-frvndr.
    lt_condx-vendor_no = 'X'.
    lt_cond-change_id = 'I'.
    lt_condx-change_id = 'X'.
    APPEND lt_cond.
    APPEND lt_condx.
    CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
    purchaseorder = gt_output-ebeln
    TABLES
    return = lt_return
    * poitem = lt_poitem
    * poitemx = lt_poitemx
    pocond = lt_cond
    pocondx = lt_condx.
    Thanks.

  • Problem in displaying applet by using dynamic graphics

    Hi,
    I followed one document for using dynamic graphics editor, the url is
    /people/abesh.bhattacharjee/blog/2007/02/27/get-started-with-dynamic-graphics-in-xmii-115 by Abesh Bhattacharjee.
    The steps are as follows:
    1). Create the tag query
    2). Preparing the 3DDialGauge Object
    3). Creating the BLS Transaction
    4). Creating an Xacute Query for the BLS Transaction
    5). Creating the HTML Page with help of applet.
    In this HTML page we get that image and also 2 buttons.
    Finally we have to get the object designed in step 2 above and it has to change dynamically and refresh the image by pressing one buttons and the other button is to stop the refresh.
    Now i am getting the image and 2 buttons as output of that HTML page but the problem is the image is getting refreshed continously without getting proper display and i am pressing the buttons it is not stopping the refresh and the warning message i am getting is
    document.TransFanSpeed is null or not an object
    and the object is not changing according to the dynamic value please can anyone help me in resolving this problem.

    Hi shyam,
    The html file is as follows:
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="../../../../ServletExec AS/se-xMII/webapps/default/Lighthammer/Stylesheets/lighthammer.css"><br />
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    <APPLET NAME="TransFanSpeed" WIDTH="300" HEIGHT="300" CODE="iCommand" CODEBASE="../Classes" ARCHIVE="illum8.zip" MAYSCRIPT><br />
    <PARAM NAME="QueryTemplate" VALUE="C:/Lighthammer/Illuminator/Templates/Training/SVGexampleXacutequery"><br />
    </APPLET><br />
    </head>
    <body>
    <img src="../../Fan1.jpg" name="refresh"><p></p>
    <button onclick="javascript:doit()">Do it !!!</button>
    <button onclick="javascript:clearit()">Clear Timeout</button>
    <script language="javascript">
    var Time;
    var imagename;
    var tmp;
    function doit(){
    executeQry();
    imagename = "Fan1.jpg";
    tmp = new Date();
    tmp = "?"+tmp.getTime();
    document.images["refresh"].src = imagename+tmp;
    Time = setTimeout("doit()", 1000);
    function clearit(){
    clearTimeout(Time);
    function executeQry(){
    document.TransFanSpeed.executeCommand();
    </script>
    </body>
    </html>
    and the iCommand.java is nothing but internal one there i didn't written any code
    Message was edited by:
            RAJESH PERLA

  • Facing Problem while Displaying Russian words using HTP.TableData

    Hi,
    We are storing russian words in DB.While displaying these words, it is not displaying proerly.we are using "HTP.TableData" to display russian characters in the front end.Please suggest the solution to display russian words proeprly

    Hi Amith,
    I checked that way also, i put break point in database program of the copied LDB, but its not allowing to check the flow in that program also.
    Please suggest any other ways.
    Thanks,
    Nanda

  • Problem in displaying Column Heading using JTable

    I am using JTable component in my applet. I am trying to retrieve records from a database and want to display the same in the table using JTable component. In that procees my data is shown in the table but I am not able to display the column heading.
    Please suggest.

    you could user JScrollPane to show the column's head.
    if you don't want to use JScrollPane ,you should use the getTableHeader() method and add the header into the pane

  • Problem in displaying sub-totals using a structure displayed as hierarchy

    In a report, i'd like to display in rows a characteristic and a structure. All of that displayed as a 2 levels hierarchy.
    Results on structure rows doesnt aggregate themselves on characteristic rows. I have no result on my first level of hierarchy?

    Hi,
       Write as :
       loop at <internal_table> ....
          V_TBL2 = V_TBL2 + SBL1.
          V_PTBL2 = V_PTBL2 + PSBL1.
          if....
          ELSEIF ( PSCH EQ 'N' OR PSCH EQ 'O' OR PSCH EQ 'P' ).
           AT END OF SG.
              TBL2  = V_TBL2 .
              PTBL2 = V_PTBL2 .
              clear : V_TBL2 , V_PTBL2.
           ENDAT.
       ENDIF.
      ENDLOOP.
    Regards,
    Srini.

  • Hi,problems with display screen when using cs5

    Just bought new mac comp for daughter with cs5 extended s
    tudent and teacher edition.
    Disc didn't run straight away and we had to go into files to run the install.
    Installed ok when we did this.
    However we have all the toolbars around the outside of screen and despite changing background settings to black or grey it is still our screensaver there. If we click on toolbar it disappears and we have to go back to file to re-open.
    Can anyone advise why we don't have the grey background as per previous versions to work on with photos?
    If we try to open a pic to work on it still doesn't open as a full page

    Welcome to the Mac!  
    kfcfsy wrote:
    …Disc didn't run straight away and we had to go into files to run the install.
    Installed ok when we did this.…
    That is expected, normal behavior. 
    kfcfsy wrote:
    …Can anyone advise why we don't have the grey background as per previous versions to work on with photos?
    If we try to open a pic to work on it still doesn't open as a full page…
    That is expected, normal behavior.  All Mac applications work like this. 
    As an accommodation to Windows users switching to the Mac, Adobe provides the Application Frame, as indicated by the previous poster.  Hope that workaround helps you.
    Wo Tai Lao Le
    我太老了

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Strange behaviour with JDev 10.1.3.1 thru 10.1.3.3 creating JSP using CDB

    Greetings,
    I am experiencing a strange problem developing some simple JSPs using the Content DB libraries. It happens on JDev 10.1.3.1, 10.1.3.2, and 10.1.3.3.
    I don't know if its my environment or something else. If your in for a mystery then this one is for you.
    All JSPs, Backing Beans, and supporting class all compile without a problem.
    JSPs run and data is displayed as expected. All seems fine.
    Problem:
    When I go back to the JSP and click on it to open (for work), JDev just hangs up. Have to go into Task Manager to Kill process.
    Work Around:
    Back in JDev before I click to open JSP, I clean out the compiled classes. Then click on JSP and it pops right up?!?!
    Has something to do with Content DB libs?
    I go back to the backing bean and Comment out all calls to any CDB APIs within the methods. The overall structure of the backing bean is intact but it renders the JSP useless of course. But the after I compile (without errors) the NO CDB API version, I click on the JSP; it opens right up in JDev.
    Ok, what I did not tell you yet. The missing key to this mystery.
    I'm working on my local desktop. There is no local instance of OCDB on my desktop. Only Jdev and the OCDB development kit. The Actual instance of the content DB is elsewhere. The code reads a property file to get the URL and S2S logon information from a property file (local on my desktop) to connect and do its thing. NOW, AS LONG AS I AM VPN into the network (where several OCDB instances can be accessed), I can go into JDev and open the JSP REGARDLESS of whether I've compiled the code or not.
    When I'm running the VPN, I see the in and out byte count moving up and up, then within a few seconds, the JSP pops right up.
    How strange is this?!
    Question: When using the OCDB libraries with JDev, is it going out to look for some license? It seems that JDev knows my code is calling some OCDB APIs then goes out and does something before it allows me to continue. Without the VPN connection its looks like its sits there waiting for something. My colleagues don't have this problem. But of course they are inside of the firewall, I'm outside.
    I've worked on a lot of JSPs before (without OCDB) and I've never seen anything like this before. Here is a list of the libraries that I'm using.
    Using version 10.2 of the CDB Libraries.
    Importing these jars to my project in JDev.
    1. cdb-devkit-client.jar
    2. content-ws-client.jar
    3. axis.jar
    4. commons-codec-1.3.jar
    5. commons-discovery-0.2.jar
    6. commons-httpclient-3.1-rc1.jar
    7. commons-logging-1.0.3.jar
    8. jaxrpc.jar
    9. saaj.jar
    10. wsdl4j-1.5.1.jar
    Any suggestions would help. Since I've found a work around. I'm up and moving, but I would REALLY like to know what's up with this.
    THANKS
    Winston

    Hi folks,
    I have some more news on this issue.
    As noted in my first post, I noticed that the VPN monitor was moving very aggressively when the VPN connection was established. Activating JSP in design mode while classes were compiled and my VPN connected always seemed to do the trick.
    So, Why does it work when VPN is connected? What’s JDev doing?
    To answer these questions I loaded up an IP packet sniffer to find out exactly what JDev. was up to. Here are the results, but first a recap of the steps.
    Let’s say you have a model view project (using Content DB) that has already been compiled and you know it works.
    You are working remotely and need to connect via VPN.
    You have no local instances of the Content DB running.
    You VPN in and run the JSP from JDev. to verify that all is in working order.
    Ok get out of the app and close down all its windows.
    In JDev, close out all files in the developer.
    Disconnect the VPN.
    Then in JDev open the JSP. If it comes up in source mode switch it to design mode (Click on the "Design" tab).
    JDEV hangs up.
    Ok now Go into Task Manager and kill the process.
    Then find the class folder where the compiled code sits and delete them all.
    Start up JDev and go into your project and open the JSP file.
    If it comes up in source mode, switch to design mode. Either way this will work.
    Now close the JSP file.
    Recompile the code.
    NOW START UP the IP Packet Sniffer on your local machine. (VPN IS NOT CONNECTED)
    Open the JSP file. If it comes up in source mode, switch to design mode.
    Now go back and look at the IP packets.
    BEHOLD! IT IS TRYING TO CONNECT TO THE SERVER USING THE CORRECT URL FOR MY INSTANCE OF THE OCDB.
    Note: There are no URLs encoded in the code. It gets the URL by reading it from a properties file.
    The URL to the server is only specified in the property file.
    By the way, JDev is now hung up because you’re not VPN in.
    Go into the task manager and kill the process, delete the compiled class files, and restart JDev.
    Now go and find the property file on your local drive, and rename it.
    Go back to JDev. and recompile the code.
    Bring up the JSP in design mode.
    Look at the output of the IP packets.
    THERE ARE NONE! This also shows that its not some kind of cache problem, else it would try to connect.
    JDev is active and the JSP is displayed in design mode.
    So, either by deleting the compiled classes or removing the properties file CLEARS the problem.
    It appears that I’m hanging up because JDev is partially executing the code when you switch into design mode?!?
    If the code is complete it tries to go all the way. Since I'm not VPN in I never get a response from the server, thus it hangs forever.
    If the code is incomplete, it never tries to connect.
    Now if I try this WITH my VPN connected, I see the packets going to the server, and the JSP is eventually displayed.
    Also noted that when the property file was renamed and/or the executable classes were deleted, The JSP always pops up (almost immediately). When VPN is connected and classes are compiled and the property file is accessible, it is a lot slower. More Support that JDev is doing something with the server.
    So why is this thing running my code when I switch design modes?
    I’ve also found this thread on the JDev Fourm.
    JSP Design not working when ICEFaces extension is integrated JSP Design not working when ICEFaces extension is integrated
    A Known problem with JSP when third party libraries are added?!?!
    Content DB considered a 3rd party library?
    So, I must conclude that this is not an OCDB issue, but a JDev Issue.
    Aslo check out JDeveloper "Design" Perspective
    Hope this helps some one out. This was a barn burner.
    Thanks
    Winston

  • Displaying java applet using webseal authentication

    Hi all,
    i'm facing a problem about displaying Java applet using Webseal junction for accessing  an application Server based on Websphere.
    I've defined a webseal ACL on accessing a http url that contains link to Java applet: after webseal authentication, the homepage is loaded; in the home page are presented links to java applet, but when I try to load these applets, it seems not working.
    If I load the same applets without Webseal authentication, it seems working.
    Is there any sort of configuration to make for applet regarding Webseal?
    Thanks in advance
    Danilo

    Hi all,
    i'm facing a problem about displaying Java applet using Webseal junction for accessing  an application Server based on Websphere.
    I've defined a webseal ACL on accessing a http url that contains link to Java applet: after webseal authentication, the homepage is loaded; in the home page are presented links to java applet, but when I try to load these applets, it seems not working.
    If I load the same applets without Webseal authentication, it seems working.
    Is there any sort of configuration to make for applet regarding Webseal?
    Thanks in advance
    Danilo

  • What is the best MVC approach for designing Swing application

    Hi...
    I am designing an client/server application. In this I am using java swing for the front-end development. We decided on using MVC approach for the front-end design. I found that there are more than one approachs for designing in MVC.
    Which is the best way to model. To create your model taking View into consideration or Creating the Model taking the tables into consideration.
    Can anybody give help me out in this this is urgent. Thanks
    sai

    I'm not sure what you are asking, so I'll just ramble a bit and hope it helps.
    Create your model taking the view and the data into consideration. :-)
    Design a class to hold instances of the rows in your database that correspond (more or less) to the structure of the data. Add any needed methods to that data object to support the data that you might need for the view.
    For example, suppose your database stores a name in two columns (firstname and lastname). You pull that data from the database into a collection of Person objects into your model. Your Person class has two fields (and set/get methods) to hold that data. Now, in your view, you want to display the name as one string, so add a method to the Person object to get the full name (just by concatenating the two data elements).
    You have to take everything into consideration. How you are going to view the data as well as how it might be structured.

  • I want to display BLOB image in JSP Using  html tags IMG src=

    GoodAfternoon Sir/Madom
    I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
    Send me sample codes for display image.
    This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="javax.swing.ImageIcon;" %>
          <%
            out.print("hiiiiiii") ;
                // declare a connection by using Connection interface
                Connection connection = null;
                /* Create string of connection url within specified format with machine
                   name, port number and database name. Here machine name id localhost
                   and database name is student. */
                String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
                /*declare a resultSet that works as a table resulted by execute a specified
                   sql query. */
                ResultSet rs = null;
                // Declare statement.
                PreparedStatement psmnt = null;
                  // declare InputStream object to store binary stream of given image.
                   InputStream sImage;
                try {
                    // Load JDBC driver "com.mysql.jdbc.Driver"
                    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        /* Create a connection by using getConnection() method that takes
                        parameters of string type connection url, user name and password to
                        connect to database. */
                    connection = DriverManager.getConnection(connectionURL, "scott", "root");
                        /* prepareStatement() is used for create statement object that is
                    used for sending sql statements to the specified database. */
                    psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
                    psmnt.setString(1, "10");
                    rs = psmnt.executeQuery();
                    if(rs.next()) {
                          byte[] bytearray = new byte[1048576];
                          int size=0;
                          sImage = rs.getBinaryStream(1);
                        //response.reset();
                          response.setContentType("image/jpeg");
                          while((size=sImage.read(bytearray))!= -1 ){
                response.getOutputStream().write(bytearray,0,size);
                catch(Exception ex){
                        out.println("error :"+ex);
               finally {
                    // close all the connections.
                    rs.close();
                    psmnt.close();
                    connection.close();
         %>
         Thanks

    I have done exactly that in one of my applications.
    I have extracted the image from the database as a byte array, and displayed it using a servlet.
    Here is the method in the servlet which does the displaying:
    (since I'm writing one byte at a time, it's probably not terribly efficient but it works)
         private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
              ServletOutputStream sout = response.getOutputStream();
              for(int n = 0; n < bytes.length; n++) {
                   sout.write(bytes[n]);
              sout.flush();
              sout.close();
         }Then in my JSP, I use this:
    <img src="/path-to-servlet/image.jpg"/>
    The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database.

  • Display PDF in JSP using a content selector

    Hello,
    We are running on WLP 8.1 sp4. We have documents (Word and PDF) stored in the Weblogic Portal content management system. We have made several tries, but are unsuccessful in rendering a PDF inside a JSP using Content Selector tags. We can get a link to display and other properties of the content type, but we have not been able to show the actual binary property of the PDF. Has anyone climbed this mountain before, any help will be greatly appreciated!
    Rob
    The following displays links to the documents, but not the actual document.
    <pz:contentSelector rule="novel_flu_db_archived_reports"
    id="fluArchiveQuery" />
    <utility:notNull item="<%=fluArchiveQuery%>">
    <utility:forEachInArray array="<%=fluArchiveQuery%>" id="docA" >
    <cm:getProperty id="docA" name="file" conversionType="html" />
    <ad:render id="docA" />
    </utility:forEachInArray>
    </utility:notNull>

    Thank you for the response.
    Option 1 - would be great, but I am having problems getting this to work (see thread "Problem accessing a file stored in the CMS from link on JSP")
    Option 2 - I need to look into, as we need to be compliant with Accessibility standards and I can't remember if IFrames pose any problems for screen readers.
    Option 3 - introduces an additional step to the work flow, we would like to avoid extra work (if possible)
    In looking through the archives, there was mention of a "stand alone" JSP which was not under a Portlet or the Portal. The PDF was displayed in the stand alone JSP where the mime type was altered to PDF. Would this be an option?
    -Rob

  • Having a problem in displaying Japanese characters in JSP

    Hi, Could someone pls help me out with this...
    I'm trying to implement my application(in Java) in English, French and Japanese languages. For this purpose, I have used ResourceBundle class. I have no problem in implementing English and French versions as they are all in Unicode.
    For Japanese version, I have used a tool called NJStar Editor to create a properties file in Japanese and am saving the file with format:"Shift-JIS Text File".
    Then I run native2Ascii <fileCreated><asciiConvertedFile>.
    I see that the asciiConvertedFile has converted text such as "wfm_wla_filter=\u30d5\u30a3\u30eb\u30bf\u30fc".
    I'm calling this variable from a JSP using <%=bundle.getString("wfm_wla_filter")%>. In the JSP i include <%@ page contentType="text/html; charset=Shift_JIS" %> to take care of the Japanese content.
    The final result that is displayed in the browser is not Japanese. It is either some garbage that is not understandable or it is just "??????".
    Could you pls tell me where I might have gone wrong in the any of the procedures that I have mentioned above.
    Thanks in advance
    Satish

    Hi,
    I think you need to look at this as a two-step problem.
    First, you need to get the external characters from a file into the JVM. The java.util.Properties object doesn't know how to handle Shift-JIS, UTF-8, etc. According to the JavaDoc, Properties.load only understands ISO 8859-1. So, the native2ascii tool converts your Shift_JIS files into something that Properties can load. During the Properties.load process, the bytes from the properties file get converted into 2-byte Unicode characters, the only format the JVM deals with.
    Second, you need send Shift-JIS bytes back to your browser. So, you need to convert Java Strings into a Shift-JIS encoded byte stream. Here's an example of how to send Shift-JIS bytes to the browser using basic Java objects:
    <%@ page contentType="text/html; charset=Shift-JIS" %>
    <%
    ResourceBundle rb =
    ResourceBundle.getBundle("MyResources", Locale.JAPAN);
    String someMessage = rb.getString("someMessageKey");
    writer.print(someMessage);
    %>
    Note that since you declared the charset as Shift-JIS, the JSP writer should send the bytes in someMessage in the response stream as Shift_JIS encoded. Under the covers, the JSP container should interpret your contentType declaration and embed a new OutputStreamWriter(out, "Shift-JIS") into the JSP Writer. In the old days with Servlets, we had to work with OutputStreams directly using OutputStreamWriter. (Note: might be SJIS vs. Shift-JIS depending on your JDK).
    Lastly, I strongly recommend that you use the JSTL i18n (prefix fmt) tags for developing i18n/l10n support into your Web application vs. re-inventing the wheel.
    Best regards,
    Timothy Potter

  • How can i display the values in the vector in a jsp using jstl

    in a task i am recieving a vector in a jsp... how can i display those vector values in the jsp using jstl.... plz help me
    thanks in advance

    <%
    here you got vector say; v
    pagecontext.setAttribute("varname",v);
    %>
    <c:forEach var="i" items="${varname}">
    <c:out value="${i}">
    </c:forEach>

Maybe you are looking for