URL pass to JSP

I am having problems with the following.
From a JSP page I call a seperate program to lookup a vendor number. This number is then placed into a URL string. Can the value placed in a URL string be passed back to the JSP without having to refresh or recall the JSP? if so is there any example code on how to perform this action.
thanks

From a JSP page I call a seperate program to lookup a vendor number..
I am assuming that this program is a bean class.
What you are saying can easily be done by using a bean.
In your JSP,
1. instantiate the bean
<jsp:useBean id ="myBean" class=<class_name>"/>
In the constructor of the bean put the code that looks up the vendor number and sets a property say vendorNumber to this number. Define a getter method getVendorNumber() to access this property.
2. Then in your JSP you can access this number/url from:
<jsp:getProperty name="myBean" property="vendorNumber"/>
Hope this helps. If you explain your program in more detail with code then I may be able to help more.

Similar Messages

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • How do I get the URL of a jsp page?

    I have a jsp page which has a link to a servlet page, in the servlet page, I want to get the URL of the jsp page.
    I tried to use request.getHeader("referer"), it seems like if it is a link in the jsp directly lead to the servlet, it works, but if the link calls a javascript function which opens up a window runing the servlet, it is not working. I have to do the second way, so it is not working by doing request.getHeader("referer")
    I tried to use javascript "location.href", I get the whole url by alerting the url in the jsp page:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal&bcd=ABC123&pnm=P1001830&prnm=1&psd=236863.0&ln=01&sln=NYPPA&stp=2.1&stt=A&_POSID=1F8464122ADAF4EEC9B1A94C286EB252
    then I pass this url when calling with my servlet, in the servlet page, when I do request.getParameter("url"), the url is actually cut off like this:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal
    anything after &pnm is cut off, anyone has any idea?
    Thanks in advance.

    Thank you.
    but how do I put encoding in the javascript code? do I need to decode in my servlet page?
    here is my code in the jsp page:
    linkset[3]+='<div class="menuitems">Email Diagnostics to AutoOne</div>'<%     
    function emailDiagnostics()
    win = window.open("/pos-webapp/serv/email_diagnostics?url=" + location.href + "&browser=" + navigator.appName, "emailDiagnostics",
    "width=350, height=140, resizable=no, scrollbars=no, toolbar=no, location=yes, directories=no, status=no, menubar=no, copyhistory=no, left=450, top=300");
    win.focus();
    }

  • Howto pass dynamic jsp:param value to applet

    Hi.
    I have a JSP page with 3 to 4 links... and an applet with jsp:plugin .
    So i want to pass the URL behind the link to the applet as a Request Param..
    My JSP code looks like
    <a link href="www.google.com">Google</a>
    <a link href="www.oracle.com">Oracle</a>
    <a link href="www.gmail.com">Gmail</a>
    <jsp:plugin type="applet"
                                code="MyApplet"
                                height="0" codebase="../../jars/" width="0"
                                name="MyApplet"
                                align="bottom">
                            <jsp:params>
                                    <jsp:param name="applicationURL"
                                               value="this should be the "/>
                            </jsp:params>
                            <jsp:fallback>
                                    <p>This feature should run on applet supported
                                       browser.</p>
                            </jsp:fallback>
                    </jsp:plugin>and my applet code looks like
    init()
              String appURL = getParameter("applicationURL");
                    System.out.println(appURL);
              }I have a similar thread in Java forums... Howto pass dynamic jsp:param value to applet
    Thanks,
    Murali.

    My JSP code looks like
    <jsp:plugin type="applet"
                                code="MyApplet"
                                height="0" codebase="../../jars/" width="0"
                                name="MyApplet"
                                align="bottom">
                            <jsp:params>
                                    <jsp:param name="applicationURL"
                                               value="applicationURL"/>
                            </jsp:params>
                            <jsp:fallback>
                                    <p>This feature should run on applet supported
                                       browser.</p>
                            </jsp:fallback>
                    </jsp:plugin>and my applet code looks like
    init()
              String appURL = getParameter("applicationURL");
                    System.out.println(appURL);
              }Now i want to have links on JSP pages clicking on which corresponsing url will be displayed in applet.
    Edited by: 635237 on Jan 24, 2011 10:44 AM
    Edited by: 635237 on Jan 24, 2011 10:45 AM

  • Hi, how to use URL encoding in jsp

    hi, how to apply URL encoding in jsp for a string, could u pls suggest some ideas to use URL encoding in jsp
    thank you in advance

    hi, thnx for the reply, but my problem is to use url encoding method
    i would u like to know how to represent in jsp program i have asp code some thing like this
    href='/project/tel_number.asp?team=<%=DbRecTeam("id")%>&name=<%=Server.URLEncode(DbRec("name"))%>'
    i would like to know how replace that Server.URLEncode stmt in jsp, could u pls suggest some equivalent method for the above stmt
    thanx in advance

  • Please suggest the URL to display JSP report

    Hi Experts,
    Last week, we tried to change the memory of Response Cache and buffer Cache to increase the speed of the Excel report. But it didn’t work out.
    And from the below link, I understood we can convert the oracle 9i report to excel by converting the Oracle 9i report to JSP report.
    http://www.oracle.com/technology/products/reports/htdocs/getstart/demonstrations/index.html
    I’ve converted the Oracle 9i report to JSP report and finding the way to display the JSP report using Application Server. I am trying to find out the REPORT URL of simple JSP report and using Reports Servlet . Right now I am trying the below steps to display the JSP report in Application Server.
    Please suggest the URL for displaying the JSP report
    Thanks & Regards

    Please explain how any of this relates to the topic of this forum: "Database Upgrade."
    If you repost your question in the correct forum, or perhaps with the correct company, will be more likely to find the help you need. For example ... what App Server (make and model).
    Thank you?

  • Make Firefox open URLs passed from external applications in new tabs

    I upgraded Firefox (Mac) from 3.6.13 to 3.6.14 yesterday.
    Since then Firefox does not respond to URLs passed from external applications, as it has always done.
    The external apps pass the URL, FireFox is brought to the front, but no Tab (or new window) is opened.
    Nothing else has changed. Firefox is selected as my default browser (in Safari Prefs) and there is only one copy of FireFox on my laptop,

    Hi David
    Go to Safari Preferences>General. At the bottom you'll see an option for opening in a tab. Makes sure Tabs are enabled in your Tab panel.

  • How do I get the URL of a jsp page which calls a servlet?

    I have a jsp page which will lead to a servlet, I can get the URL of the servlet, but how do I get the URL of the jsp page which lead to the Servlet in the servlet?

    You could try doing:
    request.getHeader("Referer");

  • Starting PCUI Appl Service Contrac as url passing parameters

    Hi all.
    I'm trying to launch PCUI Application Service Contract as an url passing some parameters but i'm getting an strange behavior, the screen is appearing empty then get a dump when try to go to the result list. I'm looking forward to pass the service contract number and get the detail or at least the result list displaying it.
    My url is something like this:
    http://MUAHAHA:8010/sap/bc/bsp/sap/crm_bsp_frame/entrypoint.do?sap-client=XXX&appl=CRMD_BUS2000112&CHG_ONLY=X&STANDALONE=X&crm_local_urls=true&sap-syscmd=nocookie&BORKEY=45340065DADE009A000000000A34030A&BORTYPE=BUS2000112&blview=ZMUAHAHAH
    Is there something wrong ?
    Thanks
    Armando.

    Hi trent,
    I too have had issues with this API , so moved forward with UTL_HTTP API.
    There is something amiss.
    If you change your code to the one below it works.
    SET SERVEROUT ON
    declare
    l_c CLOB;
    l_param varchar2(1000) ;
    begin
    l_param := 'select * from upcoming.events where location=''San Francisco'' '||
            ' and search_text=''dance'''||'&'||'format=json';
    l_c := apex_web_service.make_rest_request(
        p_url => 'http://query.yahooapis.com/v1/public/yql?q='||
            utl_url.escape(l_param)
        ,p_http_method => 'POST'
      dbms_output.put_line(substr(l_c, 1, 4000));
    end;
    /Note the use of UTL_URL.ESCAPE. The call does not work without it.
    I do not use a proxy, so that parameter does not feature in my snippet above.
    Cheers,
    PS: However, the below does not work. So, it appears that the p_parm_name and p_parm_value do not quite work.
    SET SERVEROUT ON;
    declare
    l_c CLOB;
    l_param varchar2(1000) ;
    begin
    l_param := 'select * from upcoming.events where location=''San Francisco'' and search_text=''dance''';
    l_c := apex_web_service.make_rest_request(
        p_url => 'http://query.yahooapis.com/v1/public/yql'
        ,p_http_method => 'POST'
        ,p_parm_name => apex_util.string_to_table('q:format')
        ,p_parm_value => apex_util.string_to_table(utl_url.escape(l_param)||':json')
      dbms_output.put_line(substr(l_c, 1, 4000));
    end;
    / Edited by: Prabodh on Oct 13, 2012 2:04 PM

  • Calling a cgi script URL in a jsp

              I have a requirement of calling a cgi script URL from a jsp.
              I wish to do the following:
              1. take the parameters from the jsp page,
              2. populate the parameters in the cgi script url,
              3. get results in a java structure
              4. and then paint the gui based on the results.
              Can anyone help me on whether calling a cgi script as above is doable in java?
              An early response would be highly appreciated.
              thanks in advance
              Prashant Gupta
              

    Prashant,
              Yes you should be able to do what you ask (using a JSP to drive a CGI
              script/program) if I understand you correctly. You would gather all the
              parameters in the JSP code and present them to the CGI script/program
              using a FORM with method="POST".
              There is a good example of this in the WebLogic examples. Look for it
              somewhere like:
              C:\bea\wlserver6.1\samples\examples\jsp\tagext\form_validation
              in your installation. However, replace action="successPage.jsp" with
              your CGI script.
              Prashant wrote:
              > I have a requirement of calling a cgi script URL from a jsp.
              > I wish to do the following:
              > 1. take the parameters from the jsp page,
              > 2. populate the parameters in the cgi script url,
              > 3. get results in a java structure
              > 4. and then paint the gui based on the results.
              >
              > Can anyone help me on whether calling a cgi script as above is doable in java?
              > An early response would be highly appreciated.
              > thanks in advance
              > Prashant Gupta
              

  • Get the "original" url of a jsp

    hello,
    i'm developing a web appliacation with tomcat and struts.
    i have actions that i call from html, for example from a link:
    <a herf="editThing.do?id=1">edit the item of "Thing" with identificator 1</a>
    struts performs this action and redirects the browser to a jsp that displays the information getted by the action.
    then, when "i arrive to the jsp" i would like to get the original url of the current jsp page, that is:
    i don't want a url like : http://server:port/webapp/page.jsp
    but the original!! http://server:port/webapp/editThing.do?id=1
    could somebody help me, please?!
    excuse me for my poor english, i'm from Barcelona.

    Have your Action class put a reference to the current URL in the request. For example:
    Action class:
    request.setAttribute("URL", request.getRequestURI());JSP:
    The original URL is: <%=request.getAttribute("URL")%>

  • The requested URL /OA_HTML/AppsLocalLogin.jsp was not found

    Dear,
    i was just upgrade the OracleAS 10g Release 3 (10.1.3.0) Patch Set 4 (10.1.3.4.0) and Java 6.0 JDK on this system (ebs r12.0.6) OUL5x64
    and run adautoconfig with no error.
    Before the upgrade the system was fine.
    but when i connect to the URL got this error.
    NOT FOUND the request URL "The requested URL /OA_HTML/AppsLocalLogin.jsp was not found on this server."
    looked into the apache error log and it complained , could not find the file, but i compared with a good system there were no file and DIR OA_HTML/AppsLogin.
    /u01/oracle/CRPXX/inst/apps/CRPXX_xxx/portal/OA_HTML/AppsLogin.
    from Apache error log:
    File does not exist: /u01/oracle/CRPXX/inst/apps/CRPXX_xxx/portal/OA_HTML/AppsLogin.
    Please advise.
    Regards,

    Hi,
    Have a look at this thread.
    Login Page not getting Displayed after 10.1.3 Home Upgrade in R12
    Login Page not getting Displayed after 10.1.3 Home Upgrade in R12
    Regards,
    Hussein

  • How to pass a JSP var to a Script function called in a netui:checkbox

    How to pass a JSP variable to a Java Script function called in a netui:checkbox onSelect?
    I have a requirement where based on the checkBox selected or deselected in a repeater tag I would have to select or deselect other checkboxes in a netui:form. I am trying to pass the index or unique name of the checkbox to the JavaScript function. When I try this code I am getting a Syntax Error!! and getting a " item undefined" in the javascript. This works when I use just the html form tag but when I use the <netui:form> tag I am facing this issue. Any help would be highly appreciated.
    function selectACheckBoxOnClick(name) {
    alert ("called selectACheckBoxOnClick ");
    alert ("called name "+name);
    <netui-data:repeater dataSource="{pageFlow.unregisteredContractAssetsDTOArr}">
    <netui-data:repeaterItem>
    <% String checkboxName = "selectACheckBox_"+i;
    String serialNum = "serialNum_"+i;
    String hidenboxName = "hiddenACheckBox_"+i;
    String loopNo = new Integer(i).toString();
    System.out.println("Loop String :"+ loopNo);
    System.out.println("CheckBox Name:"+ checkboxName);
    System.out.println("serialNum :"+serialNum); %>
    <tr bgcolor="#ffffff">
    <td align="center">
    <netui:checkBox dataSource="{container.item.selectedAssetFlag}" onSelect="selectACheckBoxOnClick(<%=checkboxName%>);" tagId="<%=checkboxName%>"/>
    </td>
              <td class="small"><netui:label value="{container.item.model}"/></td>
              <td class="small">
    <netui:hidden dataSource="{container.item.splitAssetNo}" tagId="<%=serialNum%>"/>
    <netui:label value="{container.item.serial}"></netui:label></td>
              <td class="small"><netui:label value="{container.item.equpimentId}"/></td>
              <td class="small">
    <netui-data:getData resultId="siteId" value="{container.item.siteNo}" />
    <%String siteId = (String) pageContext.getAttribute("siteId");%>
    <netui:anchor action="getSiteLevelAssets" formSubmit="true">
    <netui:parameter value="{container.item.siteNo}" name="siteNo" />
    <netui:label value="{container.item.siteNo}" />
    </netui:anchor>
    </td>     </tr>
    <%i++;%>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    This code works within a form:
                   <td align=center>
                        <input type=image name="unassign" onclick="javascript:unassignReplacement(<%=replacementSupply.getPMSupplyId()%>)" src="<%=request.getContextPath()%>/images/bt_sm_x.gif" border=0 alt="Unassign">
                        </td>
    Thanks,
    Salome

    hi
    i did not go thru your code completly
    but u can use the following for your problem
    the checkbox in the repeater must have unique TagID
    counter = 0; (initialize)
    <netui-data:repeaterItem>
    <netui:checkBox dataSource="" tagId='<%="count"+String.valueOf(counter)%>' onClick="some function()" />
    <%counter++;%>
    </netui-data:repeaterItem>
    here if u have 3 checkbox
    They will have Tagid's as count1 , count2 and count3
    now in the javascript somefunction()
    use the following line
    for(j=0;j<<%=counter%>;j++)
    document.forms(0)[getNetuiTagName"count"+j)].checked=false;     
    }

  • How do I pass the part of the url that matched url-pattern to JSP?

    Hello,
    I have a web app called ptest.war deployed in JBoss. In my web.xml I have:
    <servlet-mapping>
    <servlet-name>GetImage</servlet-name>
    <url-pattern>/images/*</url-pattern>
    </servlet-mapping>
    and:
    <servlet>
    <servlet-name>GetImage</servlet-name>
    <jsp-file>DoImageRequest.jsp</jsp-file>
    <load-on-startup>1</load-on-startup>
    </servlet>
    In DoImageRequest.jsp, I want to know what was requested by the user (so I can set some response headers and then re-direct to the image they requested), so if I go to:
    http://localhost/ptest/images/i1.jpg
    I want to have "/images/i1.jpg" available to me in the JSP, so that I can do a jsp:forward to the requested image, but none of the getters on the request object give me that string.
    request.getServletPath() returns "/images" and request.getPathInfo() returns "/i5.jpg".
    So do I need to construct what the user asked for by concatenating these two values?
    The reason I was testing this was because I wanted to set no-cache in the response to the request for the image. Is there an easier way of doing that without having to direct the request to a jsp so that the jsp can set the response headers, which seems a little long-winded to me?
    Many Thanks,
    Paul Smith

    I want to have "/images/i1.jpg" available to me in the JSP, so that I can do a jsp:forward to the requested image, but none of the getters on the request >object give me that string.Even if you manage to construct that, such a request path would be intercepted by your jsp because it maps to /images/*.
    You would end up with infinite recursion.
    To circumvent that, you can change the folder that stores the image - call it something like img and then you just need append the request.getPathInfo().
    getServletContext.getRequestDispatcher("/img"+req.getPathInfo()).forward(req,res);
    The reason I was testing this was because I wanted to set no-cache in the response to the request for the image. Is there an easier way of doing that >without having to direct the request to a jsp so that the jsp can set the response headers, which seems a little long-winded to me?You could have a filter intercept all requests for *.img, add the response headers and pass the request along to the actual resource. That would be easier and more intuitive. If your web app has a good fronting like an apache web server, I think you can cache your images on the web server and set a property that would instruct the web server to set a no-cache header in response when it serves the image.
    ram.
    Edited by: Madathil_Prasad on Mar 26, 2010 7:20 PM

  • Exception when URL connects to JSP page

    Hi All,
    I have a Web Application [http://localhost:8080/MyWebApps/TestEnv]
    Consider the following 3 pages:
    index.jsp
    Login.jsp
    LoggedIn.jspI have clean & build and Undeploy & Deploy it (NetBeans and using glassfish)
    Start -> Run -> [http://localhost:8080/MyWebApps/TestEnv/]
    will load the index.jsp, redirect to Login.jsp,
    I give a valid userName & password (submit the form),
    reload Login.jsp and it redirects me to LoggedIn.jsp.
    I have created a class that passes the same url to its loadURL method
    but the openStream method of the URL class gives an IOException
    Please tell me how to fix my problem I am baffeled as to the solution
    Below I have provided the code
    Thanx in advance

    index.jsp
    <HTML>
      <BODY>
    <%
        response.sendRedirect("Login.jsp");
    %>
      </BODY>
    </HTML>Login.jsp
    <HTML>
      <BODY>
    <%
        String uName = null;
        String uPass = null;
        if((uName = request.getParameter("uName") != null)
          if((uPass = request.getParameter("uPass") != null)
            if(Check.Login(uName,uPass))
              response.sendRedirect("LoggedIn.jsp");
    /* code for Login
      public static boolean Login(String name, String password){
        if(name.equals("user"))
          if(password.equals("pass123"))
            return true;
        return false;
    %>
        <FORM Action="Login.jsp" Method="GET">
          <TABLE>
            <TR>
              <TD>User Name:</TD>
              <TD><INPUT Type="TEXT" Name="uName"/></TD>
            </TR>
            <TR>
              <TD>User Password:</TD>
              <TD><INPUT Type="PASSWORD" Name="uPass"/></TD>
            </TR>
            <TR>
              <TD><INPUT Type="SUBMIT" Value="GO"/></TD>
              <TD><INPUT Type="RESET" Value="Reset"/></TD>
            </TR>
          </TABLE>
        </FORM>
      </BODY>
    </HTML>LoggedIn.jsp
    <HTML>
      <BODY>
        <H1>You Have Logged In</H1>
      </BODY>
    </HTML>JAVA
    import .....;
    public class Connector {
      public static void main(String[] args){
        String path = "http://localhost:8080/MyWebApps/TestEnv/";
        Connection conn = new Connection();
        try{
          conn.loadURL(path);
        }catch(Exception ex){
          Sysyem.out.println(ex.getMessage());
      public void loadURL(String path) throws Exception{
         URL url = new URL(path);
         BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
         String HtmlInputLine;
         while((HtmlInputLine = in.readLine()) != null)
           System.out.println(HtmlInputLine);
         in.close();
    }

Maybe you are looking for

  • Can i use a charger from a pre-2011 macbook pro on my 2012 macbook pro?

    left my charger out of state, it's being shipped but in the meantime i need to charge my laptop! a friend has a charger that i think is from a 2011-2010 macbook pro.  will this work? is it bad for my computer?

  • Sound in a game!

    Hi guys! I'm writing a game for Sony Ericsson K700. And i have a problem with a sound. Also i'm working with MIDP 2.0. My problem is to play 2 sounds in a game. When i play first sound, it play good, then is playing second sound and i have exception.

  • SLM2008 to SG200-08 VLAN

    Hi, I have the following setup: Service Provider connected to SLM2008 port 2 SLM2008 connected to SG300-20 using LAG2 SG300-20 connected to SG200-08 using LAG1 SG200-08 port 1 connected to PC I have configured VLAN 4 to isolate this (port-to-port)​ t

  • How do I change my email for my Adobe account?

    I am going to be making a new email soon and I want to know how to change the email for my Adobe account. I have purchased things on this account so I want to make sure that I can keep those purchases. Thanks!

  • GR non valuated ticker in account assignment category

    Dear Experts, A customer have set up their own account assignment category. In this they have both the "GR non valuated" and "GR non valuated firm" ticker set. I cannot see that this makes any difference to having only the GR non valuated firm ticker