Ajax implementation on my JSP PAGE

Hi..
In my jsp page I am uploading *.XLS file and in the nest page I am Selecting the sheets in that .XLS file,
I want to implement AJAX so that I can upload the (.XLS file) and select the sheets in the .XLS file in Single JSP file
Can any one know how to implement?
Thanks
Mallik

if you need ajax code, you re on the wrong forum :)

Similar Messages

  • Create jsf jsp page / page implementation / third option is not visible

    The third option (check box) for page implementation settings in the create jsf jsp page is not visible. The window is not resizable.

    I see the option radio button and text "Automatically Expose UI Components in an Existing Managed Bean" that is disabled but i see only partially the label what is a disabled input text field i suppose just below the radio button.
    I see also the Directory input field and Browse button a little bit truncated at the bottom (1-2 pixels missing).
    I see also the Render in Mobile Device check box and combo box ... cutted by the half when i expand the page implementation part.
    As said the window is not resizable.
    Let me know a location i can send you a hard copy of the screen.

  • How to implement content caching for jsp page ?

    Hello everyone,
    I am reading an article <Servlets and Jsp Best Practice>,at
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/#author, on one section it is saying :
    "Cache content: You should never dynamically regenerate content that doesn't
    change between requests. You can cache content on the client-side, proxy-
    side,or server-side. "
    Now I am working on a project. For every user, some of the content servlet generated will be the same for at least a week . I am thinking if I implement caching for these jsp pages, that would increase performace a lot.
    But I have no idea how to implement it either client-side or server-side, can someone give me a hint ?
    Thanks,
    Rachel

    You mean actually you are caching the response stream
    and the key to distinguish between different response
    streams are made of user's different request
    parameters. And the filter's function is to intercept
    the request to see if this request parameter's
    combination already exists in the Hashmap,then either
    use the cached response or forward to
    servlet.....really interesting...Do I get it right ?Yes that's it in a nutshell.
    >
    Then how do you build those response streams in
    advance ? You did it manually or have some mechanism
    to build it automatically ?
    The data gets cached the first time somebody visits the page.
    Find some examples on Filters, and take a look at the HttpServletResponseWrapper class. You need to cache response headers as well as the body. Another pitfall that you might run into is handling an If-modified-since header on the request. Don't cache the results of those requests.
    -Jonathan
    >
    Thanks again !
    Rachel

  • Implementing Database codes FAIL /error in parsing data into jsp page

    Hi there,
    I have this problem trying to build a portal application. I am using the JSPDynPage, jsp page and a bean to build a page.
    I have this problem parsing data from JSPDynPage to the beans and to the jsp page.
    I tested out the connection between the beans and the jsp page. There is no error parsing information from the beans to the jsp page.
    So i tried to test out the codes for the database from the beans.
    Will this work? Because it does not display the results i want.
    I need an Solution asap to find out wad is wrong also also the correct codes to the database.
    public String db(){
    try {
                 InitialContext iC = new InitialContext();
                 DataSource dataSource = (DataSource)iC.lookup("java:env/jdbc/mySQL");
                 java.sql.Connection connection = dataSource.getConnection();
                 PreparedStatement st = connection.prepareStatement("SELECT name FROM test WHERE id='123'");
                 ResultSet resultSet = st.executeQuery();
                 while (resultSet.next()){
                      name = resultSet.getString("name");
                      name = name.toString();
                 connection.close();
                 return name;
                 } catch(Exception n){
                      e = "Exception";
                      return e;
    This is the method i put in the beans to test out the database connection.
    Thanks Loads
    Quatre

    Hi there,
    Thanks for the reply, i thought that no one is going to reply me anymore. Thanks loads.
    Bean Class name: Bean1
    Bean Packeage name: Beans1
    Bean id : myBean1
    Jsp Codes
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean id="myBean1" scope="application" class="Beans1.Bean1" />
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
       <hbj:textView id = "ll" text="lalalalalalalalalasasa" />
      <%--
    <hbj:textView id = "l">
                   <% l.setName(myBean1.getName());%>
    </hbj:textView>
    --%>
    <hbj:textView
                    id="appraisal_yr_label"
                    text="Apprasial Year:">
                    </hbj:textView>
                    <hbj:textView id = "la" >
                    <% la.setText(myBean1.getName());%>
                    </hbj:textView>
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Beans1.java
    package Beans1;
    import java.io.Serializable;
    public class Bean1 implements Serializable{
    private String name = new String();
    private String e = new String();
    private String year = new String();
         public void setName(String name){
              this.name = name;
         public String getName(){
              return name;
    JSPDynPage
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
      public DynPage getPage(){
        return new testDBv5DynPage();
      public static class testDBv5DynPage extends JSPDynPage{
        private Bean1 myBean1= null;
        private String name = new String();
        public void doInitialization(){
              try{
                                  IntitialContext context = new javax.naming.InitialContext();
                                  DataSource dataSource = (DataSource)context.lookup("java:env/jdbc/appDB");
                                  Connection connection = dataSource.getConnection();
                                  Statement stmt = connection.createStatement();
                                  ResultSet rs = stmt.executeQuery("Select AppraisalYear From tblAppraisal Where AppraisalYear='2007'");
                                          while(rs.next()){
                                            year = rs.getString("AppraisalYear");
                                            rs.close();
                                            stmt.close();
                                            connection.close();
                                            return year;
                                       }catch (Exception n){
                                            n.printStackTrace();
              IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
                     Object o = profile.getValue("myBean1");
                     if(o==null || !(o instanceof Bean1)){
                        myBean1 = new Bean1();
                        profile.putValue("myBean1",myBean1);
                     } else {
                          myBean1 = (Bean1) o;
                        Object value = request.getSession().getValue("myBeans1");
                        if (value==null || (value instanceof Bean1)){
                             myBean1 = new Bean1();
                        request.getSession().putValue("myBean1", Object value);
              DataBase cn = new DataBase();
              name = cn.dataBaseConnection();
              myBean1.setName(name);
    //name = "gir";
    //myBean1.setName(name);
    // IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    //IPortalComponentContext myContext = request.getComponentContext();
    //Bean1 myNameContainer = (Bean1) myContext.getValue("myBean1");
    //myNameContainer.setName(name);
          // fill your bean with data here...
        public void doProcessAfterInput() throws PageException {
        public void doProcessBeforeOutput() throws PageException {
          this.setJspName("testDBv5.jsp");
    //testing purpose
      public static void main (String[] arg){
         testDBv5DynPage ef = new testDBv5DynPage();
               ef.doInitialization();
    Thanks Loads
    Quatre

  • How do I expand my simple JSP page to implement Connection Pooling?

    Hi everyone,
    I have a small SQL database which contains information about Students and a StudenBean which contains their attributes and appropriate get/set methods (which I haven't needed to use yet).
    I want to write a simple JSP page which displays all the students details in one big table. I can do this using the basic prototyping method of adding the dataSource and driver details to the deployment descriptor (web.xml - I'm using the latest version of Tomcat by the way) and then accessing the database using JSP standard SQL actions.
    Here's a snipet of what I've done (just an example, the final code works):
    <sql:query var="temp"
    sql="SELECT * FROM Employee ORDER BY UserName"
    />
    <c:forEach items="${temp.rows}" var="row">
    <td><c:out value ="${row.UserName}"/></td>
    <td><c:out value ="${row.FirstName}"/></td>
    <td><c:out value ="${row.LastName}"/></td>
    Now I want to upgrade! I want to access the dataSource using Connection Pooling and it's causing me a lot of trouble. I already have the required working classes/data such as ConnectionPool.java, ResourceManagerListener.java, the MySQL driver etc.
    However, I don't know what the best way to setup the connection for my purposes would be and where I should do it.
    Do I need to write a servlet or tag handler/custom action to establish the connection and access my bean through it? I would like to keep a similar sort of business logic as I already have developed i.e. be able to use actions in my JSP page to cycle through the database and print out each detail from the row.
    Rather confused and muddled. Thanks for any input!

    Good idea.
    Set up a JNDI data source for your app, according to these docs:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    You'll have to put the right information into your web.xml and a context.xml. Once you've done that, your JSTL JSPs will simply use the connection resource automagically.
    MOD

  • JSP implementation class for a JSP Page

    Hello,
    It is very important for me to know ...
    - Do you consider that a JSP developer should know that each JSP Page becomes at run-time a Java Servlet ? And int the way that the Java code you have wrote in the JSP Page is dispatched in the declaration of this servlet ?
    He should know how the Java code generated by the server looks like ?
    Thank you all for your answers.
    Adriana

    Everybody's going to have their own opinion on this - here's my 2 cents.
    Theoretically, there are at least two roles here.
    #1. An expert in HTML, graphic layout, user interface etc.
    #2. A programmer who understands the technical infrastructure - Java, beans, servlets, database connections etc.
    In the perfect world, Role #1 would build JSPs and would not need to understand Java or the technical architecture. The JSPs would act as templates and not contain any Java code (e.g. scriptlets). Role #2 would build custom tags and beans for use in the JSPs.
    To answer your question, Role #1 should not understand how JSPs are translated to servlets, but Role #2 should.
    In reality, the two roles are often filled by the same person, usually a programmer who may introduce Java elements into the JSP. Once this occurs, then the JSP has become a program rather than a template and knowledge of its translation to servlets is necessary for debugging.

  • Issue in applying SSL selectively to Login JSP Page--Session getting lost.

    Hi,
    I am facing some issues with SSL configuration on my web site running on tomcat 5.5. I am using jdk 1.5 and form based authentication with JAAS framework.
    The SSL configuration is working perfectly when applied to complete web site, but starts giving problem when applied selectively to some JSP pages. At present I am trying to apply SSL just on the login page.
    When the login screen loads up, the URL in the browser has a protocol "*https*", as expected, but it doesn't gets changed to "*http*" once the user has successfully logged in. Why is the automatic change from https to http not ocurring?
    Also I want to know which is the default page, tomcat will direct the logged in user to, once successfully authenticated using form based login; Is there any way to change this default page to some other page. It looks like that tomcat automatically directs to index.html , once the user has been successfully authenticated, but I am not so sure. My index.html page is having 4 frames; the source of these frames are different JSP pages, which are not under SSL.
    My aim is to apply SSL just on login.jsp so that password doesn't travel in clear text. Once the user is authenticated he should see index.html and the address bar's URL should change it's protocol from https to http.
    Please, find below the code in my web.xml
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>CWA Application</web-resource-name>
    <url-pattern>/about.jsp</url-pattern>
    <url-pattern>/admin_listds.jsp</url-pattern>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <security-constraint>
    <web-resource-collection>
    <url-pattern>/*login.jsp*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>CWA Application</realm-name>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/login.jsp?error=true</form-error-page>
    </form-login-config>
    </login-config>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    My login. jsp has below code:
    <form name="login" method="POST" action='<%= response.encodeURL(*"j_security_check*") %>' >
    <tr>
    <td width="100%">
    <table width="260" border="0" cellspacing="0" cellpadding="1">
    <tr>
    <td align="left" valign="top" rowspan="4"><img src="images/space.gif" width="15" height="5"></td>
    <td align="right" class="login-user" nowrap ><p>User name: </p></td>
    <td align="left" valign="top"><input maxLength="64" name="j_username" size="20"></td>
    </tr>
    <tr>
    <td align="right" nowrap class="login-user"><p>Password: </p>
    </td>
    <td align="left" valign="top">
    <input maxLength=\"64\" tabindex="2" type="password" name="j_password" size="20">
    </td>
    </tr>
    </form>
    The entries in my server.xml are following:
    <Connector port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    keystoreFile="${java.home}\lib\security\cacerts" keystorePass="changeit"
    clientAuth="false" sslProtocol="TLS" />
    I have gone through the http://forums.sun.com/thread.jspa?threadID=197150 and tried implementing it; The filter as explained in the thread does gets called but the session values are still lost.
    Please note I am using javascript to go from secure "https" to "http" once the user has successfully logged in The javascript code is as below:
    top.location.href="http://localhost:8080/qtv/index.html." ;
    If I use response.sendRedirect("http://localhost:8080/qtv/index.html") for going to non-secure mode, the index.html page does not gets loaded properly. (Please note that my index.html is made of *4 frames*, as explained earlier. This is a legacy code and frames can't be removed).
    The reason for index.html not getting loaded properly is that the Address bar URL does NOT change its URL and protocol from https (https://localhost:8443/qtv/index.html ) to "*http*" (http://localhost:8080/qtv/index.html) when esponse.sendRedirect() is used ;this is the default behaviour of response.sendRedirect(). And because the protocol in address bar is https, index.html is not able to load the other JSP's in it's frames because of cross-frame-scripting security issues (The other JSP's to be loaded in frames are are NOT secure as discussed earlier).
    Please let know if any way out.
    Thanks,
    Masaai

    Hi
    try to set the maximum interval between requests
    eg:
    session.setMaxInactiveInterval(6000);
    vis

  • Urgent: SAX parser bean is not working in JSP page

    Hi All,
    I have created a bean "ReadAtts" and included into a jsp file using
    "useBean", It is not working. I tried all possibilities. But Failed Plz Help me.
    Below are the details:
    Java Bean: ReadAtts.java
    package sax;
    import java.io.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import java.util.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.ParserConfigurationException;
    public class ReadAtts extends DefaultHandler implements java.io.Serializable
         private Vector attNames = new Vector(); //Stores all the att names from the XML
         private Vector attValues = new Vector();
         private Vector att = new Vector();
         private Locator locator;
         private static String start="",end="",QueryString="",QString1="",QString2="";
    private static boolean start_collecting=false;
         public ReadAtts()
         public Vector parse(String filename,String xpath) throws Exception
    QueryString=xpath;
         StringTokenizer QueryString_ST = new StringTokenizer(QueryString,"/");
         int stLen = QueryString_ST.countTokens();
         while(QueryString_ST.hasMoreTokens())
              if((QueryString_ST.countTokens())>1)
              QString1 = QueryString_ST.nextToken();
    else if((QueryString_ST.countTokens())>0)
                   QString2 = QueryString_ST.nextToken();
         SAXParserFactory spf =
    SAXParserFactory.newInstance();
    spf.setValidating(false);
    SAXParser saxParser = spf.newSAXParser();
    // create an XML reader
    XMLReader reader = saxParser.getXMLReader();
    FileReader file = new FileReader(filename);
    // set handler
    reader.setContentHandler(this);
    // call parse on an input source
    reader.parse(new InputSource(file));
         att.add("This is now added");
         //return attNames;
    return att;
    public void setDocumentLocator(Locator locator)
    this.locator = locator;
    public void startDocument() {   }
    public void endDocument() {  }
    public void startPrefixMapping(String prefix, String uri) { }
    public void endPrefixMapping(String prefix) {  }
    /** The opening tag of an element. */
    public void startElement(String namespaceURI, String localName,String qName, Attributes atts)
    start=localName;
    if(start.equals(QString2))
    start_collecting=true; //start collecting nodes
    if(start_collecting)
    if((atts.getLength())>0)
    for(int i=0;i<=(atts.getLength()-1);i++)
    attNames.add((String)atts.getLocalName(i));
    attValues.add((String)atts.getValue(i));
    /** The closing tag of an element. */
    public void endElement(String namespaceURI, String localName, String qName)
    end = localName;
    if(end.equals(QString2))
         start_collecting=false; //stop colelcting nodes
    /** Character data. */
    public void characters(char[] ch, int start, int length) { }
    /** Ignorable whitespace character data. */
    public void ignorableWhitespace(char[] ch, int start, int length){ }
    /** Processing Instruction */
    public void processingInstruction(String target, String data) { }
    /** A skipped entity. */
    public void skippedEntity(String name) { }
    public static void main(String[] args)
    String fname=args[0];
    String Xpath=args[1];
    System.out.println("\n from main() "+(new ReadAtts().parse(fname,Xpath)));
    //System.out.println("\n from main() "+new ReadAtts().attNames());
    //System.out.println("\n from main() "+new ReadAtts().attValues());
    JSP File:
    <%@ page import="sax.*,java.io.*,java.util.*,java.lang.*,java.text.*;" %>
    <jsp:useBean id="p" class="sax.ReadAtts"/>
    Data after Parsing is.....
    <%=p.parse"E:/Log.xml","/acq/service/metrics/system/stackUsage")%>
    Expected Output:
    The jsp file should print all the vector objects from the "ReadAtts" bean
    Actual Output:
    Data after Parsing.......[]
    Thanks for your time.....
    Newton
    Bangalore. INDIA

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • Why doesn't doFilter work was expected when a .jsp page is accessed?

    I'm hoping an expert could point me in the right direction or tell me
              if this is a bug in WebLogic.
              My environment is WebLogic 6.1 (service pack 4), on Windows 2000.
              I need to capture all the response data that comes back from the
              servlet. So, I have a simple filter that wraps the response object,
              and sends the wrapped object into filterChain.doFilter() method.
              I've set up the web.xml so that any servlet access should trigger my
              filter (the <url-pattern> is /*). I've also configured a sample
              web-app called TEST to serve .html/.jsp pages.
              When the browser makes a .html request, everything works as expected.
              After the filterChain.doFilter(), I can take a look at the wrapped
              response object and print the contents of the response.
              However, when I access a .jsp page as part of form data submit, the
              output stream of my wrapper is empty after the filterChain.doFilter()
              completes.
              If I don't wrap the response, then everything seems to work fine. The
              .jsp gets interpreted properly by the servlet container, I can see the
              result page in the browser just fine.
              By inserting debug statements, I can see that if I wrap the responses,
              for a .html request, under the covers, wrapper's getOutputStream()
              gets called. But for a .jsp request, under the covers, wrapper's
              getWriter() gets called. I don't know how significant this is, but
              this is the only difference I see!
              If I don't wrap the response, I am not sure how to get at the response
              data. All I need to do is to take certain actions depending on the
              response. That is why I'm using a wrapper to get at the response data.
              In the JRun AppServer, the code just works fine.
              I've enclosed the source code & the output that demonstrates the
              problem.
              What am I doing wrong? Or, is this a bug in WebLogic? If this is a
              bug, is there a patch available?
              Thanks,
              --Sridhar
              // HeaderFilter.java
              // This is the filter that gets invoked through the web.xml
              configuration
              import javax.servlet.*;
              import javax.servlet.http.*;
              import java.io.*;
              import java.util.*;
              public class HeaderFilter implements Filter {
              public FilterConfig filterConfig;
              public void destroy() {
                        this.filterConfig = null;
                   public void init(FilterConfig filterConfig) {
                        this.filterConfig = filterConfig;
              public FilterConfig getFilterConfig() {
              return filterConfig;
              public void setFilterConfig(FilterConfig filterConfig) {
              this.filterConfig = filterConfig;
              public void doFilter(ServletRequest req, ServletResponse resp,
              FilterChain chain)
              throws java.io.IOException, javax.servlet.ServletException {
              ServletContext context = filterConfig.getServletContext();
              HttpServletResponse response = (HttpServletResponse)resp;
              TestResponseWrapper wrapper = new
              TestResponseWrapper(response);
              chain.doFilter(req, wrapper);
              OutputStream out = resp.getOutputStream();
              System.out.println("The content length is :" +
              wrapper.getContentLength());
              if ("text/html".equals(wrapper.getContentType())) {
              byte[] data = wrapper.getData();
              System.out.println("TEXT RESPONSE, length is " +
              data.length);
              System.out.println(new String(data));
              out.write(data);
              // out.close();
              // TestResponseWrapper.java
              // This class wraps the response object so that you could take a look
              at
              // the response contents after the filterConfig.doFilter() method
              import javax.servlet.ServletOutputStream;
              import javax.servlet.http.HttpServletResponse;
              import javax.servlet.http.HttpServletResponseWrapper;
              import java.io.ByteArrayOutputStream;
              import java.io.PrintWriter;
              public class TestResponseWrapper extends HttpServletResponseWrapper{
              private ByteArrayOutputStream output;
              private int contentLength;
              private String contentType;
              public TestResponseWrapper(HttpServletResponse response) {       
              super(response);
              output = new ByteArrayOutputStream();
              public ServletOutputStream getOutputStream() {    
              System.out.println("****** getOutputStream() called *******");
              return new FilterServletOutputStream(output);
              public byte[] getData() {
              return output.toByteArray();
              public PrintWriter getWriter() {   
              System.out.println("****** getWriter() called *******");
              return new PrintWriter(getOutputStream(), false);
              public void setContentType(String type) {       
              System.out.println("**** Wrapper setContentType called ****");
              this.contentType = type;
              super.setContentType(type);
              public String getContentType() {       
              return this.contentType;
              public int getContentLength() {    
              return contentLength;
              public void setContentLength(int length) {       
              System.out.println("**** Wrapper setContentLength called
              this.contentLength=length;
              super.setContentLength(length);
              // FilterServletOutputStream.java
              // This class is used by the wrapper for getOutputStream() method
              // to return a ServletOutputStream object.
              import javax.servlet.ServletOutputStream;
              import java.io.DataOutputStream;
              import java.io.IOException;
              import java.io.OutputStream;
              import java.io.*;
              public class FilterServletOutputStream extends ServletOutputStream {
              private DataOutputStream stream;
              public FilterServletOutputStream(OutputStream output) {       
              stream = new DataOutputStream(output);
              public void write(int b) throws IOException {       
              stream.write(b);
              public void write(byte[] b) throws IOException {       
              stream.write(b);
              public void write(byte[] b, int off, int len) throws IOException {
              stream.write(b, off, len);
              // test.html
              <html>
              <head>
              <meta http-equiv="Content-Type"
              content="text/html; charset=iso-8859-1">
              <title> Web Posting Information </title>
              </head>
              <body>
              <form name="myform" method="POST" action="resource.jsp">
              <input type="TEXT" name="input"></input>
              <br>
              <input type="SUBMIT" value="done"></input>
              </form>
              </body>
              </html>
              // resource.jsp
              // This gets referenced by the test.html file
              <HTML><BODY>
              <head>
              <title>JRun Programming Techniques</title>
              <meta http-equiv="Content-Type" content="text/html;
              charset=iso-8859-1">
              </head>
              <body>
              <H3>Secure Resource Page</H3>
              <p>This is a secure page.</p>
              <BR><B>User: </B>
              <%
              //     out.write(request.getParameter("input"));
              %>
              </BODY></HTML>
              // HERE IS THE OUTPUT
              // HERE IS WHAT I SEE WHEN I ACCESS
              // http://localhost:7001/TEST/test.html
              **** Wrapper setContentType called ****
              **** Wrapper setContentLength called ****
              ****** getOutputStream() called *******
              The content length is :331
              TEXT RESPONSE, length is 331
              <html>
              <head>
              <meta http-equiv="Content-Type"
              content="text/html; charset=iso-8859-1">
              <title> Web Posting Information </title>
              </head>
              <body>
              <form name="myform" method="POST" action="resource.jsp">
              <input type="TEXT" name="input"></input>
              <br>
              <input type="SUBMIT" value="done"></input>
              </form>
              </body>
              </html>
              // HERE IS WHAT I SEE WHEN I enter some value in the "input" field
              // of the form, and click on the "submit" button.
              // Why isn't setContentLength() getting called on the wrapper?
              // It appears as if the wrapper's output stream isn't getting used
              // at all!!!
              **** Wrapper setContentType called ****
              ****** getWriter() called *******
              ****** getOutputStream() called *******
              The content length is :0
              TEXT RESPONSE, length is 0
              

    If someone else runs into this, here is how I solved the problem -
              If you create a PrintWriter object with the autoflush option, it
              doesn't flush the underlying buffer till you call println on it. I
              looked through the generated code for the servlet, and it was doing a
              JSPWriter.print() to output information.
              So, I changed the ResponseWrapper to keep a handle to the PrintWriter
              object, and then flush it in the filter, and that works.
              Why the same code behaves differently in JRun & Weblogic, I'm not sure
              --Sridhar
              

  • How to use one ResultSet many times in a jsp page ?

    Hi all,
    I have .jsp page and I have used it to get data from DB and display them to users. So I have to get data from DB in number of places in this particular jsp.
    I thought that it is better to have one ResultSet for entire page and once it is done its job, the ResultSet will be closed and I can use it again and again like this.
    Resultset rs = new ResultSet();
    try{
        //My operations
    }catch(Exception ex){
       //Handle Exceptions
    }finally{
       rs.close();
    }After above code snippet I can use same ResultSet again below the page.
    I just want to know this,
    1. is this a good coding practice?
    2. Should i put rs = null; within finally clause?
    any help will be appreciated
    thank in advance,
    Dilan.

    Ok, Finally I switched my coding to use DAO and DTO, and I learned it through internet.
    I removed all of data access codes from my jsp file(lets say 'functions.jsp'). I then created one interface and two clasess.
    here is my DAO interface.
    public interface UserFunctionsDAO{
        public List<UserFunctionsDTO> selectUserList();
    }here is DTO class
    public class UserFunctionsDTO{
        private String category = "";
        private String sub_category = "";
        private int cat_id = 0;
        private int sub_cat_id = 0;
        public UserFunctionsDTO(){}
        public UserFunctionsDTO(String category, String sub_category, int cat_id, int sub_cat_id){
            this.category = category;
            this.sub_category = sub_category;
            this.cat_id = cat_id;
            this.sub_cat_id = sub_cat_id;
        //Setters and getters will go here.
    }my concrete data access class is like this.
    public class UserFunctionsDataAccess implements UserFunctionsDAO{
        MyDB dbObject = null;
       private static final String SQL_GET_DISTINCT_CAT= "SELECT DISTINCT cat FROM cat_table";
       public List<UserFunctionsDTO> selectUserList(){
           dbObject = new MyDB();
           dbObject.sqlSelect(SQL_GET_DISTINCT_CAT);
           ResultSet rs = dbObject.getResultSet();
           ArrayList list = new ArrayList();
           while(rs.next()){
               list.add(new UserFunctionsDTO(rs.getString('category'), .......................));
           return list;     
    }I think now im following good coding practices, but I have one problem.
    1. How do I retrieve this userlist from my jsp page?
    2. Should I include UserFunctionsDTO in my jsp page as a bean?
    3. If I include it, how can I get the list from it?
    thanks in advance,
    Dilan.

  • How to invoke a jsp page from java which does not use Servlets?

    Hello,
    I am working in Documentum. I am trying to invoke a jsp page from another java page which does not use Servlets.
    I tried doing this by just instantiating the java class related to the jsp page from my present java class.In my java class related to the jsp page, I have defined onInit() and onRender() methods.
    Now, I am trying to call the jsp page from my present java class by just instantiating the java class related to the jsp page. This throws a java.lang.NullPointerException.
    Any comments or suggestions on this.Any help would be appreciated.
    Thanks,
    Ranjith M.V

    RanjithM.V wrote:
    Hello,
    Thanks for the reply. One important thing I forgot to mention. I am also using xml component.And?
    As this is the standard way used for coding in Documentum, I do not want to use Beans.Well, JSP's should, in and of themselves, contain no functional code. It should all be only display.
    Without that is it not possible?What did I say? I said,
    masijade wrote:
    It is possible, but I very, very, very, much doubt, that it would be worth the effort.And, if you don't know how, a forum is not truely going to be able to help you implement it (at least not in less than a few years time, at which point it would be outdated).
    >
    Appreciate your understanding and help.
    Thanks,
    Ranjith M.V

  • How to show a JSP Page Multiple Times ??

    Dear Experts,
    Our requirement is like :
    The client chooses to enter the details of 10 customers in the First Jsp page , by selecting 10 in a dropdown list and clicks the Proceed button in the same JSP.
    The Second JSP ie. Customer Details Jsp is popped up and the client enters the details of the first customer. Then he clicks Next Button in that JSP.
    Clicking the Next Button in the Second JSP, will :-
    1>Create a customer object to store the details and add the object to an arraylist ,
    2>Close the current Customer Details JSP and show a new one.
    This will repeat for 10 times and after the last customer details are entered , the Done Button in Customer Details JSP will take the control back to the First Calling Jsp. The First JSP should contain data previously entered.
    How can we implement this logic in JSP ??
    Thanks & Regards
    Saswata Mandal.

    by doing your job. You are a programmer right? So design and develop the code to be able to do this. Don't know how? Then you have some reading to do.
    Hint: you are doing what seems to be some sort of wizard. Whenever I do a wizard type flow, I use a session bean to store the results of all the steps, to validate and store them all in the final step.

  • How can i upload file using ajax post request and jsp

    Hi
    this is my code files
    addPhoto.jsp
    <html>
    <head>
    <title>Add Photo</title>
    <script>
    var optionNo = 0;
    var i=1;
    var val=0;
    var file = 0;
    var exten = new Array(".jpg",".jpeg",".gif");
    function addValues()
         for(var i=0;i<5;i++)
              optionNo += 1;
              oNewOption = new Option();
              oNewOption.text = optionNo;
              oNewOption.value = optionNo;
              addSelect.add(oNewOption);
    function addBoxes()
         var str = "";
         var j=0;
         val = document.getElementById('addSelect').value;
         for(j=1; j<= val; j++)
              str = str + '<font size=3>file:' + j + '</font>';
              str = str + '<input type="file" id=filepath'+ j +' name=file'+ j + ' onchange="uploadFile(hidden'+ j + '.value)"><div id="result'+ j +'"></div>
              str = str + '<input type="hidden" name="hidden' + j + '" value=' + j +'>';
         document.getElementById('addPhoto').innerHTML = str;
    function uploadFile(value)
    var str = "filepath" + value;
    file = value;
    var param = document.getElementById(str).value;
    var parameter = "filepath=" + param;
    alert(parameter.length);
    if(checkValidity(param))
    var url = "uploadFile.jsp";
    if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    req.open("POST", url, true);
    req.setRequestHeader("Content-type", "multipart/form-data");
    //req.setRequestHeader("Content-length", parameter.length);
    req.setRequestHeader("Connection", "close");
    req.onreadystatechange = callback;
    req.send(null);
         else
              document.getElementById("result" + file).innerHTML = "upload .jpeg,.jpg,.gif Files Only";
    function callback() {
    if (req.readyState == 4) {
    updatepage(req.responseText);
    function updatepage(str){
         document.getElementById("result" + file).innerHTML = str;
    function checkValidity(str)
         var i=0;
         var j=0;
         var str1 = str.substring(str.lastIndexOf("."),str.length);
         alert(str1);
         for(i=0;i<exten.length;i++)
         if(str1.search(exten) != -1)
              j++;
              break;
         if(j>0)
              return true;
         else
              return false;
    </script>
    </head>
    <body onload="addValues()">
    <h5>Add Photo(s)</h5>
    <select id="addSelect" name="addSelect" onchange="addBoxes()">
    <option id="select" selected>Select</option>
    </select>
    <div id="addPhoto"></div>
    </body>
    </html>
    uploadFile.jsp
    <%@page import="java.io.*"%>
    <%
    /*try
    String contentType = request.getContentType();
         System.out.println(request.getMethod());
         System.out.println("Content type is :: " +contentType); 
         if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
              DataInputStream in = new DataInputStream(request.getInputStream());
              DataInputStream in1 = in;
              int formDataLength = request.getContentLength();
    System.out.println(formDataLength);
              byte dataBytes[] = new byte[formDataLength];
              int byteRead = 0;
              int totalBytesRead = 0;
              while (totalBytesRead < formDataLength)
                   byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
                   totalBytesRead += byteRead;
              out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
         } catch(Exception e) {
              e.printStackTrace();
         try
         String filePath = request.getParameter("filepath");
         System.out.println(filePath);
         File f= new File(filePath);
         String path = f.getName();
         String contentType = request.getContentType();
         System.out.println(contentType);
         //InputStream in = new FileInputStream(filePath);
         DataInputStream in = new DataInputStream(request.getInputStream());
         int formDataLength = request.getContentLength();
         System.out.println(formDataLength);
    byte[] buf = new byte[1024];
    OutputStream out1 = new FileOutputStream("c:/docs/" + path);
    int len;
    while ((len = in.read(buf)) > 0) {
    out1.write(buf, 0, len);
    in.close();
    out1.close();
         out.write("File Uploaded SucssesFully");
    catch(Exception e)
         e.printStackTrace();
         out.write("error while Writing File");
    %>
    the above code in request.getContentType() i am getting 0. I am not passing the content length. for the same application with out using Ajax i am
    getting the size of file... it is very very urgent for me.. pls help me out on this...
    Any one having the code on this pls mail me the code...
    my mail id ... [email protected]
    Regards
    Ashok Kumar

    Sure, you can upload a file, using a form input element of type file. You pick this up with a servlet, though you need a special request wrapper to sort out the multi-part request you get back that way (there's a suitable package on jakarta.apache.org/commons)
    The servlet decrypts the file and can pass the results to a JSP for display.
    Don't try to do the complicated stuff in a JSP, it all gets incredibly messy, and that's not what JSPs are for.

  • How can i execute some code in a jsp page on the same page ? plz read.

    I have made a single JSP Page where in i want to delete users, create users, update table data.
    I have all the UI on the first page. Now i want to write my all JDBC coding on just this single page. I don't want to create 3 separate pages. Can it be done ?

    This is my page !!
    I have 3 separate pages insert.jsp, delete.jsp, update.jsp to implement the jdbc coding. I know that i can get it done by calling a single jsp page using URL rewriting. But i want to code for events on this very page only.
    <%@page language="java"%>
    <%@page import="java.sql.*"%>
    <HTML>
         <BODY>
              <form method=post action="insert.jsp">
                   Username:<input type=text name=username><br>
                   Password:<input type=password name=password><br>
                   <input type=submit>               
              </form>
              <hr>
              <form method=post action="delete.jsp">
                   Username:<input type=text name=username><br>
                   <input type=submit>               
              </form>
              <hr>
              <form method=post action="update.jsp">
                   Username:<input type=text name=username><br>
                   Password:<input type=password name=password><br>
                   <input type=submit>               
              </form>          
         </BODY>
    </HTML>

  • How to add or remove data from one table to another in � jsp page

    I have two tables on my jsp page.
    On the fist table feed by a data base, u have in the first column radiobutton
    second colum data
    third columm data
    on the second table feed by the data of the first table, u have in the first
    columm checkbox
    second colum data
    this column data
    u have two link, one link to add and another to remove
    1 when u click one of the radiobutton of the fist table following by the click of the link add, u add the line into the second table.
    2 when u click on one or two checkboxes of the second table following by a click on the link remove, u remove the line or lines checked.
    Did somebody could send to me en example of code and give to me solution on way to make it. thank u.

    rather than sending you the whole code, i would like
    to see your code first, how far you implemented the
    code ? and where are you getting problem, asking the
    code like this is not a professional.
    All the Best !******************************************************************************************************************************
    that's what i have implements. U have a bean witch picked data in that the data base, and catch properties .
    i describe to u how work the page.
    when u chose or selected TypeDetoyer, it present to u the first table with all the toyer contains in the typeDeToyer, and presents the second table empty.
    Secondly, u click a radio button to select � toyer of typeDeToyer and by clicking to the link ada, u feed the second table with the toyer selected.
    the seconde table is fill with a checkbox.
    inverse, when u check a check box or many of the second table and clicking on the link remove, u remove the selected lines.
    the aim of all of this is to save in the data base
    the second table, after saving the page is redirect to the modifying form.
    I am waiting for ur answer.
    Coul u send to me how u implements the part beetween the two tables
    Thank s
    <%@ page language="java" import="java.util.*"%>
    <jsp:useBean id="nsimalenBean" scope="session" class="nsimalen.NsimalenBean" />
    <jsp:useBean id="toyerBean" scope="session" class="nsimalen.ToyerBean" />
    <jsp:useBean id="vectorLstTasks" scope="session" class="java.util.Vector" />
    <jsp:useBean id="hashtableToyerSelected" scope="session" class="java.util.Hashtable"/>
    <jsp:useBean id="hashtableRegimeFiscalToyers" scope="session" class="java.util.Hashtable"/>
    <%
    //nsimalen.NsimalenBean nsimalenBean=nsimalenBean();
    ///vectorLstTasks.removeElementAt(i);
    String cVide="";
    String typeOperation;
    String monCodeNsimalen;
    //String monCodeNsimalen=request.getParameter("txtCreateNsimalenFormCode");
    String monNomNsimalen;
    String maVilleNsimalen;
    String monPaysNsimalen;
    String monTypeDetoyerSelected;
    String codeToyerSelected;
    String codeToyerSelectedToAdd;
    String codeToyerSelectedToRemove;
    String currentlibelleTypeDetoyer=cVide;
    String typeAction;
    /// d�finition de variable dont les valeurs seront stock�es dans l'objet de session
    if(request.getParameter("txtCreateNsimalenFormCode")!=null)
    monCodeNsimalen=request.getParameter("txtCreateNsimalenFormCode");
    else
    monCodeNsimalen=cVide;
    if(request.getParameter("txtCreateNsimalenFormNom")!=null)
    monNomNsimalen=request.getParameter("txtCreateNsimalenFormNom");
    else
    monNomNsimalen=cVide;
    if(request.getParameter("txtCreateNsimalenFormVille")!=null)
    maVilleNsimalen=request.getParameter("txtCreateNsimalenFormVille");
    else
    maVilleNsimalen=cVide;
    if(request.getParameter("selCreateNsimalenFormPays")!=null)
    monPaysNsimalen=request.getParameter("selCreateNsimalenFormPays");
    else
    monPaysNsimalen=cVide;
    if(request.getParameter("optCreateNsimalenFormTypeToyer")!=null)
    {monTypeDetoyerSelected=request.getParameter("optCreateNsimalenFormTypeToyer");
    currentlibelleTypeDetoyer=toyerBean.getLibelleTypedeToyer(monTypeDetoyerSelected);
    else
    monTypeDetoyerSelected=cVide;
    if(request.getParameter("radioCreateNsimalenFormCodeToyers")!=null)
    codeToyerSelectedToAdd=request.getParameter("radioCreateNsimalenFormCodeToyers");
    else
    codeToyerSelectedToAdd=cVide;
    if(request.getParameter("radioCreateNsimalenFormCodeToyersRemove")!=null)
    codeToyerSelectedToRemove=request.getParameter("radioCreateNsimalenFormCodeToyersRemove");
    else
    codeToyerSelectedToRemove=cVide;
    if(request.getParameter("typeOperation")!=null)
    typeOperation=request.getParameter("typeOperation");
    else
    typeOperation=cVide;
    if(request.getParameter("typeAction")!=null)
    typeAction=request.getParameter("typeAction");
    else
    typeAction=cVide;
    // Stockage des valeurs dans l'objet
    nsimalenBean.setCodePays(monPaysNsimalen);
    nsimalenBean.setNomNsimalen(monNomNsimalen);
    nsimalenBean.setVilleNsimalen(maVilleNsimalen);
    nsimalenBean.setCodeNsimalen(monCodeNsimalen);
    nsimalenBean.setDateCreation("12/12/2001");
    // if typeOperation=Invalidation
    // nsimalenBean.setDatad'invalidation
    if(typeAction.equals("Save"))
    nsimalenBean.validationCreation();
    Vector validationErrors= nsimalenBean.getChampVide();
    %>
    <body>
    <%
    if (validationErrors!=null && validationErrors.size()!=0 )
    for (int i=0; i<validationErrors.size();i++)
    %>
    <BR> Champs Invalides : <%=(String)validationErrors.elementAt(i)%>; <BR>
    <%
    else
    if (hashtableToyerSelected!=null && hashtableToyerSelected.size()<=10)
    nsimalenBean.insertRowNsimalen();
    nsimalenBean.insertRowsToyersAssocieesNsimalen(hashtableToyerSelected);
    if (hashtableToyerSelected!=null && hashtableToyerSelected.size()>=0)
    %>
    <BR> num Toyers max 10 <BR>
    <%
    if (hashtableToyerSelected!=null && hashtableToyerSelected.size()==0)
    %>
    <BR> vous devez au moins selectionner une toyer pour un nsimalen <BR>
    <%
    %>
    <form method="post" name="CreateNsimalenForm" action="CreateNsimalen.jsp">
              <table cool width="681" height="424" usegridx usegridy showgridx showgridy gridx="16" gridy="16" border="0" cellpadding="0" cellspacing="0">
                   <tr height="16">
                        <td width="16" height="423" rowspan="11"></td>
                        <td width="288" height="16" colspan="3"></td>
                        <td width="376" height="144" colspan="3" rowspan="5"></td>
                        <td width="1" height="16"><spacer type="block" width="1" height="16"></td>
                   </tr>
                   <tr height="32">
                        <td width="100" height="32" valign="top" align="left" xpos="16"><label><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Code :</b></font></label></td>
                        <td width="188" height="32" colspan="2" valign="top" align="left" xpos="116"><input type="text" name="txtCreateNsimalenFormCode" size="24" value='<%=nsimalenBean.getCodeNsimalen()%>'></td>
                        <td width="1" height="32"><spacer type="block" width="1" height="32"></td>
                   </tr>
                   <tr height="32">
                        <td width="100" height="32" valign="top" align="left" xpos="16"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Nom :</b></font></label></td>
                        <td width="188" height="32" colspan="2" valign="top" align="left" xpos="116"><input type="text" name="txtCreateNsimalenFormNom" size="24" value='<%=nsimalenBean.getNomNsimalen()%>'></td>
                        <td width="1" height="32"><spacer type="block" width="1" height="32"></td>
                   </tr>
    <input type="hidden" name="typeOperation" size="24" >
    <input type="hidden" name="typeAction" size="24" >
                   <tr height="32">
                        <td width="100" height="32" valign="top" align="left" xpos="16"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Ville :</b></font></label></td>
                        <td width="188" height="32" colspan="2" valign="top" align="left" xpos="116"><input type="text" name="txtCreateNsimalenFormVille" size="24" value='<%=nsimalenBean.getNomVille()%>'></td>
                        <td width="1" height="32"><spacer type="block" width="1" height="32"></td>
                   </tr>
                   <tr height="32">
                        <td width="100" height="32" valign="top" align="left" xpos="16"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Pays : </b></font></label></td>
                        <td width="188" height="32" colspan="2" valign="top" align="left" xpos="116"><select name="selCreateNsimalenFormPays" size="1">
    <option value="" ><b><font size="2" name="optCreateNsimalenFormPays"></font></b></option>
    <%
    //String cVide="";
    Vector nsimalenLst = new Vector();
    //strNomNsimalen=request.getParameter("txtSearchFormNom").trim();
    nsimalenLst = nsimalenBean.getAllPays();
    // Pour savoir la taille du vecteur
    if(nsimalenLst!=null && nsimalenLst.size()!=0)
    for(int i=0;i< nsimalenLst.size();i++)
    Hashtable myrecord = (Hashtable)nsimalenLst.elementAt(i);
    String monCodePays ="";
    String monLibelle="";
    monCodePays =(String)myrecord.get("NNAM_CODE");
    monLibelle =(String)myrecord.get("NNAM_LIBELLE");
    System.out.println("mon code pays= "+monCodePays+"i="+i+ " mon Libelle Pays="+monLibelle+"nsimalenLst.size() ="+nsimalenLst.size());
    %>
    <option value='<%=monCodePays%>' <%if(monCodePays.equals(monPaysNsimalen))
    out.print("selected");%> ><b><font name="optCreateNsimalenFormPays" size="2"><%=monCodePays%></font></b></option>
                             <%}
    %>
    </select></td>
                        <td width="1" height="32"><spacer type="block" width="1" height="32"></td>
                   </tr>
                   <tr height="16">
                        <td width="664" height="16" colspan="6" valign="top" align="left" xpos="16">
                             <hr width="644" size="2">
                        </td>
                        <td width="1" height="16"><spacer type="block" width="1" height="16"></td>
                   </tr>
                   <tr height="32">
                        <td width="100" height="32" valign="top" align="left" xpos="16"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Type de toyer :</b></font></label></td>
                        <td width="32" height="32"></td>
                        <td width="156" height="32" valign="top" align="left" xpos="148"><select name="optCreateNsimalenFormTypeToyer" size="1" onChange="javascript:document.CreateNsimalenForm.submit();">
    <option value="" ><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"></font></b></option>
    <%
    //String cVide="";
    Vector toyerLst = new Vector();
    //strNomNsimalen=request.getParameter("txtSearchFormNom").trim();
    toyerLst = toyerBean.getAllTypeDeToyers();
    // Pour savoir la taille du vecteur
    if(toyerLst!=null && toyerLst.size()!=0)
    hashtableRegimeFiscalToyers = new Hashtable();
    for(int i=0;i< toyerLst.size();i++)
    Hashtable myrecord = (Hashtable)toyerLst.elementAt(i);
    String monTypeToyer ="";
    String monLibelleToyer="";
    monTypeToyer =(String)myrecord.get("TTOY_CODE");
    monLibelleToyer =(String)myrecord.get("TTOY_LIBELLE");
    // System.out.println("mon code pays= "+monTypeToyer+"i="+i+ " mon Libelle Pays="+monLibelleToyer+"nsimalenLst.size() ="+toyerLst.size());
    %>
    <option value=<%=monTypeToyer%> <%if(monTypeToyer.equals(monTypeDetoyerSelected))
    out.print("selected");%>><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><%=monLibelleToyer%></font></b></option>
                             <%}
    }%>
    </select></td>
                        <td width="376" height="32" colspan="3"></td>
                        <td width="1" height="32"><spacer type="block" width="1" height="32"></td>
                   </tr>
                   <tr height="128">
                        <td width="288" height="128" colspan="3" valign="top" align="left" xpos="16">
                             <%if (!monTypeDetoyerSelected.equals(cVide))
    //String cVide="";
    Vector maTypeToyerDetailList = new Vector();
    //strNomNsimalen=request.getParameter("txtSearchFormNom").trim();
    maTypeToyerDetailList = toyerBean.getToyersDetailsSelected(monTypeDetoyerSelected);
    // Pour savoir la taille du vecteur
    if(maTypeToyerDetailList!=null && maTypeToyerDetailList.size()!=0)
    %>
    <table border="1" cellpadding="0" cellspacing="0" width="224" height="75">
              <tr height="19">
                                       <td height="19" width="20"></td>
                                       <td height="19" width="46"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Toyer</b></font></td>
                                       <td height="19" width="140"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Libell�</b></font></td>
                                  </tr>
    <%
    {  hashtableRegimeFiscalToyers= new Hashtable();
    System.out.println( " je passe dans le premier for");
    for(int i=0;i< maTypeToyerDetailList.size();i++)
    Hashtable myRecord = (Hashtable)maTypeToyerDetailList.elementAt(i);
    System.out.println( " je passe dans le premier for 1");
    String myCodeToyer ="";
    String myLibelleToyer="";
    String myTypeDeToyerCode="";
    myCodeToyer =(String)myRecord.get("TOY_CODE");
    myLibelleToyer =(String)myRecord.get("TOY_LIBELLE");
    // myTypeDeToyerCode=(String)myRecord.get("TTOY_CODE");
    System.out.println( " je passe dans le premier for 2");
    Hashtable hashToyerCaracteristique = new Hashtable();
    hashToyerCaracteristique.put("TOY_LIBELLE",myLibelleToyer);
    hashToyerCaracteristique.put("TTOY_CODE",monTypeDetoyerSelected);
    hashToyerCaracteristique.put("TTOY_LIBELLE",currentlibelleTypeDetoyer);
    hashtableRegimeFiscalToyers.put(myCodeToyer,hashToyerCaracteristique);
    System.out.println( " je passe dans le premier for 3");
    %>
                                  <tr height="19">
                                       <td height="19" width="20" align="center" valign="middle"><input type="radio" value='<%=myCodeToyer%>' name="radioCreateNsimalenFormCodeToyers"></td>
                                       <td height="19" width="46"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b><%=myCodeToyer%></b></font></td>
                                       <td width="140" height="19"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b><%=myLibelleToyer%></b></font></td>
                                  </tr>
    <%
    %>
    <%}%>
    </table>
                        </td>
    <% System.out.println( " je passe dans le premier for 4_1");
    if (hashtableToyerSelected==null)
    hashtableToyerSelected = new Hashtable();
    System.out.println( " je passe dans le premier for 4_2");
    if(hashtableToyerSelected!=null)
    System.out.println( " je passe dans le premier for 4_3");
    %>
    <td width="376" height="128" colspan="3" valign="top" align="left" xpos="304">
                             <table border="1" cellpadding="0" cellspacing="0" width="355" height="117">
                                  <tr height="38">
                                       <td height="38" width="32"></td>
                                       <td width="47" height="38"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Code</b></font></td>
                                       <td height="38" width="112"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Type de toyer</b></font></td>
                                       <td height="38" width="152"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>valeur par d�faut</b></font></td>
                                  </tr>
    <%
    System.out.println( " je passe dans le premier for 3");
    if(!codeToyerSelectedToAdd.equals(cVide) && typeOperation.equals("add"))
    System.out.println( " je passe dans le premier for 3_a");
    Hashtable hashToyerCaracteristique = (Hashtable)hashtableRegimeFiscalToyers.get(codeToyerSelectedToAdd);
    hashtableToyerSelected.put(codeToyerSelectedToAdd,hashToyerCaracteristique);
    System.out.println( " je passe dans le premier for 3_a_fin");
    if(!codeToyerSelectedToRemove.equals(cVide) && typeOperation.equals("remove"))
    System.out.println( " je passe dans le premier for 3_a");
    System.out.println( "remove ");
    System.out.println(codeToyerSelectedToRemove);
    hashtableToyerSelected.remove(codeToyerSelectedToRemove);
    if (hashtableToyerSelected.size()!=0)
    for( Enumeration e=hashtableToyerSelected.keys();e.hasMoreElements();)
    System.out.println("je rentre dans la boucle");
    String codeToyer =(String)e.nextElement();
    Hashtable hashToyerCaracteristique = (Hashtable)hashtableToyerSelected.get(codeToyer);
    String libelleToyer =(String)hashToyerCaracteristique.get("TOY_LIBELLE");
    String libelleTypeToyer =(String)hashToyerCaracteristique.get("TTOY_LIBELLE");
    %>
    <tr height="19">
                                       <td height="19" width="32" align="center" valign="middle"><input type="checkbox" value="<%=codeToyer%>" name="radioCreateNsimalenFormCodeToyersRemove"></td>
                                       <td width="47" height="19"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b><%=codeToyer %></b></font></td>
                                       <td height="19" width="112"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b><%=libelleTypeToyer %></b></font></td>
                                       <td height="19" width="152"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b><%=libelleToyer %></b></font></td>
    </tr>
    <%
    /* if (!codeToyerSelected.equals(cVide) && hashtableToyerSelected==null)
    hashtableToyerSelected = new Hashtable();
    if(hashtableToyerSelected!=null)
    //insertion du code HTml pour afficher l'entete du tableau
    if(operationType.equals("ajout"))
    Hahstable toyersdetails = getToyersDetail(IdToyerSelected);
    hashtableToyerSelected.put( IdToyerSelected, toyersdetails);
    if(operationType.equals("remove"))
    hashtableToyerSelected.remove(IdToyerSelected);
    // avant d'afficher l'entete verifier qu'il ya des elements dans hashtableToyerSelected (
    // hashtableToyerSelected.size!=0
    //Affichage de la hashtable
    for( Enumeration e=hashtableToyerSelected.keys();e.hasMoreElements;)
    String IdToyers =(String)e.nextElement();
    Hashtable ToyersDetails = (Hashtable) hashtableToyerSelected.get(IdToyers);
    string defaultValue = (String)ToyersDetails.get(defaultValue);
    // on fait la mise en page apres avoir recuperer tous les caracteristiques
    %>
                   <!--     <td width="376" height="128" colspan="3" valign="top" align="left" xpos="304">
                             <table border="1" cellpadding="0" cellspacing="0" width="355" height="117">
                                  <tr height="38">
                                       <td height="38" width="32"></td>
                                       <td width="47" height="38"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Code</b></font></td>
                                       <td height="38" width="112"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>Type de toyer</b></font></td>
                                       <td height="38" width="152"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="3"><b>valeur par d&eacute;faut</b></font></td>
                                  </tr>
                                  <tr height="19">
                                       <td height="19" width="32" align="center" valign="middle"><input type="checkbox" value="checkboxValue" name="checkboxName"></td>
                                       <td width="47" height="19"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>J</b></font></td>
                                       <td height="19" width="112"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Sp&eacute;cifique</b></font></td>
                                       <td height="19" width="152"><b><font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2">Nuit</font></b></td>
                                  </tr>
                                  <tr height="19">
                                       <td width="32" align="center" valign="middle" height="19"><input type="checkbox" value="checkboxValue" name="checkboxName"></td>
                                       <td width="47" height="19"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>K</b></font></td>
                                       <td height="19" width="112"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Quantit&eacute;</b></font></td>
                                       <td height="19" width="152"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Kilo</b></font></td>
                                  </tr> -->
                             </table>
                        </td>
                        <td width="1" height="128"><spacer type="block" width="1" height="128"></td>
                   </tr>
                   <tr height="51">
                        <td width="100" height="51" valign="top" align="left" xpos="16"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Add</b></font></label></td>
                        <td width="188" height="51" colspan="2"></td>
                        <td width="224" height="51" valign="top" align="left" xpos="304"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Remove</b></font></label></td>
                        <td width="152" height="51" colspan="2"></td>
                        <td width="1" height="51"><spacer type="block" width="1" height="51"></td>
                   </tr>
                   <tr height="13">
                        <td width="664" height="13" colspan="6" valign="top" align="left" xpos="16">
                             <hr width="644" size="2">
                        </td>
                        <td width="1" height="13"><spacer type="block" width="1" height="13"></td>
                   </tr>
                   <tr height="39">
                        <td width="512" height="39" colspan="4"></td>
                        <td width="80" height="39" valign="top" align="left" xpos="528"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Save</b></font></label></td>
                        <td width="72" height="39" valign="top" align="left" xpos="608"><label><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Fermer</b></font></label></td>
                        <td width="1" height="39"><spacer type="block" width="1" height="39"></td>
                   </tr>
                   <tr height="1" cntrlrow>
                        <td width="16" height="1"><spacer type="block" width="16" height="1"></td>
                        <td width="100" height="1"><spacer type="block" width="100" height="1"></td>
                        <td width="32" height="1"><spacer type="block" width="32" height="1"></td>
                        <td width="156" height="1"><spacer type="block" width="156" height="1"></td>
                        <td width="224" height="1"><spacer type="block" width="224" height="1"></td>
                        <td width="80" height="1"><spacer type="block" width="80" height="1"></td>
                        <td width="72" height="1"><spacer type="block" width="72" height="1"></td>
                        <td width="1" height="1"></td>
                   </tr>
              </table>
              <p></p>
    </form>
    </body>
    </html>

Maybe you are looking for