Using a %% tag to write vb code in aspx file

<p>Trying to create a pdf from an rpt. I used the wizard wich generated the code within the div tags. I authored the code inside the <%%> tags. I am following an article written by Edward Tanguay-How to create PDF files from ASP.NET pages. Can I refer to the Crystal Report filename outside the div code-block and refer to those elements inside my <%-block. Here is the code</p><hr /><font size="1"><%</font><font size="1" color="#0000ff">@</font><font size="1"> </font><font size="1" color="#800000">Page</font><font size="1"> </font><font size="1" color="#ff0000">Language</font><font size="1" color="#0000ff">="VB"</font><font size="1"> </font><font size="1" color="#ff0000">AutoEventWireup</font><font size="1" color="#0000ff">="false"</font><font size="1"> </font><font size="1" color="#ff0000">CodeFile</font><font size="1" color="#0000ff">="Default.aspx.vb"</font><font size="1"> </font><font size="1" color="#ff0000">Inherits</font><font size="1" color="#0000ff">="_Default"</font><font size="1"> %></font><font size="1"> <p><%<font size="1" color="#0000ff">@</font><font size="1"> </font><font size="1" color="#800000">Register</font><font size="1"> </font><font size="1" color="#ff0000">TagPrefix</font><font size="1" color="#0000ff">="CR"</font><font size="1"> </font><font size="1" color="#ff0000">Namespace</font><font size="1" color="#0000ff">="CrystalDecisions.Web"</font><font size="1"> </font><font size="1" color="#ff0000">Assembly</font><font size="1" color="#0000ff">="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"</font><font size="1"> %><%</font></p></font><font size="1" color="#0000ff">@</font><font size="1"> </font><font size="1" color="#800000">Import</font><font size="1"> </font><font size="1" color="#ff0000">Namespace</font><font size="1" color="#0000ff">="CrystalDecisions.CrystalReports.Engine"</font><font size="1"> %></font><font size="1"> <p><%<font size="1" color="#0000ff">@</font><font size="1"> </font><font size="1" color="#800000">Import</font><font size="1"> </font><font size="1" color="#ff0000">Namespace</font><font size="1" color="#0000ff">="CrystalDecisions.Shared"</font><font size="1"> %></font></p></font><font size="1" color="#0000ff"><!</font><font size="1" color="#800000">DOCTYPE</font><font size="1"> </font><font size="1" color="#ff0000">html</font><font size="1"> </font><font size="1" color="#ff0000">PUBLIC</font><font size="1"> </font><font size="1" color="#0000ff">"-//W3C//DTD XHTML 1.1//EN"</font><font size="1"> </font><font size="1" color="#0000ff">"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"></font><font size="1" color="#0000ff"> <<font size="1" color="#800000">html</font><font size="1"> </font><font size="1" color="#ff0000">xmlns</font><font size="1" color="#0000ff">="http://www.w3.org/1999/xhtml"</font><font size="1"> </font><font size="1" color="#0000ff">></font><font size="1" color="#0000ff"> <p><<font size="1" color="#800000">head</font><font size="1"> </font><font size="1" color="#ff0000">runat</font><font size="1" color="#0000ff">="server"></font></p></font></font><font size="1" color="#0000ff"><</font><font size="1" color="#800000">title</font><font size="1" color="#0000ff">></font><font size="1">Test Report</font><font size="1" color="#0000ff"></</font><font size="1" color="#800000">title</font><font size="1" color="#0000ff">></font><font size="1" color="#0000ff"> </<font size="1" color="#800000">head</font><font size="1" color="#0000ff">></font><font size="1" color="#0000ff"> <p><<font size="1" color="#800000">body</font><font size="1" color="#0000ff">></font></p></font></font><font size="1"><p><font size="1" color="#0000ff"><</font><font size="1" color="#800000">form</font><font size="1"> </font><font size="1" color="#ff0000">id</font><font size="1" color="#0000ff">="form1"</font><font size="1"> </font><font size="1" color="#ff0000">runat</font><font size="1" color="#0000ff">="server"></font></p></font><font size="1"><p><font size="1" color="#0000ff"><</font><font size="1" color="#800000">div</font><font size="1" color="#0000ff">></font></p></font><font size="1"><p><font size="1" color="#0000ff"><</font><font size="1" color="#800000">CR</font><font size="1" color="#0000ff">:</font><font size="1" color="#800000">CrystalReportViewer</font><font size="1"> </font><font size="1" color="#ff0000">ID</font><font size="1" color="#0000ff">="CrystalReportViewer1"</font><font size="1"> </font><font size="1" color="#ff0000">Runat</font><font size="1" color="#0000ff">="server"</font><font size="1"> </font><font size="1" color="#ff0000">AutoDataBind</font><font size="1" color="#0000ff">="True"</font></p></font><font size="1"><p><font size="1" color="#ff0000">Height</font><font size="1" color="#0000ff">="947px"</font><font size="1"> </font><font size="1" color="#ff0000">ReportSourceID</font><font size="1" color="#0000ff">="CrystalReportSource1"</font><font size="1"> </font><font size="1" color="#ff0000">Width</font><font size="1" color="#0000ff">="845px"</font><font size="1"> </font><font size="1" color="#ff0000">BackColor</font><font size="1" color="#0000ff">="Beige"/></font></p></font><font size="1"><p><font size="1" color="#0000ff"><</font><font size="1" color="#800000">CR</font><font size="1" color="#0000ff">:</font><font size="1" color="#800000">CrystalReportSource</font><font size="1"> </font><font size="1" color="#ff0000">ID</font><font size="1" color="#0000ff">="CrystalReportSource1"</font><font size="1"> </font><font size="1" color="#ff0000">runat</font><font size="1" color="#0000ff">="server"></font></p></font><font size="1"><p><font size="1" color="#0000ff"><</font><font size="1" color="#800000">Report</font><font size="1"> </font><font size="1" color="#ff0000">FileName</font><font size="1" color="#0000ff">="CrystalReport1.rpt"></font></p></font><font size="1"><p><font size="1" color="#0000ff"></</font><font size="1" color="#800000">Report</font><font size="1" color="#0000ff">></font></p></font><font size="1" color="#0000ff"></</font><font size="1" color="#800000">CR</font><font size="1" color="#0000ff">:</font><font size="1" color="#800000">CrystalReportSource</font><font size="1" color="#0000ff">></font><font size="1"> </font><font size="1"><p><font size="1" color="#0000ff"></</font><font size="1" color="#800000">div</font><font size="1" color="#0000ff">></font></p></font><font size="1"><p><% </p></font><font size="1" color="#0000ff">Dim</font><font size="1"> myDoc </font><font size="1" color="#0000ff">As</font><font size="1"> ReportDocument = </font><font size="1" color="#0000ff">New</font><font size="1"> ReportDocument</font><font size="1"> <p><font size="1" color="#0000ff">Dim</font><font size="1"> ExpOpt </font><font size="1" color="#0000ff">As</font><font size="1"> ExportOptions = myDoc.ExportOptionsmyDoc.Load(</font></p></font><font size="1" color="#800000">"CrystalReport1.rpt"</font><font size="1">) </font><font size="1"><p>ExpOpt.ExportFormatType = ExportFormatType.PortableDocFormat</p><p>ExpOpt.ExportDestinationType = ExportDestinationType.DiskFile</p><p>myDoc.Export()</p><p>%> </p><p><font size="1" color="#0000ff"></</font><font size="1" color="#800000">form</font><font size="1" color="#0000ff">></font></p></font><font size="1" color="#0000ff"><</font><font size="1" color="#800000">button</font><font size="1"> </font><font size="1" color="#ff0000">title</font><font size="1" color="#0000ff">="Click Me"></font><font size="1">Do me again</font><font size="1" color="#0000ff"><</font><font size="1" color="#800000">img</font><font size="1"> </font><font size="1" color="#ff0000">src</font><font size="1" color="#0000ff">="icon-adobe-acrobat.gif"</font><font size="1"> </font><font size="1" color="#ff0000">alt</font><font size="1" color="#0000ff">="WoW"</font><font size="1"> </font><font size="1" color="#0000ff">/></</font><font size="1" color="#800000">button</font><font size="1" color="#0000ff">></font><font size="1" color="#0000ff"> </<font size="1" color="#800000">body</font><font size="1" color="#0000ff">></font><font size="1" color="#0000ff"> <p></<font size="1" color="#800000">html</font><font size="1" color="#0000ff">></font></p></font></font>

You're trying to put code tag in an auto-generated CrystalReportViewer aspx page, and putting code in the code tag.
That won't work - ASP.NET won't work like classic ASP.
In VS, drop a component - like a Button - on the page, then put your code in the codebehind for the click event for the Button.
Sincerely,
Ted Ueda

Similar Messages

  • I am using Firefox 4.0. Face problem opening .aspx file / application, any solution?

    webpage in form of Pop-up window (.aspx file ) is not getting opened in Firefox 4.0 browser. please suggest solution. The same webpage opened when opened with Google Chrome Browser 10.0.648.151.

    If text on web pages isn't visible then you most likely have a problem with the font that is used on those pages.
    As a test you can try to disable the website fonts and if that still doesn't work then try a few different default fonts.
    *Tools > Options > Content : Fonts & Colors > Advanced > [ ] "Allow pages to choose their own fonts, instead of my selections above"

  • Using filewriters to write to an already opened file

    Hi,
    I have used a filewriter to write some message to a file in a loop. Will i be able to write the messages for the rest of the iterations, if after the first iteration , i open that file in a notepad and check out if the message is being written properly?

    If you open the file before the filewriter opens it, the file might get locked causing an IOException when you try to open the file. But that only happens when the file is locked by the program that opens it. Notepad doesn't doen't lock the files it opens so you can safely open it. You won't see the updates that are made to the file after you open it until you reopen the file.
    You could also open it in you favorite browser, then you can hit the reload button to see the latest version.

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this?
    I dont know how to check the containsKey using jstl tags?
    <%
         LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");
         TreeSet nocSet               =     (TreeSet)request.getAttribute("nocSet");
         Iterator     yearMapIt     =     yearMap.keySet().iterator();
         while(yearMapIt.hasNext())
              int yearValue               =     (Integer)yearMapIt.next();
    %>
    <tr>
              <td><%=yearValue%></td>
    <%
              LinkedHashMap monthMap     =     (LinkedHashMap)yearMap.get(yearValue);
              Iterator     nocSetIt     =     nocSet.iterator();
              while(nocSetIt.hasNext())
                   String nCase=(String)nocSetIt.next();
                   if(monthMap.containsKey(nCase))
                        String count     =     (String)monthMap.get(nCase);
    %>
                        <td> <%= count %> </td>
    <%            }
                   else
    %>          
                        <td> 0 </td>     
    <%          
    %>
    </tr>
    <% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM

    <c:forEach var="yearMap" items="${requestScope.yearMap}">
         <th> <c:out value="${yearMap.key}"/> </th>
    <bean:define id="monthMap" value="${yearMap.value}"/>
    <c:forEach var="nocSet" items="${nocSet}">
    then how to write containsKey using tags??

  • Using EL How to Write a Customize tag

    I want to write a tag wich takes input and output as it is.Like when i pass an primitive types then it directly pass no transfer as we are puting "" literial to the values and pass it.
    For Example:
    <fun:add i1=10 i2=20 />
    check my code as i write tld ,and classes
    ------ function.jsp ------
    <%@ taglib uri="http://jakarta.apache.org/explang/funtion-taglib"
    prefix="fun" %>
    <%=<fun:add i1="10" i2="20" /> %>
    ----------function.tld-------------
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
         "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_2_0.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>2</jsp-version>
    <short-name>fun</short-name>
    <tag>
    <name>add</name>
    <tag-class>exp.MyClass</tag-class>
    <body-content>TAGDEPENDENT</body-content>
    <resolver-class>exp.MyVarRes</resolver-class>
    <expression-class>exp.MyExp</expression-class>
    <attribute>
    <name>i1</name>
    <required>true</required>
    </attribute>
    <attribute>
    <name>i2</name>
    <required>true</required>
    </attribute>
    </tag>
    </taglib>
    ---------evalutor&other classes-------
    ------MyClass.java-------
    package explang;
    public class MyClass{
    public int add(int x,int y){
    return(x+y);
    --------MyExp----------------
    package explang;
    import javax.servlet.jsp.el.*;
    public class MyExp extends Expression{
    public Object evaluate(VariableResolver vr)throws ELException{
         try{
              System.out.println("Execute evalute on MyExp");
    return Class.forName("java.lang.Integer.class");
         }catch(Exception e){ return null;}
    ------------MyExpEval----------------------
    package explang;
    import javax.servlet.jsp.el.*;
    public class MyExpEval extends ExpressionEvaluator{
    private int i1,i2;
    public void setI1(Integer i1){
    this.i1=i1.intValue();
    public void setI2(Integer i2){
    this.i2=i2.intValue();
    public java.lang.Object evaluate(java.lang.String name,java.lang.Class cls,javax.servlet.jsp.el.VariableResolver vr,javax.servlet.jsp.el.FunctionMapper fm)
    throws ELException{
         MyClass mc=new MyClass();
    try{
    mc=(MyClass)cls.newInstance();
    }catch(Exception e){ }
    int res=mc.add(i1,i2);
    return new Integer(res);
    public javax.servlet.jsp.el.Expression parseExpression(java.lang.String name,java.lang.Class cls,javax.servlet.jsp.el.FunctionMapper fm)
    throws ELException{
    return null;
    ------------MyVarRes------
    package explang;
    import javax.servlet.jsp.el.*;
    import javax.servlet.jsp.PageContext;
    public class MyVarRes implements VariableResolver{
         private PageContext mCtx;
         public MyVarRes(PageContext ctx){
              System.out.println("Intialize the PageContext");
              this.mCtx=ctx;
         public Object resolveVariable(String pName )throws ELException{
              if("pageContext".equals(pName))
    return mCtx;
    else
    return mCtx.findAttribute(pName);
    public Object resolveVariable(String name,Object gtype)throws ELException{
    if(gtype instanceof java.lang.Long)
    return (java.lang.Integer)gtype;
    return null;
    Is there any solution plz guide me,i have somewhere stuck in the middle bcz of this?

    I want to write a tag wich takes input and output as
    it is.Like when i pass an primitive types then it
    directly pass no transfer as we are puting ""
    literial to the values and pass it.
    For Example:
    <fun:add i1=10 i2=20 /> Can't do that, and even if you could, you shouldn't.
    1: Correct XHTML syntax requires the quotes, and custom tags were designed to fit into XHTML syntax.
    2: What would you possibly gain? doing <fun:add i1="10" i2="20" /> will translate the values to the appropriate data type for you - if you declare your set-method to have a Long prameter, then these values will be translated to Longs... Same for primitives...
    check my code as i write tld ,and classes
    ------ function.jsp ------
    <%@ taglib
    uri="http://jakarta.apache.org/explang/funtion-taglib"
    prefix="fun" %>
    <%=<fun:add i1="10" i2="20" /> %>What are you trying to do here? You can't put a custom tag inside a scriptlet/expression like that. You would either use custom tags OR scriptlets, not both. After all, what goes between <% ... %> tags (and <%= ... %>) needs to be Java code. And <fun:add i1="10" i2="20"/> is not java code.

  • Using EL How to write a custom tag?

    I want to write a tag wich takes input and output as it is.Like when i pass an primitive types then it directly pass no transfer as we are puting "" literial to the values and pass it.
    For Example:
    <fun:add i1=10 i2=20 />
    check my code as i write tld ,and classes
    ------ function.jsp ------
    <%@ taglib uri="http://jakarta.apache.org/explang/funtion-taglib"
    prefix="fun" %>
    <%=<fun:add i1=10 i2=20 /> %>
    ----------function.tld-------------
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_2_0.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>2</jsp-version>
    <short-name>fun</short-name>
    <tag>
    <name>add</name>
    <tag-class>exp.MyClass</tag-class>
    <body-content>TAGDEPENDENT</body-content>
    <resolver-class>exp.MyVarRes</resolver-class>
    <expression-class>exp.MyExp</expression-class>
    <attribute>
    <name>i1</name>
    <required>true</required>
    </attribute>
    <attribute>
    <name>i2</name>
    <required>true</required>
    </attribute>
    </tag>
    </taglib>
    ---------evalutor&other classes-------
    ------MyClass.java-------
    package explang;
    public class MyClass{
    public int add(int x,int y){
    return(x+y);
    --------MyExp----------------
    package explang;
    import javax.servlet.jsp.el.*;
    public class MyExp extends Expression{
    public Object evaluate(VariableResolver vr)throws ELException{
    try{
    System.out.println("Execute evalute on MyExp");
    return Class.forName("java.lang.Integer.class");
    }catch(Exception e){ return null;}
    ------------MyExpEval----------------------
    package explang;
    import javax.servlet.jsp.el.*;
    public class MyExpEval extends ExpressionEvaluator{
    private int i1,i2;
    public void setI1(Integer i1){
    this.i1=i1.intValue();
    public void setI2(Integer i2){
    this.i2=i2.intValue();
    public java.lang.Object evaluate(java.lang.String name,java.lang.Class cls,javax.servlet.jsp.el.VariableResolver vr,javax.servlet.jsp.el.FunctionMapper fm)
    throws ELException{
    MyClass mc=new MyClass();
    try{
    mc=(MyClass)cls.newInstance();
    }catch(Exception e){ }
    int res=mc.add(i1,i2);
    return new Integer(res);
    public javax.servlet.jsp.el.Expression parseExpression(java.lang.String name,java.lang.Class cls,javax.servlet.jsp.el.FunctionMapper fm)
    throws ELException{
    return null;
    ------------MyVarRes------
    package explang;
    import javax.servlet.jsp.el.*;
    import javax.servlet.jsp.PageContext;
    public class MyVarRes implements VariableResolver{
    private PageContext mCtx;
    public MyVarRes(PageContext ctx){
    System.out.println("Intialize the PageContext");
    this.mCtx=ctx;
    public Object resolveVariable(String pName )throws ELException{
    if("pageContext".equals(pName))
    return mCtx;
    else
    return mCtx.findAttribute(pName);
    public Object resolveVariable(String name,Object gtype)throws ELException{
    if(gtype instanceof java.lang.Long)
    return (java.lang.Integer)gtype;
    return null;
    Is there any solution plz guide me,i have somewhere stuck in the middle bcz of this?

    I want to write a tag wich takes input and output as
    it is.Like when i pass an primitive types then it
    directly pass no transfer as we are puting ""
    literial to the values and pass it.
    For Example:
    <fun:add i1=10 i2=20 /> Can't do that, and even if you could, you shouldn't.
    1: Correct XHTML syntax requires the quotes, and custom tags were designed to fit into XHTML syntax.
    2: What would you possibly gain? doing <fun:add i1="10" i2="20" /> will translate the values to the appropriate data type for you - if you declare your set-method to have a Long prameter, then these values will be translated to Longs... Same for primitives...
    check my code as i write tld ,and classes
    ------ function.jsp ------
    <%@ taglib
    uri="http://jakarta.apache.org/explang/funtion-taglib"
    prefix="fun" %>
    <%=<fun:add i1="10" i2="20" /> %>What are you trying to do here? You can't put a custom tag inside a scriptlet/expression like that. You would either use custom tags OR scriptlets, not both. After all, what goes between <% ... %> tags (and <%= ... %>) needs to be Java code. And <fun:add i1="10" i2="20"/> is not java code.

  • Write PHP code above HTML tag

    I've created a toolset that allows me to add Form fields that
    we use in our system. But now I want to take that a step further. I
    want to be able to write corresponding PHP code above the HTML tag
    at a specific location. This while looping through the formfields
    in the form and dynamically write the INSERT and/or UPDATE query.
    The last bit I can probably figure out. What I would like to
    know is how to write the code above the HTML tag between <?
    ?> or with a search/replace of the INSERT or UPDATE line in the
    code.
    Can anyone give me some hints or tips on this?
    Thanks in advance!

    Hi Bahare,  
    The <script> tag is used to define a client-side script, such as a JavaScript.
    The <script> element either contains scripting statements or it points to an external script file through the src attribute.Common
    uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
    You should write C# code inside asp.net (C#)(.cs).page. For more infomation,Please check
    http://msdn.microsoft.com/en-us/library/vstudio/k33801s3(v=vs.100).aspx
    In addition,
    This forum is to discuss problems of C# development.
    You'll need to post it in
    ASP.NET forum for more efficient responses, where you can contact ASP.NET experts.
    Best Regards,
    Kristin

  • TS1292 Purchased gift cards about a year ago. Misplaced two of them. Found them yesterday, tried to use one today. Invalid. If the money is tagged to the card code why is it invalid? Now have to take photos of both sides and find receipt? Guess out $20?

    Purchased gift cards about a year ago. Misplaced two of them, but Found them yesterday. i tried to use one today. Invalid. If the money is tagged to the card code why is it invalid? Now have to take photos of both sides and find receipt? Finding the receipt might take as long as .finding the cards. If I paid hard earned money for the card from a computer company why would that card not be in their data base waiting to be activated? I guess I am out $20 to Apple for not activating immediately! My account was hacked once so I won't put a credit card in and live with gift cards. Now I am getting hit for $20, two gift cards for ten each. I now question who and how people are making money?? Is my only solution, buy card, redeem code instantly, purchase item?

    Hi Oxfordataloss,
    Thanks for posting. I'm really sorry you've had such problems with BT, it's certainly not the kind of service we would hope to provide. I'll take your comments on board and if you don't receive the final bill as expected please drop me an email with the account details and a link to this thread for reference.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

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

  • Accessing a File within a zip, which was archived using Applet Tag

    Hi,
    Could Any one please tell me, How to Access a File from within an Applet. The File resides inside a zip which was Archived using <Applet> Tag.
    Actually, I want to write an application which runs both online and offline. So I have chosen Applet and All the files Which I need are zipped and is Archived through <Applet ARCHIVE="example.zip">.
    Now I want to access those XML files which are inside example.zip from my Applet.
    How can I do that?
    I think I will get security Exception.
    How to get rid of this security Exception.
    Kindly Answer soon.......
    It's very urgent.
    Thanking you,
    KumudaRaj

    Did you already try signing a jarfile? If no ->>
    You can call a class inside a jar-file within the applet.
    if this class should be able to acces files the jarfile
    first has to be signed. to do this, you must generate a key.
    the complete work:
    1. write your applet
    2. write a html-page with following code:
    <APPLET code="guestbook.class" archive="guestbook.jar" width=600 height=400></APPLET>
    3. make a zip-file with the guestbook.class, guestbook.form, guestbook$1.class, guestbook$... and rename it to guestbook.jar
    4. in the console type:
    keytool -genkey -alias YOURNAME
    5. sign the key to your jarfile with:
    jarsigner guestbook.jar YOURNAME
    6. try the applet. a warning should appear which you have to answer
    with YES then it should work
    my trouble is that i cant acces files anyway because right now i don�t
    alreadv have the clue to get the right (absolute?) path for the file. means i get an ioexception because the applet cant find the file :-((
    does anyone know how to solve this problem then? my code is:
    FileReader Stream = new FileReader("/members/Ui97u8g4f6b89mj90kh5gbr4ecf6KXC4/guestbook.txt");
    ...

  • How can I write HTML code in this forums

    Sorry but I didn't know where to post this thread.....
    How can I write HTML code in this forums?

    Hello,
    Every piece of code in your post should be wrapped with the forum tags [ code] and [ /code], without the blanks.
    In case of the &lt;a> tag, that is not enough. In this case, you have several options. The most elegant one is to use the entity name for the less-then sign - & lt; - without any spaces. Other options is to add a space between the less-then and the ‘a’ character (and make a note of it) or change the less-then character with a left bracket one.
    When posting code, you should always use the forum preview option, just to make sure the forum software “understood” your code correctly.
    Hope this helps,
    Arie.

  • How to use nested tag in Struts

    Hi..
    Can any one guide me how to use nested tag in Struts. So far i already tried bean tag with no error but when i try to use nested tag i got error like
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Below are my class:
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP page
    <logic:iterate id="list" name="MyDetailList">
    Company ID : <bean:write name="list" property="companyID" />
    </logic:iterate>
    For bean tag, i got no error at all and below are my code for nested tag
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP Page
    <nested:nest property="MyDetailList">
    Make : <nested:text property="make"/>
    Car ID : <nested:text property="carID"/>
    </nested:nest>
    When i run the code, i got error message
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Any body can help me?
    zul

    what am I doing wrong?You will notice above that I mentioned
    YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
    (was that loud enough for you to notice this time)?
    Try
    <html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
    //or
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
    better alternative: populate your formbean with your action and just have:
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
    If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
    Cheers,
    evnafets

  • How to write C# code in HTML code?

    Hi,
    I want that write C# code in script tag in html document. I write this code:
    <script>
    function AddNewLinkfn()
    var LinkName = prompt("Please enter Link Name:", "");
    var LinAddress = prompt("Please enter Link Address:", "");
    if (LinkName != "" && LinAddress != "" && LinkName != null && LinAddress != null) {
    <% string esmelink=%> LinkName <% ,adreselink= %> LinkAddress<%;%>
    </script>
    but this has error.
    I Thanks anyOne that guide me. :)
    Good luck!

    Hi Bahare,  
    The <script> tag is used to define a client-side script, such as a JavaScript.
    The <script> element either contains scripting statements or it points to an external script file through the src attribute.Common
    uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
    You should write C# code inside asp.net (C#)(.cs).page. For more infomation,Please check
    http://msdn.microsoft.com/en-us/library/vstudio/k33801s3(v=vs.100).aspx
    In addition,
    This forum is to discuss problems of C# development.
    You'll need to post it in
    ASP.NET forum for more efficient responses, where you can contact ASP.NET experts.
    Best Regards,
    Kristin

  • Where i shall write html code in jdeveloper

    Hello,
    please tell me where i can write html code in jdeveloper.
    Thanks

    Hi catalina,
    Html tags should not be used directly inside ADF faces pages which may lead to some undesirable results instead you can use ADF Faces tags itself using which you can do what ever you wanted to do with html tags.
    If you still need to use html tags, you can use ADF Faces html tags.
    Tag doc: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/html/index.html
    Sireesha

  • Why does people use JSP Tag for their JSP page? (Urgent)

    I don't know what benifit if I am using JSP Tag.
    If anyone knows, pls give me an idea and the advantage of using JSP Tag in JSP Page!
    Thanks in advance!

    You have to read a little about JSP, JSP stands for JavaServer Pages, you can use jsp tags and you can use java code. If you dont want to use jsp tags then you should just write html file, if you just want to use java, then write java class or a servlet.
    The need for jsp arised because people were inserting html code inside a servlet class..a big no no..and a headache. JSP separate model from the view...read a little about MVC-2 model view controller pattern.
    Also read some tutorial on this website...good luck
    K

Maybe you are looking for

  • Can MoCA Cable Adapters Be Used To Connect Ethernet to Apple TV?

    I don't want to run a new 50'-60' ethernet line throughout the house (through the basement), to connect an ethernet line from my 2013 iMac Modem to the Apple TV -. and was wondering if anyone has experience using the newer MoCA cable line adapters fo

  • Startup disk not show Mac OS

    Installed Windows 7 via bootcamp but now when I boot my rMBP, it goes straight into Windows 7 rather than OS X Mavericks. I went into System Preferences > Startup Disk to change the boot drive but my Macintosh HD isn't listed. Screen shot located bel

  • Larger thumbnail views?

    Can I resize the thumbnails that appear in regular view to a size larger than that allowed by pulling the widget at the lower-right corner of the screen to the farthest right? Would Pref Setter do this? I thought I was getting larger thumbnails when

  • Can't get rid of safesear.ch for homepage

    I can't change my homepage to yahoo, its safesear.ch. I've tried EVERYTHING: updated firefox, refreshed firefox thru troubleshooting information twice, scanned 3times(once was full scan) thru windows defender, micro-soft security safety utilities, ma

  • Crystal Reports version 10.0.0.53327 supported on Windows Server 2003 R2?

    Hello, We are currently using Crystal Reports version 10.0.0.53327 with a ASP web application on Windows 2000 Server. We are in the process of upgrading the web server to Windows Server 2003 R2 but have encountered problems with the print feature in