Populate combo in jsp without javascript?

hai all,
can u tell me how can i populate combo in jsp, is it possible without javascript?

Quite easily, in pseudo code <%
     List myList = (List)session.getAttribute("theList");
%><select name="myOptions"><%     
     for (items in the list)
          %><option value="<%= item.value %>"><%= item.label %></option><%
%>
     </select>

Similar Messages

  • Passing javascript values to jsp without refreshing the page

    Hi,
    How do u pass a value of a javascript variable to the jsp without refreshing the page ?
    For example, a file called test.jsp in which a javascript variable x contains value 254. I need to pass the value of x to a method declared in test.jsp(same page).

    Hi Mona,
    when i say refresh i do mean a blink of the browser.
    This is a small example i wrote to show you how you can pass javascript varables to JSP variables. If you don't want the refresh to be seen by the user just include this code in a hidden frame on a page and instead of refreshing the entire page, refresh the hidden frame.
    i have to say, i didn't test the code so i don't guarantee it's flawless.
    if you need an more detailed example just tell me, i'll create one, but it won't be for today :)
    <html>
    <head>
         <title>Log in to the system</title>
    </head>
    <body>
    <script>
    //we retrieve the parameter 'user' from the URL
    <%
      String username = request.getParameter("user");
    %>
    var user = "<%= username%>";
    //check if there is a username in the URL
    if(user=="null")
      //there is no username so we log the person in as a guest
      user="guest";
      //we refresh the page and set the user parameter to 'guest'
      //the parameter now contains the javascript variable 'user'.
      //The parameter can be read by the JSP (see the top op this script).
      //This way we gave the javascript variabele to the JSP variable
      location="login.jsp?user="+user;
    else if(user=="guest")
    {  alert("Welcome "+user+", I hope you like this site"); }
    else
    {  alert("Welcome "+user+", I'm glad to see you again"); }
    </script>
    </body>
    </html>

  • Displaying a wait page without javascript/ meta refresh

    I am using JSPs with struts 1. I wanna show a wait page after submitting the form until it process.
    But in my case i wanna do it without javascripts or meta refreshes. any idea?

    ruwanin84 wrote:
    As far as I know, meta -refresh is not that much recommended.Please elaborate and prove. This makes really no sense to me.
    any way that's my last option. do you have any idea of checking the token?That's just a toggle in the request/session on which the server side code can intercept. This still require a request being invoked by the client.

  • How to call a class file in a jsp without deploying anything in j2ee

    Hi,
    I am new in J2EE. I have some jsps, which I configured using web.properties(documentroot=c:/jsp/). I am able to get
    those pages by the web browser. I have some import statements in some jsps, now I
    am trying to access those page but it is failing, it says
    org.apache.jasper.JasperException: Unable to compile class for
    JSPD:\j2sdkee1.3\repository\pradip\web\_0002fLogin_0002ejspLogin_jsp_0.java:1:
    Class com.gui.UPMGuiGlobalConstants not found in import.
    import com.gui.UPMGuiGlobalConstants;
    Actually I have not deployed any class file or jsps.. Now my question is can I access
    these jsps without deploying anything, like can I put my .jar file in any j2ee
    directory(like lib or anywhere else, I already tried after putting in /lib) and restart the
    j2ee and use it. So how can I call a class file from a jsp without any kind of
    deployment?
    Please send me the reply as soon as possible.
    Regds,
    Pradip

    After you put the jar containing the class to import into the WEB-INF/lib directory, you still need to include it in the jsp.
    Putting the jar into the lib dir, will make it available to the vm, but as in any other java class, you still need to import it into the class, that the jsp will be compiled into.
    And you do that by putting
    <%@page import="com.gui.UPMGuiGlobalConstants" %>somewhere near the top of your jsp. (well you don't need to put it there, but it good style ;)
    That should do it.

  • How can I add more than one submit button in a jsp without use of javascrip

    I want to add more than one submit button in a jsp without use of javascript

    you can do add multiple submit button with this way
    <input type="submit" value="Previous" />
    <input type="submit" value="Next" />
    <input type="submit" value="Finish" />

  • Get site id in WCS jsp without using ics.SQL

    Hi,
    Is there a way i can get siteId of my current site in JSP without using ics.SQL tags and getting it from publication table
    We are trying to implemet a lucene search for loading assets present in current site only.
    Thanks in advance for your help.

    Use the below code to get it.
    <publication:load name="thisPub" field="name" value='<%=ics.GetVar("site") %>'/>
    <publication:get name="thisPub" field="id" output="thisPubID"/>
    Dont forget to import publication.tld
    Regards,
    Ravi G

  • How to execute a .exe file in java(Jsp) without using a process ???

    Hi All ,
    How to execute a .exe file in Jsp without using a process ??? ...
    Is it Possiable ????

    itsdhanasaraa wrote:
    But as this a web application ... By using Runtime i'm getting some probs ..
    Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
    Ain't gonna happen.
    its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
    1) it's not "taking more time to execute", whatever that's supposed to mean.
    2) there's no other way to execute something. Not that you should every use even that way anyway
    3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place.

  • Automatically populate fields in jsp documents based on other fields

    hello guys. I have a jsp document
    that has the following
    <af:inputText value="#{bindings.SourceDocumentId.inputValue}"
    label="#{bindings.SourceDocumentId.label}"
    required="#{bindings.SourceDocumentId.mandatory}"
    columns="#{bindings.SourceDocumentId.displayWidth}"
    binding="#{backing_transactions_editTransactions.docId}"
    id="docId">
    <af:validator binding="#{bindings.SourceDocumentId.validator}"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.SourceDocumentId.format}"/>
    </af:inputText>
    <af:inputText value="#{bindings.DocumentName.inputValue}"
    label="#{bindings.DocumentName.label}"
    required="#{bindings.DocumentName.mandatory}"
    columns="#{bindings.DocumentName.displayWidth}"
    binding="#{backing_transactions_editTransactions.docName}"
    id="docName">
    <af:validator binding="#{bindings.DocumentName.validator}"/>
    </af:inputText>
    And I have created the generated the backing beans automatically.
    public class EditTransactions {
    private CoreInputText docId;
    private CoreInputText docName;
    public CoreInputText getDocId() {
    return docId;
    public void setDocName(CoreInputText inputText7) {
    this.docName = inputText7;
    public CoreInputText getDocName() {
    return docName;
    I have a method in appmodule that has this
    public String getDocName(Number docId)
    {String docName;
    return docName
    on the document Id field I have to input a certain docId after I input the docId I have to populate automatically the docName based on the doc Id being given.
    question
    1. how can I set the document name automatically w/out submitting the page ?
    2. how can I use my backing bean to set the docName using the method in my AppModule.?
    Can anyone help me regarding this one.
    Thank in advance
    alvin.

A: automatically populate fields in jsp documents based on other fields

here is what you need to do:
1. Change the definitions for your fields as following
<af:inputText value="#{bindings.SourceDocumentId.inputValue}"
                        label="#{bindings.SourceDocumentId.label}"
                        required="#{bindings.SourceDocumentId.mandatory}"
                        columns="#{bindings.SourceDocumentId.displayWidth}"
                        binding="#{backing_transactions_editTransactions.docId}"
                        id="docId" valueChangeListener="#{backing_transactions_editTransactions.docIdChange}"
autoSubmit="true">
            <af:validator binding="#{bindings.SourceDocumentId.validator}"/>
            <f:convertNumber groupingUsed="false"
                             pattern="#{bindings.SourceDocumentId.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.DocumentName.inputValue}"
                        label="#{bindings.DocumentName.label}"
                        required="#{bindings.DocumentName.mandatory}"
                        columns="#{bindings.DocumentName.displayWidth}"
                        binding="#{backing_transactions_editTransactions.docName}"
                        id="docName"
partialTriggers="docId">
            <af:validator binding="#{bindings.DocumentName.validator}"/>
          </af:inputText>2. add the followig method to your backing bean:
  public void docIdChange(ValueChangeEvent valueChangeEvent) {
    getDocName().setValue((String)getDocId().getValue() + "suffix");
  }Run your form and enter the value into docId field, then press tab to go to the next field - docName will be populated

here is what you need to do:
1. Change the definitions for your fields as following
<af:inputText value="#{bindings.SourceDocumentId.inputValue}"
                        label="#{bindings.SourceDocumentId.label}"
                        required="#{bindings.SourceDocumentId.mandatory}"
                        columns="#{bindings.SourceDocumentId.displayWidth}"
                        binding="#{backing_transactions_editTransactions.docId}"
                        id="docId" valueChangeListener="#{backing_transactions_editTransactions.docIdChange}"
autoSubmit="true">
            <af:validator binding="#{bindings.SourceDocumentId.validator}"/>
            <f:convertNumber groupingUsed="false"
                             pattern="#{bindings.SourceDocumentId.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.DocumentName.inputValue}"
                        label="#{bindings.DocumentName.label}"
                        required="#{bindings.DocumentName.mandatory}"
                        columns="#{bindings.DocumentName.displayWidth}"
                        binding="#{backing_transactions_editTransactions.docName}"
                        id="docName"
partialTriggers="docId">
            <af:validator binding="#{bindings.DocumentName.validator}"/>
          </af:inputText>2. add the followig method to your backing bean:
  public void docIdChange(ValueChangeEvent valueChangeEvent) {
    getDocName().setValue((String)getDocId().getValue() + "suffix");
  }Run your form and enter the value into docId field, then press tab to go to the next field - docName will be populated

  • Set jsp from javascript

    I have three "div" tags in index.jsp ,
    <div id='header'></div>
    <div id='body'></div>
    <div id='footer'></div>
    Now when window is loaded i want other jsp page to be set in the "body" div tag of index.jsp from javascript
    My javascript code
    function invokeJSP(){
    document.getElementById('body').innerHTML="<jsp:include page='test.jsp'>'";
    when I am including this code in <head > part of index.jsp its working the problem is if at all
    In test.jsp
    if i try to include this line
    <% = request.getParameter("name")%>
    its giving an error like "unterminated literal string" in javascript console
    Can anyone help me how to set the jsp from javascript
    Sorry for my bad english.This is the first time I am posting the forum
    thanks
    hema

    hi
    Thanks for the response
    but i have closed the tag in my program. Have u ever tried to invoke jsp from javascript in this way if it works plz help me.
    thanks hema

  • How to embed Flash without Javascript?

    How to embed Flash without Javascript? Other way to ask this: if user desactivates Javascript, sill Flash content still be visible?
    Thanks for helping.

    Hi
    This article may be of interest (shows with and without javascript methods), - http://perishablepress.com/press/2007/04/17/embed-flash-or-die-trying/.
    PZ

  • Jsp in javascript

    hi
    can we use jsp in javascript
    for eg:
    <script>
    if(flag)
    <% respone.sendRedirect("--"); %>
    </script>
    or is there any other way of doing this type of things
    this is only an example.
    thx
    -jay

    You can use JavaScript in a JSP. JavaScript usually runs on client. You can also use Java in a JSP. Here is sample code:
    <%@ page import="java.util.*" %>
    <%
    Calendar cal = Calendar.getInstance();
         int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
         int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
         int minuteOfHour = cal.get(Calendar.MINUTE);
         if (((dayOfWeek == 7) & (hourOfDay == 23) & (minuteOfHour > 29)) || ((dayOfWeek == 1) & (hourOfDay == 0) & (minuteOfHour < 31))) { %>  
    <jsp:forward page="file:///M:/Studio/projects/som/html/IC_0019.htm" />
    <% } %>

  • Userexit for populate profit center entry without material in T.code CORO.

    Hi guru's
    we are running T.code. CORO.. we want to populate profit center entry without material. can any one tell me the exact user-exit used for this and . can you tell me the procedure how to find the specific userexit trigger at that point while we are running any T.code.
    Thanks in Advance..
    GSANA
    user exist in PP for transaction code CORO-process order without matl code to populate profit center entry, can u plz find out that & send it to me..

    Thank you all for your valuable input.
    Srinivasa, your suggestion is very good, especially when calculation of variances/WIP is required. But again as there is no cost relevant material where the WIP/Variances will be settled during settlement process?
    1) PP need to create process order without material because changeover cost should not be charged to either material and capacity hours are consumed during changeover. 2) CO need to identify the cost of changeover which should be charged to cost center. So far we have achieved both of these two objectives by the following activities:
    Creation of Process Order without material using CORO T.Code     say 3 hours of changeover occurred we create order with quantity of 3 Hours. And confirmation of activities quantity 3 using COR6N so cost center is credited by 3 x rate per hour. As there is a separate Process Order type for Changeover we can identify changeover quantity and cost in a given period.
    After contributors feedback in this thread I have come to conclusion that I don't need to assign Settlement Profile and PA Structure to Changeover Process Order type. So no need to run Process Order settlement. As there is no specific required for Changeover WIP/Variances as well.

  • How do I update JSPs without having to restart WebLogic?

    How do I update JSPs without having to restart WebLogic? I have tried setting pageCheckSeconds to 0 in my weblogic.xml file. I have also tried setting Reload Period to 0 in the console. Please advise.
              

              Just bring up the Weblogic Console. Drill down to your webapp. De-select the Deploy
              option. Click on apply. Select the Deploy option and Click apply. Basically, Un-deploy
              and re-deploy your webapp.
              Later...
              - Wayne
              "cleve" <[email protected]> wrote:
              >which is here:
              >
              >http://e-docs.bea.com/wls/docs61////javadocs/weblogic/management/tools/WebAp
              >pComponentRefreshTool.html
              >
              >"Michael Young" <[email protected]> wrote in message
              >news:[email protected]..
              >> Try using the weblogic.refresh tool.
              >>
              >> regards,
              >> Michael
              >>
              >> Tony Nguyen wrote:
              >>
              >> > How do I update JSPs without having to restart WebLogic? I have tried
              >setting pageCheckSeconds to 0 in my weblogic.xml file. I have also tried
              >setting Reload Period to 0 in the console. Please advise.
              >>
              >> --
              >> Michael Young
              >> Developer Relations Engineer
              >> BEA Support
              >>
              >>
              >
              >
              

  • Use classes in JSP without jsp:useBean

    hi
    i want to instantiate my own classes within a jsp.
    the classes are in web-inf/classes/chat/
    there is one main class which is used all over the app, so i use it with the jsp:useBean and scope on application.
    The messages are saved in objects of the class Message. now i want to use this class in my JSP without useBean.
    Is this possible without extra setting the classpath?!
    I get the error because the interpreter searchs in a package from tomcat itself..
    Thanks a lot and rgds
    Ruven

    I think you can use any class in your jsp file without the <jsp:useBean>, this implies that you have to declare your class in the ordinary way i.e
    <% MyClass c = new MyClass() ;
    //other code
    %>
    the important thing is to use the page directive's import attribute i.e include this line in your jsp page
    <%@ page import="mypackage.inner.MyClass" %> the web containers when sees this line will assume that you have the following directory structure in your web application ( /mywebapps/web-inf/classes/mypackage.inner/* )
    I hope this helps
    Regards

  • JSP language javascript

    What is the problem?
    <%@ page language="javascript" %>
    <%
    var i;
    for ( i=1; i<5; i++ )
    out.println("JSP whit JavaScript <br>");
    %>

    What is the problem?
    <%@ page language="javascript" %>
    <%
    var i;
    for ( i=1; i<5; i++ )
    out.println("JSP whit JavaScript <br>");
    %>The <% and %> tags indicate a Java scriptlet.
    "var" is JavaScript syntax, the rest is Java.
    out.println is a Java method.
    If you want to do your loop in JavaScript then it would
    be like this:
    <script>
    for ( var i = 1; i < 5; i++ )
    document.writeln("JSP whit JavaScript <br>");
    </script>

  • Maybe you are looking for