Help!!! Display "null" in JSP page

Hi,
I use the code like <%=adress%> in jsp.
When the adress is null, the jsp page in S1AS will show a string "null". But the same code is OK in weblogic ,the jsp will show empty for this part of code
What is difference between them ?If I do not want to change the code (many places) ,is there any way to confirgue sun one or easy ways to solve this problem?
Could evry expert to help me to firgure out how to solve this problem?
Thanks in advance,
FS

You also might want to check JDK versions and J2EE versions being used. These might yield different results.

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.

  • Need help in writing a .jsp page

    Hi Guys,
    I am new to JSP. My requirement is " I have a link on my webpage. When the user clicks that link, a HTML page is displayed which has parameters to be entered (for ex: from_date , to_date). When the user clicks the submit button, a jsp page should be displayed in which a query is run to display the output. For example, the user enters the from_date and to_date parameter values to know the employees employed within those dates in their company. The query is "select empname,empno,sal,dept,comm from emp where employed_date between from_date and to_date" . The following should run and display in the jsp page.
    How can i write a .jsp to extract the parameters that are entered in the HTML form in to a .jsp and run the query with those parameters to display the output. Help needed in making me write this .jsp for this query.
    Help Aprreciated.
    Thanks

    Hm, your requirements sound like homework assignment from classroom. If so, is itn't better that you find the answer youself? There are plenty of very relevant references for how to use jsp to handle html forms or talk to a rdbms through a jdbc connection. For example, for jsp and html forms, you can google "jsp html forms"; for jsp and sql query, search for "jsp jdbc".
    Tell me if this is not helpful.

  • 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].

  • Struts can't display the input jsp page

    Hello,
    I'm using Struts 1.3.8 to construct a simple user registration system, in which the user could input his info (such as uuname and gpin, both are strings) in a jsp page, and after the submit, the system should go to a success page. However, somehow, when I access the url, it goes directly to the success page, but not stay at the input page.
    Here is my {color:#ff0000}struts-xml.config{color}
    bq. <?xml version="1.0" encoding="UTF-8"?> \\ <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> \\ <struts-config> \\ <form-beans> \\ <form-bean name="{color:#ff0000}anotherUserForm{color}" type="com.visualbuilder.struts.beans.AnotherUser" /> \\ </form-beans> \\ <!-- Global Exceptions --> \\ <global-exceptions></global-exceptions> \\ <!-- Global Forwards --> \\ <global-forwards> \\ <forward name="success" path="success.jsp"/>     </global-forwards> \\ <!-- Action Mappings --> \\ <action-mappings> \\ <action path="/{color:#ff0000}addanotheruser{color}" type="com.visualbuilder.struts.action.AddAnotherUserAction" name="{color:#ff0000}anotherUserForm{color}" attribute="user" input="{color:#ff0000}/addanotheruser.jsp{color}" cancellable="true"> \\ </action> \\ </action-mappings> \\ <!-- Message Resources --> \\ <message-resources \\ parameter="registration.resources.ApplicationResources" /> \\ </struts-config>
    My action class is:
    package com.visualbuilder.struts.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import com.visualbuilder.struts.beans.AnotherUser;
    public class AddAnotherUserAction extends Action {
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (isCancelled(request)) {
    return mapping.findForward("welcome");
    {color:#ff0000}AnotherUser anotherUser = (AnotherUser) form;{color}
    System.out.println("UUName: " + anotherUser.getUuname() + "\tGPIN: " + anotherUser.getGpin());
    {color:#ff0000}return mapping.findForward("success");{color}
    My ActionForm class is:
    package com.visualbuilder.struts.beans;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    public class AnotherUser extends ActionForm {
    private static final long serialVersionUID = 1058901817587421984L;
    private String uuname;
    private String gpin;
    public String getGpin() {
    return gpin;
    public void setGpin(String gpin) {
    this.gpin = gpin;
    public String getUuname() {
    return uuname;
    public void setUuname(String uuname) {
    this.uuname = uuname;
    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    uuname = null;
    gpin = null;
    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    return errors;
    The input jsp page is addanotheruser.jsp:
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Another User Registration</title>
    </head>
    <body>
    <h1>Another User Registration</h1>
    <html:errors />
    <table>
    {color:#ff0000}<html:form action="addanotheruser">{color}
    <tr>
    <td>UUName</td>
    <td>{color:#ff0000}<html:text property="uuname"></html:text>{color}*</td>
    </tr>
    <tr>
    <td>GPIN</td>
    <td>{color:#ff0000}<html:text property="gpin"></html:text>{color}*</td>
    </tr>
    <tr>
    <td><html:submit/></td>
    <td><html:cancel/></td>
    </tr>
    </html:form>
    </table>
    </body>
    </html>
    Everytime I access http://localhost:9080/addanotheruser.do, it jumps to the success.jsp, but not stay at addanotheruser.jsp to wait for the user input, and in the server's console, I could see the output "UUName: null GPIN: null"
    I've been stuck at this simple program for three days, could anybody help to find the errors? Thanks a lot.

    sorry, the post looks ugly. Does anybody know how to make the indent not disappear?

  • Problem in displaying image on jsp page

    I want to display an image on jsp page.I copied the image the image in WebContent folder.
    I am able to see the image on the design pane when using the following code:-
    <img src="/image.gif" height="50" width="50"> but when i run it in the browser nothing gets diplsyed.
    also when i use the image container and select the source option that image is not displayed in the WebContents file..plz help.

    Hi,
    Seems that the Problem is there with the way how you specifuied the Image relative Path:
    You have specified the below: The opath of image starts with (/) forward slash:
    *<img src="/image.gif" height="50" width="50">*
    It means to access this Image WebLogic Container will form a Path like this:
    http://localhost:7001/image.gif
    BUT may be the image is available inside your Context root: So Change the <Img> tag like following in your JSP:
    *<img src="image.gif" height="50" width="50">*
    (*NOTE:* Never Start your src path with a Preceesing /)
    Now WLE will consider the path like below ..if your Applications Context root is "TestApp"
    http://localhost:7001/TestApp/image.gif
    I am Assuming that Inside the TestApp Application "image.gif" And "your.jsp" jSP pages are Co-Located (Means available in the Same Directory).
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Magical Stuff)

  • Display Chinese Character jsp page  by using UTF-8

    hi all,
    I have one jsp page have Chinese character, need to allow user input Chinese character into db, right now my situation is if I set <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> , the Chinese character in my jsp page I can't display correcly, but the inser is okI have to set encoding to big5, then I can't insert chinese character into my db correctly.
    can I use UTF-8 to display my jsp page, which have Chinese Character in there?Thank you!

    Hi Niklas
    thank you for the suggestion. somebody told me UTF-8 suppose work, only if you typing your Chiness character in UTF-8 formate, i don't know that is true or not, but that realy a challenge for me, I using jdbc , some time ago, and then stop, and on that period,if I got free time, I did try to learn some tutorials on struct, hibernate, like http://javaboutique.internet.com/tutorials/Struts/; http://courses.coreservlets.com/Course-Materials/struts.html
    recently I need to deal with some online form , first I want to use struct, but I keep got forwad problem, I forget the detail error message, and found not place to ask questions, so , I pick jdbc again, so ,if you have some useful link in struct or a nice community for people to learn struct, I am look forward to
    know that,
    by the way I set *<meta http-equiv="Content-Type" content="text/html; charset=big5" /> in my jsp*
    String dbURL="jdbc:mysql://localhost/survey?useBig5=true&characterEncoding=Big5"; in jdbc
    keep UTF-8 setting in mysql, it looks solute the problem that I had, hope that can enhabce our knowledge in that
    thank you for the help and wish good luck for future.

  • How to display  table in jsp pages

    hi all ,
    i want to diaplay the table in jsp page...ie,if i click on some option then i need to get the table in jsp page
    wiil u plz help me
    thanks in advance
    chintu

    hi all..
    i didnt ask how to design table in jsp...i am asking how to diaplay the table with data already stored in database...i just want to retrive the values in table and display in jsp.....
    thanks in advance...
    chintu

  • ADF BC:Displaying Image On JSP page

    Hai All
    I'm using ADF BC and JDev 10.1.3.
    I want to show an image on my jsp page from database.
    For this I have written an servlet with the following code
    response.setContentType("image/gif");
    OutputStream os = response.getOutputStream();
    String amDef = "package.AppModuleName";
    String config = "Configuration Name";
    ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
    ViewObjectImpl vo =
    (ViewObjectImpl)am.findViewObject("ViewObject"); // get view object (the same as used in the table)
    System.out.println("vo:" + vo);
    vo.executeQuery();
    Row row = vo.first();
    BlobDomain image = (BlobDomain)row.getAttribute("field");
    //System.out.println("image:" + image);
    InputStream is = image.getInputStream();
    // copy blob to output
    byte[] buffer = new byte[10 * 1024];
    int nread;
    while ((nread = is.read(buffer)) != -1)
    os.write(buffer, 0, nread);
    os.close();
    Configuration.releaseRootApplicationModule(am, false);
    This servlet working perfectly.The image is displayed on the page while running
    the servlet alone.
    My problem is the image is not got displyed on the jsp page
    I tried following code to call the servlet
    <af:objectImage source="ImageServlet"/>
    <img src="ImageServlet" width="140px" height="50px" align="right">
    Where ImageServlet is the url-pattern in the web.xml for the servlet
    Both method are not working
    Any body please help me.......
    what I'm missing..............
    Is there any other way to display an image on JSP page using backing bean
    method.
    Thanks
    Ans

    HI,
    See: http://kuba.zilp.pl/?id=241
    Kuba

  • Please help me with the jsp page

    Hi,
    I have a parent jsp page. I have a button in that page. If I click the button in the parent page, a child page will be opened which consists of huge data. I have set an option such that if I click the jsp page it asks to open directly or save so as to edit the data in MSWORD format. The child page has a print button at the end of the page which prints all the data. But since the data is very vast I want page breaks at certain places so that when I edit the data and click print button it prints the data with page breaks at certain points. I know that in MSWORD we have page breaks. But I should not do it manually as there would be thousands and thousands of pages to be printed.
    ANY IDEA OR HELP IN THIS MATTER IS GREATLY APPRECIATED. I HAVE BEEN TRYING TO SOLVE THIS MATTER AND POSTED IN MANY SITES. BUT NOBODY RESPONDED. ATLEAST PLEASE LET ME KNOW IF THE IDEA WHICH I MENTIONED IS WORNG OR NOT.
    THANKYOU
    MOUNTAINEER

    use java report?

  • Displaying userform on jsp page

    Hi.
    I'm using idm 5.5
    I created new form (with BPE) that displays some messages defined in rule.
    I would like to display this form on jsp page. How can I do it?
    Or is there any other way how to display strings defined in rule on jsp page in IdM?
    Thanks

    What do you mean "print data on a JSP?" If you simply mean display dynamic content, you should def read up both on sun's resources and other googled resources for JSP walkthroughs...

  • JSP and servlets(displaying Data On JSP page)

    Hiii all
    i am new to JSP ...also to servets
    tell me hw to print my data on the JSP page,
    i can print my data on the server,that data i want to print on JSP page
    if u all have e.g's it will be very good
    Thanks in advance
    Take Care
    Rahul :)

    What do you mean "print data on a JSP?" If you simply mean display dynamic content, you should def read up both on sun's resources and other googled resources for JSP walkthroughs...

  • Special characters are not displaying in ADF jsp page

    Hi All,
    By using ADF view controller,I am getting the data from database table but when I display the data in jsp page after special character < what ever the data is there it is not displaced.Provide any suggestions.
    Thanks in Advance
    Mani

    Hi Mani,
    < is a special HTML character and obviously it may not me displayed correctly.
    Here is a reference of all HTML special characters: http://www.w3schools.com/tags/ref_entities.asp
    In your case you can replace < with its special symbol representation - *&amp;#60; or &amp;lt;*
    I also advice you to do so for all special HTML characters.
    You can use this Java library for that purpose : http://commons.apache.org/lang/api/org/apache/commons/lang3/StringEscapeUtils.html
    Nikolay

  • Displaying content in JSP page, want BR but not other Html tags

    I have a page and am reading files and displaying the contents of the files onto the page in a <div> Oneissue is that in the file the end of line are \n or \r\n whichever operation system. I replaced those with <BR> no problem. Now my issue is that I display that in the JSP page:
    <c:out value="${filecontents}" escapeXml="false" />I use escapeXml so that <BR> will add the line breaks. Now my issue is that the file might contains other HTML tags that I want to display simply as text - I don't want the browser to render the other HTML tags.
    Is there a way to do that? Would I have to replace HTML tags with something special?

    Hmm... your file contains HTML tags, but you don't want the browser to interpret them as HTML tags, right? So the way to do that is to use escapeXml="true" in your c:out element.
    But then that also escapes the <BR> tags that you carefully put in there. And you don't want that. You want the browser to interpret those as HTML tags.
    I guess you can't have it both ways. Can you do something like outputting one line of the file at a time with <c:out ... escapeXml="true"> followed by <br>?

Maybe you are looking for

  • In AFAR amount is not calculate in 2008

    Hello Experts, while doing T Code : AFAR for fiscal year 2007 that time amount is calculate. i.e: Old amt. , New amt. , Difference amt 123.00 ; 23.00 ; 100.00 while doing T Code : AFAR for fiscal year 2008 that time amount is calculate. i.e: Old amt.

  • ITunes update always fails on Windows 7 x64

    I have had this problem for over a year on my Windows 7 64-bit system.  Whenever there is a new version of iTunes, I try and update using the iTunes Software Update notification that pops up.  This always fails to install.  I am then forced to uninst

  • How to designate the Adminstrat​or on my computer

    I am the Admin of my computer when I disabled my gadgets due to a computer threat you mentioned for Win 7.  Now when I try to check if it is disabled and other things it pops up that I need to be the adminstrator.    I am logged in and used my passwo

  • Critical error 3.0 :unable to start the core engine, The application cannot continue.

    Mentre usavo sony vegas pro 11 lo schermo del PC è diventato nero e poi e tornato normale ed è venuta la scritta driver grafico ripristinato e poi il PC si è riavviato e ora mi da lo schermo nero e si vede solo il puntatore del mouse per favore potet

  • Dynamic EJB reloading

    Hello I read about ejb dynamic reloading in a few places in ias documentation and i have the following quastions: - what will happen if i change deployment descriptors of ejb? - what will happen if i change some other classes like value object classe