Html block of code into jsp page.

Is there possible, using JSF and tiles, to include dynamically a block of html code into a jsp file, or tile ?
I've tried to create an html file and to include it in a jsp, but at runtime the contents of the html code is not refreshed.
Any ideas ?
Maybe using a custom component that acts like a div container for the html code ?
Thanks in advance.
Edited by: veveu on Mar 4, 2008 7:18 AM

I thought about including it in an outputText tag but i never tried it because the output text shouldn't be rendered as html code (by definition).
Thank you for your brilliant solution, it works fine now.

Similar Messages

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • Servlet with no dynamic code inside jsp pages

    Hello,
              I saw that a servlet is created even if there is no dynamic code inside jsp pages (scriplets & tags). Is it possible to avoid it on bea side ? (I am using portal 8).
              By the way, do you know if is it possible to define apache in order to avoid to send to bea the jsp which have no dynamic code inside ?
              thank you !

    JSP's always generate a servlet on all web containers. Apache/Tomcat is no
              different. If you have static content, make it an HTML page.
              Bill
              "hournon jc" <[email protected]> wrote in message
              news:22255787.1103297053148.JavaMail.root@jserv5...
              > Hello,
              >
              > I saw that a servlet is created even if there is no dynamic code inside
              jsp pages (scriplets & tags). Is it possible to avoid it on bea side ? (I am
              using portal 8).
              >
              > By the way, do you know if is it possible to define apache in order to
              avoid to send to bea the jsp which have no dynamic code inside ?
              >
              > thank you !
              

  • Displaying html code in JSP page

    Hi.
    How do I display HTML code in an jsp page, so that the actual code is printet on the screen
    fx:
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>

    I can't get my reply to show properly, but the answer is;
    Change < into &lt ; and > into &gt ;
    but with the semi-colons stuck next to the &lt and &gt if you get my drift

  • 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

  • Importing classes into JSP page

    Hi There,
    I am new to this and here is my problem.
    I am doing a shopping cart tutorial and trying to get a JSP page to import two classes :
    <%@ page language="java" contentType="text/html"
    import="ShoppingBasket,Product"
    errorPage="errorpage.jsp" %>
    I get :
    C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\shop_0002dbasket_jsp.java:7: '.' expected
    import ShoppingBasket;
    ^
    C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\shop_0002dbasket_jsp.java:8: '.' expected
    import Product;
    ^
    C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\shop_0002dbasket_jsp.java:50: cannot resolve symbol
    symbol : class ShoppingBasket
    location: class org.apache.jsp.shop_0002dbasket_jsp
    ShoppingBasket basket = null;
    The classes compile ok . I read that instead of comma seperating the classes it might be better to put them in a package but I do not know the correct syntax or where to put the package if this is correct.
    The tutorial is from this book and the shopping cart source code is here.
    http://www.ineasysteps.com/books/?1840781971
    Any help appreciated
    Jim Ascroft

    A little beginners explanation of classpaths and packages is in order here. A package works like an extension of the name to keep class names unique. For example, if you have a ShoppingBasket.class and you want to use my ShoppingBasket.class along with it the two class names must be unique or different from one another in some way. Yours could be in com.yourcompany package and mine could be in org.mycompany package. When you reference you Shopping backet in your code you would use com.yourcompany.ShoppingBasket and when you reference mine in the same code you would use or.mycompany..ShoppingBasket. Shorthand for the class can be used by adding an import at the top of the referencing java file. An import is like saying "hay compiler, whenever you see ShoppingBasket look for it in the com.mycompany package!" That brings us to the next point. The package name must always be reflected in the directory structure of the .class file location in order to be found. Your shopping basket must be stored under the directory com/yourcompany if it is in package com.yourcompany. That directory structure should extend off of a classpath entry in order to be made available to the JVM. Classpath entries point to folders, jar or zip files that contain packaged and unpackaged classes. So If you have a classpath entry that points to C:\jakarta-tomcat-4.1.30\webapps\ROOT\WEB-INF\classes then all unpackaged classes (classes compiled from a .java file without a package statement) will be pulled directly out of this folder. Also, packaged classes will be pulled out of they're packaging directory structure, which should be located in this folder. You can have as many classpath entries as you want but the classes will be pulled out of the first entry that they can be found under. Now with a web app you don't normally fuss with the setting of classpaths since they are already predefined and configured for you. You just need to know to put all of your class files under the WEB-INF/classes directory in the root of your web app. You do, however, still need to know how they work. You also should know that any jar files should be placed in the lib folder of your web app and not under the classes folder.
    Getting back to your immediate problem, why are you getting class not found errors? Well this stems from what was said above. To fix these kind of problems follow these steps:
    1st off, find out exactly which .java file the .class file was compiled from. (This can be a problem in some environments where multiple copies of source hang around.) This step may involve a recompile and paying close attention to the compiler arguments. In an IDE there should be a setting or dialog that lets you find out exactly where it's placing the .class files created from you source.
    Next, determine what package the .class file should be in by examining (and maybe changing) the package statement at the top. For example, if you intended to put ShoppingBasket in the com.bloodoo package make sure it has a package "com.bloodoo;" statement at the top.
    Next recompile the .java source and move the packaging directory structure into the classes folder of your app. (This would be WEB-INF/classes under the root of the web-app.) For example if ShoppingBasket.class was compiled into the com/bloodoo folder under C:\Program Files\YourIDE\projects\yourproject\output then copy the com folder out of the output folder and into the WEB-INF\classes folder.
    Next examine the calling code (JSP or servlet .java code) and make sure it references the problem class out of the right package. For example, yourpage.jsp should reference the class com.bloodoo.ShoppingBasket and not ShoppingBasket if the shopping basket is deployed in package com/bloodoo. This gets tricky with jsp usebean tags because the desire is to use shorthand but I'm not sure if that works with the use bean tag. Make any modifications and recompile if necessary.
    Lastly, as a rule of thumb avoid wild-card imports (eg. import com.package.*) because they are a common cause of confusion especially when refactoring package names and resolving these kind of issues.Those steps should allow you to resolve 85-90% of your class not found issues. The other 10-15% are rare cases involving the use of custom classloaders, the Java extension mechanism and/or classpath trickery. If you still have questions/problems post back.
    Cliff

  • Integrate flash component into JSP page

    Hi,
    I need to integrate a flash component into my JSP page. flash component is used to put signature via mouse drag. the signature that is put should be captured and stored in DB. can anyone help me how to do it. Thanks in advance...

    I thought about including it in an outputText tag but i never tried it because the output text shouldn't be rendered as html code (by definition).
    Thank you for your brilliant solution, it works fine now.

  • Reading from HTML Drop-Down Menu into JSP

    Hi folks. I'm am just delving into JSP, and I have a very basic question. I've been looking around the internet for a good tutorial on how to read HTML form input data into my JSP page. I really haven't found anything, and was hoping that you could provide me with some good resources. I want to have just a basic HTML drop-down menu with a SQL query executed based on the menu selection. The selection from the drop-down menu should go into the SQL query where "Shawnee" currently is. Here is my JSP code:
    <%@ page contentType="text/html;charset=windows-1252" import="java.sql.*"%>
    <%     
    try
         Class.forName("net.sourceforge.jtds.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://khrcs4:1433/Mail_List;user=xxxx;password=xxxx");
           System.out.println("success");
           Statement st = con.createStatement();
           ResultSet rs = st.executeQuery("select * from contacts where class like '%First Time Home Buyer Lenders%' and served like '%Shawnee%' order by company");
           while(rs.next())
              out.println(rs.getString(3)+"<br>"); //company
              out.println(rs.getString(12)+"<br>"); //address
              //out.println(rs.getString(13)+"<br>"); //address2
              out.println(rs.getString(8)+", "+rs.getString(9)+" "+rs.getString(14)+"<br>"); //city, state zip
              out.println(rs.getString(7)+"<br><br>"); //phone
    catch (Exception ex)
         ex.printStackTrace();
    %>

    ArrayList recList = new ArrayList();
    while(rs.next())
         recList.add(rs.getString(3));
    put the recList in the session.
    session.setAttribute("allrecords",recList);
    Then in your jsp, get the recList from the session and loop it,
    ArrayList recList = (ArrayList)session.getAttribute("allrecords");
    for (var i=0; i < recList.size();++i){
         addOption(document.getElementById("drop-down box name"), valarray, valarray[i]);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = trim(text);
         optn.value = trim(value);
         selectbox.options.add(optn);

  • Importing avi files into jsp pages

    hello all. im new to jsp and java. i would like to know how i could import .avi files from my MySQL database (where ive given paths for the avi files) into a jsp page. i am basically trying to make an application that allows users to select particular video files and play them. the user has the ability to upload and delete these videos

    newbie4337 wrote:
    im sorry i guess i didn't phrase that properly. i meant to say that i had saved the paths in the database If you have some saved URLs in the database (URLs to where these avi files can be found)
    you just need to retrieve the URLs and use them when generating links (<a href="..."></a>) in the html produced by your JSP.
    You have already given the paths in the html generated by your jsp? Paths as in URLs?
    Then you must already have a servlet deployed that accepts HTTP requests for .avi URLs and reads the relevant .avi from the database and serves back an avi stream with the right mime type (video/x-msvideo) in the headers...
    ([w3schools|http://www.w3schools.com/media/media_mimeref.asp]).
    could you give me some more info on that?If the URLs are hosted somewhere else you do not need any of this.

  • Calling Java code inside JSP page and sending toString on object to Servlet

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

  • How Can I Add Pivot Tables of Excel Into JSP Pages

    Hello all,
    Basing upon a query to database, i wanted to add a Microsoft Excel pivot table functionality in JSP page [with the result of query].
    Is it possible to create a Pivot Table in JSP with dynamic data from database ??
    Can any body help me in solving this issue ???
    Thanks & Regards
    Krishna

    There are a few alternatives to doing this (depending on the clients you are serving this page up for).
    Going the pure HTML
    There is an open source project called JPivot which provides an HTML front end for Pivot Table (using tag libraries)
    Going the Microsoft Office route there are a few options:
    1) POI HSSF ( http://jakarta.apache.org/poi/index.html) allows you to "update" an existing Pivot table by replacing data values contained in a template pivot table.
    2) Use the open source XELEM api (xelem.sourceforge.net) which produces SpreadsheetML (Micorsofts current XML file Format). At present, I don't believe this handles creating a pivot table from scratch (you have to manually create the Pivot Table template, read in the template (with XELEM) and update the data values in the template before writing it out. (the same holds true for POI)
    3) Commercially the company I work for (www.workbeans.com) is writing a pure Java Pivot Table API that will allow you to create a Pivot Table in the Excel SpreadsheetML file format from scratch. (supported by Office 2000, XP and 2003). The Pivot table functionality isn't slated until a future release (Oct. 2005), so if you can wait until then we could help you further.
    Best,
    Eric
    M. Eric DeFazio
    Application Architect, workbeans
    [email protected]

  • File Chooser into JSP pages

    Hello, i would like to allow the user of one of my JSP page to choose a file on his computer, as doing attachment. Is it possible?? Do you see some better way to do that??
    Thanks

    Yes, it's possible. But you can't use a FileChooser, that's a Java class. You need an HTML solution, and there is one. You use a form with enctype="multipart/form-data" and an input box with type="file". Do you use Internet e-mail like Hotmail? If you do, then look at the HTML they use when you send a mail with attachments.

  • Help!!! What's wrong with this code. JSP page can't retrieve properties.

    I'v got a piece of code that was created to send some parameters to JSP page via POST method. But in server page I can't retrieve this parameters, please help me and try to find "main" bug in this code.
    try {
    URL url = new URL("http://localhost/index.jsp");
    HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
    httpCon.setRequestMethod( "POST" );
    httpCon.setDoOutput( true );
    String body = URLEncoder.encode("name=Oleg", "UTF-8");
    httpCon.setRequestProperty( "Content-length", Integer.toString( outBody.length() ));
    httpCon.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    ow.close();
    } catch (....) {
    }

    Hi
    You must not encode all the body just the values of the parameters.
    You can do as following in order to send a post request with 2 parameters
    String param1 = "Co & sons";
    String param2 = "ltd.";
    String encParam1 = URLEncoder.encode(param1,"UTF-8");
    String encParam2 = URLEncoder.encode(param2,"UTF-8");
    String body = "param1="+encParam1+"&param2="+encParam2;
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    //read the response from the jsp
    InputStream inS = httpCon.getInputStream();
    byte[] buff = new byte[5000];
    StringBuffer sbuff = new StringBuffer();
    int nrBytes ;
    while( (nrBytes = inS.read(buff, 0, 5000))!=-1) {
      sbuff.append(new String(buff,0,nrBytes));
    inS.close();
    ow.close();
    ...This is the jsp page which gets the parameters
    <%
         String param1 = request.getParameter("param1");
         param1 = new String(param1.getBytes(),"utf-8");
         String param2 = request.getParameter("param2");
         param2 = new String(param2.getBytes(),"utf-8");
    %>I hope I helped you.
    Regards,
    BG

  • Importing java classes into jsp page

    I'm trying to import java classes inside my jsp page, while doing that i am getting compilation error "package uma.natarajan.javaclasses" not found. I don't know where to copy the java files. i'm keeping my jsp files under public_html folder
              

    Hi uma,
              create uma\natarajan\javaclasses under weblogic_home\myserver and copy java
              classes(u want to import) to uma\natarajan\javaclasses and then u try.
              Concept is the java classes u import should be present in a classpath. Hope
              this may help u,
              Arun,
              [email protected]
              "uma natarajan" <[email protected]> wrote in message
              news:3a490bcb$[email protected]..
              > I'm trying to import java classes inside my jsp page, while doing that i
              am getting compilation error "package uma.natarajan.javaclasses" not found.
              I don't know where to copy the java files. i'm keeping my jsp files under
              public_html folder
              

  • Html select change to make JSP page forward keeping the exsting field value

    Hello, All,
    I am trying to make the change of a selection box in HTML form to reload the page and populate the second selection box based on the value in the first selection box. The content of the second selection box is from database....
    i used a javascript funtion and called it by the onChange(), the onChange redirect the page to the same page. However all my previous input is lost and the second selection box is not populated based on the first selection box.
    The question is how do I keep the current input and reload the page based on the change of a selection box?
    Please help..
    Thanks..
    Here is the code
    <script language=javascript type="text/javascript">
    function forward(){
    location.href="trdCapDetail.jsp";
    </script>
    <select name=vehicle onChange="forward()">
    <%for(int i = 0; i < Vehicle.getAll().size(); i++){
         Vehicle vehicle = (Vehicle)(Vehicle.getAll().elementAt(i));     
         out.write("<option value=" + vehicle.getKey()+" >" + vehicle.getCode() + "</option>");
    %>

    Ok two things.
    1 - you need to submit the value which was selected.
    2 - you need to repopulate the select box with it.
    1 - you need to submit the value which was selected.
    You do this by either appending the parameter to the url, or calling form.submit().
    <script language=javascript type="text/javascript">
    // either set parameter on url manually
    function forward(control){
    var param = control.value;
    location.href="trdCapDetail.jsp?vehicle=" + param;
    // or submit the form:
    function forward(control){
      control.form.submit();
    <% pageContext.setAttribute("vehicles", Vehicle.getAll() ) ; %>
    <form name="myForm" action="trdCapDetail.jsp"> 
      <select name="vehicle" onchange="forward(this)">
          <c:forEach var="vehicle" items="${vehicles}">
            <option value="<c:out value="${vehicle.key}"/>"> <c:out value="${vehicle.code}"/> </option>
          </c:forEach>
       </select>   
    </form>2: populating the control
    One way is to use javascript again:
    <c:if test="${not empty param.vehicle}">
      <script language="javascript">
        document.myForm.vehicle.value = "<c:out value="${param.vehicle}"/>";
      </script>
      </c:if>
    // or scriptlet code if you must
    <%
    String selectedVehicle = request.getParameter("vehicle");
    if (selectedVehicle != null){  %>
      <script language="javascript">
        document.myForm.vehicle.value = "<%= selectedVehicle%>";
      </script>
    <%
    %>The other way to keep the current input is to generate the string "selected" inside the option tag for the selected item. In your loop, check if the current id equals the submitted id, and print "selected" if it is.
    Hope this helps,
    evnafets

Maybe you are looking for

  • Multiple Apple IDs on one iTunes??

    I bought my husband an iPod Shuffle for running. He has never had an Apple product before so he does not have an Apple ID. Can I create an Apple ID for him and ADD it to my existing iTunes account (which already has an iPod, iPhone and iPad)? Or do I

  • I can't upload dokuments to icloud?

    I have numbers on my Mac and my Iphone 4. I cannot upload my documents into the cloud. At first when I downloaded the app it works but now no more. I switched "use Ioud" in all phones an macs. Can it happened while the update to IOs 5. 01?

  • Can we enable licensing facility for our customized forms and report...?

    He All, We have a product and we frequently used to send customized forms and reports to our customers through the shipment team after QC certified. But some of the customized forms and reports have sent to the customers without their knowledge from

  • Oracle 10.2 Loadjava for SQLJ says "..uses or overrides deprecated API"

    I just upgraded to 10.2 from 8.1.7 (platform is AIX 5L) and sqlj program was INVALID after upgrade.Running loadjava on the program seems successfull, and java class is VALID, but also get: Note: MQBridge uses or overrides a deprecated API.          

  • How to "downsize" pix in the iPhoto Library?

    Background: I provided my grandmother with a MacMini (still PowerPC version, 40GB only; ca. 2002?) for email, iPhotos and Skype; it is hooked up to her TV set.   The pictures we take are often of 1 or 2 or more MB each, hence would "fill" her MacMini