Distributing JSP on two webServers

Hi
i am having a small issue regarding the distribution of JSP on two different webservers , i have written a wrapper handler jsp page which lyes on one server and on where all the request are transferred towards other webserver where all the jsps are placed. Now issue is, How to forward the request to the webserver from wrapper server and get the response back.
supersonic replies will be deeply appreciated
thanks

Any help
My steps are:
1)     One webserver(1) is holding using struts framework based application and the second webserver(2) is holding a ASP application
Webserver one maintains its own session with its session data, which are not to be shared with webserver2.
Now what the requirement is from webserver1 at one point the control is transferred to webserver2 and then after doing some processing on some asp pages control is again transferred back to the next logical page of webserver1. The next logical page�s URL is passed from webserver1 to webserver2, so that webserver2 would hit back the next logical page while returning control back to webserver1.
The problem here is while returning back, the session with its session data are getting lost (which was maintained in webserver1 before transfer) and a new session is created.
     The code snippet of the Action class (SearchAction) before sending is
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
     String returnURL = http://:myhost:8080/myApp/app/DisplayDefinition";
     ����
     ����
     return mapping.findForward("success");
     the strurts mapping is
<action path="/app/SearchDefinition " type="com.test.SearchAction"
name="InfoForm" scope="request" validate="false">
          <forward name="success" path=�http://webserver2/��./test.asp/>
     </action>
     the strurts mapping for logical page returning is
     <action path="/app/DisplayDefinition " type="com.test. SearchDisplayAction" name="InfoForm" scope="request" validate="false">
     <forward name="success" path="/myApp/app/Display.jsp"/>
</action>
     The code snippet of the Action class (DisplayAction) after control comes back to webserver1 is
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
�.
�.
     //get Value from session
HttpSession session = request.getSession();
MyValue myValue = (MyValue)session.getAttribute(�MyValue�);
�.
But myValue is getting null when the control returns back.
Any help regarding the same????

Similar Messages

  • Can I use one Apple TV unit to distribute content to two TV's?

    Can I use one Apple TV unit to distribute content to two TV's? If so, how?
    I want to be able to purchase movies off of the iTunes store on both TV's and to display photos and listen to music.
    Thank you for looking.

    Apple TV is designed to display content on a single TV only. Although it has component and HDMI outputs they are not independent and, as has been pointed out already, HDMI will take precedence over the component video.
    You will need two Apple TVs, one for each TV, and you can then sync both with one computer either with the same content or with different content selected from a common library in iTunes..
    Hope this helps.

  • Sharepoint 2013 Foundation three tier farm with two Webservers in NLB

    Heloo,
    I have been strugling with a problem the last htree days.
    I have instelled and configured a sharepoint 2013 three tier farm with Sharepoint 2013 Foundation and MS SQL 2014 Express. This is a Test Farm and all the servers are Windows 2012 R2.
    I have one SQL Server, one Application Server and two Webservers. The tow web servers are configured with Multicasting NLB. The NLB name is "sharepoint.ws.domain.net". The IP of the NLB is also in our DNS Zone.I have made a Web Application with
    the name "sharepoint.ws.domain.net" on port 80 (NLB name) and a Site collection with the same name.
    Now whene I am working on the Sharepoint Site I get very offen a login Window or I get the message "An error occurred while processing the request on the server. The status code returned from the server was: 0".
    The error "An error occurred while processing the request on the server. The status code returned from the server was: 0" comes when I try to create a sub Site (most with no Permissions inheritance)... but not allways. I also get  sometimes
    the same message when I upload files (MS Office documents and PDF files).
    The login Windows comes whene I am navigating throw the Sites... but also not allways.I go to the Site with an IE11 and the Site is also in the Intranet security sites.
    Can you help me on this one...
    Kind Regards
    Ioannis Kyriakidis

    With no hostname on the Web Application, you have to create Host-named Site Collections. So that complicates things a bit.
    As far as NLB setup, you create Web Applications the same way you would otherwise. NLB is simply installed on both Web Servers and placed into the NLB VIP (virtual IP). The DNS A record points at the VIP.
    Also set up your Windows NLB using Unicast instead of Multicast. If you have certain types of switches that block unicast ARP from multiple clients, e.g. Cisco, you may have to make an exception for them (e.g. http://www.cisco.com/c/en/us/support/docs/switches/catalyst-6500-series-switches/107995-microsoft-nlb.html).
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Looking up a distributed queue with two persistent stores using two JMS Svr

    I am trying to do the following:
    1. Setup a distributed queue, i have two servers which are part of the cluster:
    Server A: t3://localhost:7003
    Server B: t3://localhost:7005
    I go in and create two jms servers:
    JMS Server JA: Target on Server A
    JMS Server JB: Target on Server B
    Now as the jms servers need to use a seperate persistent store for each one of them i create two persistent stores.
    2. Now from my MDB which is deployed on another server i lookup the queue using
    t3://localhost:7003,localhost:7005 as the provider url
    My problem is that i always end up listening to the messages on the first jms server and never get to read the messages on jms server JB as i guess i am able to connect to JMS Server JA so i never try and connect to JB? What to do about this?
    Edited by: user4828945 on Mar 23, 2009 2:32 PM

    Allocation of consumers wouldn't take into account the number of messages on the queue - they'd be allocated randomly. The scenario you're proposing shouldn't happen though - WebLogic Server takes into account whether a member has consumers when sending to a distributed destination, but otherwise, assuming that Queue 1 and Queue 2 both have consumers, then distribution of load will be equal. It's not the amount of consumers that determine how many messages get sent to a distributed destination member - it's whether it has members at all.
    Assuming that did occur initially though, you'd expect processing to be a little bit more intensive on the server with the queue holding 30 messages. It would pretty quickly even up though.
    From that point forward, it would be somewhere between difficult and impossible to get to the second scenario, where you have an unequal number of messages in each distributed destination member, unless the work being sent with each message to an MDB can vary significantly in how long it would take to process.
    Assuming (and it's a big if) you could get to that scenario, then the MDBs wouldn't switch over - they stay connected to a particular distributed destination member. And it's their connection to a member as a consumer that controls how WebLogic Server load balances messages (assuming default configuration) so that's part of what makes it unlikely to get there.
    From going back to first principles in the documentation, it seems like your best result would actually be from deploying the MDB to the cluster - that way, there's no remote connections to JMS queues, and you get a pool of MDBs on each server instance.
    Ref here: http://e-docs.bea.com/wls/docs81/ejb/message_beans.html

  • Distributing calls between two hunt groups

    Hi all,
    I've got a requirement to distribute calls to a number equally between two hunt groups when not answered and was wondering the best way of doing this?
    So for example a receptionist should answer all the intial calls for this area of the business, however, when away from her desk they'd like the calls to then transfer and distribute on a 50:50 basis between two hunt groups.
    Thanks in advance,
    Ryan

    Hi Ryan.
    Because line groups on an hunt list are selected as they appear, I can suggest you to configure a third line group with all members of existing line groups.
    EG.
    New line group could be with following users
    LG_ONE Member One
    LG_TWO Member One
    LG_ONE Member two
    LG_TWO Member two
    And so on
    Than create a new hunt list with associated the new line group.
    Create an hunt pilot with associated the newly created hunt list.
    That hunt pilot number will be associated with forward busy or no answer rule of receptionist's extension.
    HTH
    Regards
    Carlo

  • Distributing jsp program with JRE

    hi,
    i have written a some jsp files for a small project and now i would like
    to make a installation file which consists of my jsp files, including tomcat server and jre 1.5. As per license we cant distribute J2SDK package. So i am kept JRE instead of J2SDK. But tomcat server is not running, when i set my JAVA_HOME variable to JRE instead of J2SDK.
    Is there any way to make tomcat run with JRE or any other suggestions.
    thanx

    Thanx to the excellent work done. Its working with
    JRE. it seems you are the most active person in java
    forums. You have about 6500 posts in your account.:-) Thanks. But most of my posts are off topic. I don't think I am really the most active person around, perhaps the most gabby is all :-)
    i would like to assign you 10 duke dollars but
    t couldn't find any link where i can do it. please
    let me know how can i give you duke dollars. There should be a button next to my posts of a little green + sign. The image is broken though (yay Sun!) so you might not be able to see it (in FireFox it shows up as an invisible square, not sure what it shows in IE). Anyway, if you start with the date on one of my posts, and slowly move your mouse to the left you should find the link.
    if
    possible please give me your email ID or mail me at
    [email protected]
    Sorry, I don't like to trade email addresses across the forum. Mostly I like to keep the conversations public so everyone can benefit from them.
    >
    once again thanx for your help.
    bye
    craty

  • JSP with two different response options.

    Hello to all.
    Is there a way to handle this. (Please do not ask why i need this. I simply want it to work it that way!)
    I do have a JSP File, where i process all 'logical' part at the top of the page.
    than, at the buttom i do have my tags and the 'HTML' components.
    Now: If the Client on the browser what's this view to be 'printable', i what this very same JSP file to return a different output.
    Any idea?
    kind regards,
    Chaim
    Edited by: chaimS on Jul 22, 2009 3:13 AM

    the best solution for me would be to use CSS to control this.
    http://www.alistapart.com/articles/goingtoprint/
    Otherwise, you'd get something like an if/else for print view or web view.

  • Distributing data on two consecutive page

    Hello,
    I have received request from the customer to put tree kinds of data on one smartform. I have prepared this data in printing program groped them into separate structures, that are imported in to form. My problem is that it is possible to have only one main window per page and need three windows with similar characteristics (to continue on to next page, page break, and to continue to print data in area that I define).
    Is there a way to define position of table within main window, in this case I would have tree tables looping into my structures), or
    Can I somehow continue writing items into a window that is not “MAIN” on next page?
    Thanks in advance,
    Milan.

    hi
    u can trigger the new page using the COMMAND button,,, but in this way also u have to create this in the Main windo only... so this will not work in u r case.
    wht i suggerst you is...
    create the template inside the main window with same size of the MIAIN window.
    split this into 3 parts... inside each box disply the table...
    I am not sure in this way will it trigger the newpage or nor but try once.. may it works.
    or else the follow the same way as above i have mentioned... trigger the new page explicitily by using the COMMANd window... at the end of the Main window.

  • Self-recorded message cannot distributed to my two macs

    Hi all
    I've recorded voice-messages on my ipod (using an external micro/recording device). Afterthat I've connected the iPod to my Macbook Pro and did a synch within iTunes. So the voice-messages have been transmitted to my Macbook. So far so good.
    Now I wanted to transmit these voice-messages also to my iMac. But guess ... "not same iTunes database ... blabla"). So it's not possible to spread my own recorded stuff out from my own bought iPod to my own bought Apple-Computers?
    Has anybody an idea?
    Thanks

    Click here and follow the instructions, copying the file to the iPod in the Finder, and then copying it to the other Mac. If you can't find the message in the Finder, see this article.
    (26949)

  • How to get HttpServletRequest parameters from two forms in a JSP

    I have this JSP with two forms calling the same servlet. Problem is, when I use a submit button in the second form, I am unable to retrieve the request parameters from the form through the servlet. I am wondering if anybody could give me some info on how to get the request parameters from the second form. I tried to see all the parameter names in the request by calling request.getParameterNames(). But the parameters in the second form are not even seen in the request although I am clicking the submit button in this form!

    First, two forms works fine in one jsp so no need to argue about that.
    Second, did you put the form actions and type ("multipart/formdata " ?) explicit in every form header ? Did you supply different form names ?
    Try to call the submit function through javascript - document.forms[0].submit() for your first, and document.forms[1].submit() for your second form...
    Did you forget to close the form tag by chance ?

  • Two JSPs using JavaBeans

    Hi,
    I have a JSPs and JavaBeans question.
    There are two JSP files. One.jsp and Two.jsp.
    One.jsp include code that use the JavaBeans from Two.jsp:
    <%
         if (bl.getDmlOperation() == NcepConstants.UPDATE) {
    Two.jsp have:
    <jsp:useBean      id="bl"     class="TestsPrivateBean" scope="session"/>
    <%@ include file="One.jsp" %>
    When I run this code in TOMCAT, it can run in runtime with no problem.
    But the company it now moving to use an IDE (Oracle JDeveloper 9i) with require me to build this into one project. When I try to build the project, it shows error in One.jsp as "variable bl not found in class_One".
    When I put the <jsp:useBean      id="bl"     class="TestsPrivateBean" scope="session"/> code into Two.jsp, it shows "duplicate found error".
    How should I do to fix this?
    Thanks
    Kenny

    It sounds like it's compiling One.jsp independant of Two.jsp, which will cause the first error. Try renaming One.jsp to One.inc or something. That way it doesn't try compiling One.jsp at all (it won't be there).

  • Working with two buttons in jsp

    hi
    My working with jsp's in struts.
    I have a jsp with two buttons "Save" and "Delete".
    My requirement is, on clicking either the "save button" or "Delete button" in jsp, it should call the corresponding code in the Action class.
    wht is the logic required to call the corresponding code in the Action class ?
    Thanks

    hi
    Thanks nani and jHyena for ur reply , but its not working, can u tell me where i went wrong, how to set them in jsp and action class.
    This is my Action class
    public class EditUserDetailsAction extends Action {
          * Generated Methods
          * Method execute
          * @param mapping
          * @param form
          * @param request
          * @param response
          * @return ActionForward
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response) throws DaoException {
                   System.out.println("---------------in execute() befor try/catch-----------");
    //**************************the problem is here calling in if()/else, how should i call i?**************      
          if() {
                    try{
                        EditUserDetailsForm editUserDetailsForm = (EditUserDetailsForm) form;
                        System.out.println("------------ execute()-----------------");
                        DaoImplementer daoImpl = new DaoImplementer();
                        Integer editUid       = (Integer) editUserDetailsForm.getUser_Id();
                        String editName       = (String)  editUserDetailsForm.getName();
                        String editTitle      = (String) editUserDetailsForm.getTitle();
                        String editEmail      = (String) editUserDetailsForm.getEmail();
                        Integer editTelephone = (Integer) editUserDetailsForm.getTelephone();
                        String  editUserName  = (String) editUserDetailsForm.getUserName();
                        String editPassword   = (String) editUserDetailsForm.getPassword();
                        daoImpl.registerUser(editUid, editName, editTitle, editEmail, editTelephone, editUserName, editPassword);
                        System.out.println("------------sent to model components---------------");
                        System.out.println("----------forwarding to edituserdetail.jsp----------");
                        return mapping.findForward("editUserDetails");
                   catch (Exception e) {
                        System.out.println("@@@ ---Exception in EditUserDetailsAction class--@@@@");
                        throw new DaoException("Error adding userDetails: ",e);
                   return mapping.findForward("addUserDetails");
    Here is the jsp
    <html:html locale="true">
      <head>
        <html:base />
        <title>editUserDetails.jsp</title>
        <script type="text/javascript">
             function save_display(){
                  var x = confirm("Save: Are you sure ?")
                  if( x == true ){
                       confirm("Save: OK")
                  else{
                       text("Save: Cancelled")
             function delete_display(){
                  var y = confirm("Delete: Are you sure ?")
                  if( y == true ){
                       confirm("Delete: OK")
                  else{
                       alert("Delete: Cancelled")
             function funSave(){
                  document.form[0].ID.value = id;
                  form[0].ID.value.action="<%=request.getContextPath()%>/division/editDesignation.app?save=save";
                   form[0].ID.value.method="post";
                   form[0].ID.value.submit();
             function funDelete(){
                  function funSave(){
                        document.form[0].ID.value=id;
                        form[0].ID.value.action="<%=request.getContextPath()%>.app?save=save";
                        form[0].ID.value.method="post";
                        form[0].ID.value.submit();
        </script>
         <meta http-equiv="pragma" content="no-cache">
         <meta http-equiv="cache-control" content="no-cache">
         <meta http-equiv="expires" content="0">   
         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
         <meta http-equiv="description" content="This is my page">
         <!--
         <link rel="stylesheet" type="text/css" href="styles.css">
         -->
      </head>
      <body>
      <html:javascript formName="editUserDetailsForm"/>
      <html:form action="/editUserDetails" onsubmit="return validateEditUserDetailsForm(this);">
                   user_Id : <html:text property="user_Id"/><html:errors property="user_Id"/><br/>
                      name : <html:text property="name"/><html:errors property="name"/><br/>
                     title : <html:text property="title"/><html:errors property="title"/><br/>
                telephone : <html:text property="telephone"/><html:errors property="telephone"/><br/>
                     email : <html:text property="email"/><html:errors property="email"/><br/>
                 userName : <html:text property="userName"/><html:errors property="userName"/><br/>
                 password : <html:password property="password"/><html:errors property="password"/><br/>
                           <html:submit property="save" value="Save"  onclick ="funSave()"/>
                           <html:cancel property="delete" value="delete" onclick="funDelete()"/>
      </html:form>
      </body>
    pls let me know how to set the hidden variables within the  above jsp .
    and  in Action class how to call it.
    I would be very thankful to u guys.
    Thanks

  • Unable to get the value from the jsp page.

    Hi,
    I have developed a JSP, having two split fields seperated by some buttons..The sample code for the same is like this..
    (Only the required portion is included)
    <script>
    function reloadPageOK() {
    document.product.method="post"
    document.product.action="./TheSamePage.jsp?status=OK"
    document.product.submit()
    function moveValue(from,to) {
    if(from.selectedIndex>=0) {
    var text=from[from.selectedIndex].text
    var length= to.length
    to[length]=new Option(text,from.value,false,false)
    from.remove(from.selectedIndex)
    function moveAll(from,to) {
    if(from.length>0) {
    var menutext="";
    var i;
    var len=from.length
    for(i=0;i<len;i++) { 
    from.selectedIndex=0
    menutext=from[0].text
    var length= to.length
    to[length]=new Option(menutext,from.value,false,false)
    from.remove(from.selectedIndex)
    </script>
    <table width="100%" border="0" cellspacing="0" >
    <tr class="contactDetail">
    <td width="10%" class="table_grid1" rowspan="4">
    <div class="contactDetail">
    <select name="lstProviderLeft" size="7" style="width:111">
    <option> PDP</option>
    <option> Net</option>
    <option> Par</option>
    <option> Non-Par</option>
    </select>
    </div>
    </td>
    <td width="20%" bgcolor="#FFFFFF" class="contactDetail">
    <input type="button" value=" > " name="btnLtrProvider" class="button" onclick="moveValue(lstProviderLeft,lstProviderRight)">
    </td>
              <td width="10%" bgcolor="#FFFFFF" rowspan="4" class="contactDetail"> <font face="Arial, Verdana, Helvetica, sans-serif" size="2" >
              <select name="lstProviderRight" size="7" style="width:111"></select>
              </font></td>
    <tr>
    <td width="8%" class="contactDetail">
    <input type="button" value=" >> " name="btnLtrAllProvider" class="button" onclick="moveAll(lstProviderLeft,lstProviderRight)" >
    </td>
    </tr>
    <tr>
    <td width="8%" class="contactDetail">
    <input type="button" name="btnRtlProvider" value=" < " class="button" onclick="moveValue(lstProviderRight,lstProviderLeft)" >
    </td>
    </tr>
    <tr>
    <td width="8%" class="contactDetail" height="22">
    <input type="button" name="btnRtlAllProvider" value=" << " class="button" onclick="moveAll(lstProviderRight,lstProviderLeft)" >
    </td>
    </tr>
    </table>
    <p align = "center"> <input type="button" value=" OK " onclick="reloadPageOK()">
    The page is working fine. That is we can move the values in the left field to right as single or group.After submitting I need to get the values in the left & right fields respectively.
    I have used the method
    request.getParameterValues("lstProviderLeft");
    and pointed this to an array of strings,but it returns 'null' .
    How can I solve the above problem....Post your comments on this issue
    Thanking u

    probably the request.getParmeterValues will not work in this case as the name of the 2 select boxes are different....
    You can do this utility by using Javascript....concantinate the values of the 2 select boxes and put the concantinated strings (with a delimiter) in two hidden fields and capture the same fields in the target JSP/Servlet.
    I have modified ur code...have a look...
    --------------------Start-----------------
    <html>
    <head></head>
    <title></title>
    <body>
    <script language="Javascript">
    function reloadPageOK()
    document.product.method="post" ;
    document.product.action="./TheSamePage.jsp?status=OK" ;
    document.product.submit();
    function moveValue(from,to)
         if(from.selectedIndex>=0)
              var text=from[from.selectedIndex].text;
              var length= to.length ;
              to[length]=new Option(text,from.value,false,false);
              from.remove(from.selectedIndex);
    function moveAll(from,to)
         if(from.length>0)
              var menutext="";
              var i;
              var len=from.length;
              for(i=0;i<len;i++)
                   from.selectedIndex=0;
                   menutext=from[0].text ;
                   var length= to.length;
                   to[length]=new Option(menutext,from.value,false,false) ;
                   from.remove(from.selectedIndex);
    function fnSubmitPage(from,to)
         var strfromSelBox = "";
         var strtoSelBox = "";
         if(from.length>0)
              var len=from.length;
              for(var i=0;i<len;i++)
                   strfromSelBox=strfromSelBox+":"+from.text ;               
         if(to.length>0)
              var len=to.length;
              for(var i=0;i<len;i++)
                   strtoSelBox=strfromSelBox+":"+to[i].text ;               
         document.product.hdFromValue.value=strfromSelBox;
         document.product.hdFromValue.value=strtoSelBox;
         document.product.method="post" ;
         document.product.action="" ;//Name of the JSP or servlet wherever u want to direct to....
         document.product.submit();
    </script>
    <form name="product">
    <input type="hidden" name="hdFromValue">
    <input type="hidden" name="hdToValue">
    <table width="100%" border="0" cellspacing="0" >
    <tr class="contactDetail">
         <td width="10%" class="table_grid1" rowspan="4">
              <div class="contactDetail">
                   <select name="lstProviderLeft" size="7" style="width:111">
                        <option> PDP</option>
                        <option> Net</option>
                        <option> Par</option>
                        <option> Non-Par</option>
                   </select>
              </div>
         </td>
         <td width="20%" bgcolor="#FFFFFF" class="contactDetail">
              <input type="button" value=" > " name="btnLtrProvider" class="button" onclick="moveValue(lstProviderLeft,lstProviderRight)">
         </td>
         <td width="10%" bgcolor="#FFFFFF" rowspan="4" class="contactDetail">
              <font face="Arial, Verdana, Helvetica, sans-serif" size="2" >
                   <select name="lstProviderRight" size="7" style="width:111">
                   </select>
              </font>
         </td>
    <tr>
         <td width="8%" class="contactDetail">
              <input type="button" value=" >> " name="btnLtrAllProvider" class="button" onclick="moveAll(lstProviderLeft,lstProviderRight)" >
         </td>
    </tr>
    <tr>
         <td width="8%" class="contactDetail">
              <input type="button" name="btnRtlProvider" value=" < " class="button" onclick="moveValue(lstProviderRight,lstProviderLeft)" >
         </td>
    </tr>
    <tr>
         <td width="8%" class="contactDetail" height="22">
              <input type="button" name="btnRtlAllProvider" value=" << " class="button" onclick="moveAll(lstProviderRight,lstProviderLeft)" >
         </td>
    </tr>
    </table>
    <input type="button" value=" OK " onclick="reloadPageOK()">
    <input type="button" value=" Submit " onclick="fnSubmitPage(lstProviderRight,lstProviderLeft)">
    </form>
    </body>
    </html>
    --------------------Finish---------------
    Hope this helps...
    Thanks

  • Cisco ASA 5512 two interfaces

    i have an Cisco ASA 5512 working as Firewall
    We configure one ASA interface connecting to Cisco router 1700 with leasd line internet service without any problem.
    Now we have an extra internet connection ADSL 2MB connected to another ASA interface  
    I configure the ASA like this :
    1-    Enable interface 2 on ASA and connect it to ADSL router (interface ip 192.168.1.100 from the same ADSL router {192.168.1.1}range ) 
    2-    Create Access rule say source (My computer ip) destination  ADSL network range action accept
    3-    Create Nat Rule say source interface inside source ip (my ip) destination interface ADSL ip 192.168.1.100 destination source router ip 192.168.1.1
    4-    Add static route say ADSL interface source ip my ip gateway ADSL router
    This steps what I do but it doesn't work.
    Thanks in advance

    FYI for internet access I doubt this will work because if you configure two default route then ASA won't distribute traffic across two interface, first default route will be the one where ASA will send traffic. However from your description it is not very clear which IP address you are trying to ping and how exactly rules you have configured.
    Either attach your config or paste the relevant config in post.

  • Writing JSPs to play chess; I get a null at a point, where I shouldn't

    I am writing a set of JSP pages in order to play chess online. I know it is better to do this task using an applet, but the man I am working for doesn't want it to be an applet. The idea is two clients play a game, while in fact manipulating a single object in the application or ServletContext object. If one of the clients makes a move - he modifies the Game object and the thread (a loop checking if the Game object has changed), created by the other client stops and his service method visualizes the move his opponent has made. As soon as a client submits a move - his service method creates and join()s the thread waiting for the next change in the Game object.
    MY PROBLEM IS: THE SECOND TIME THE HOST PLAYS A MOVE HIS OPPONENT GETS A NULL INSTEAD OF VALID Game OBJECT. CAN ANYONE TELL ME WHY BECAUSE I HAVEN'T SET IT TO NULL ANYWHERE IN THE CODE
    I have the following files: chessOnline.jsp, hostGame.jsp, joinGame.jsp, play.jsp, quitGame.jsp and a few .class files: Game.class, MovesStateChecker and GameOnChecker.
    chessOnline.jsp has two functions:
    1. to join a created game
    2. to create a new game
    joinGame.jsp and hostGame.jsp are just like play.jsp with the difference that they initialize the game; the code is quite the same.
    ---------------------------------------MovesStateChecker ----------------------------------------
    public class MovesStateChecker extends Thread
         private ServletContext sc;
         private int movesNumber;
         public MovesStateChecker(String name,ServletContext sc,int movesNumber)
              super(name);
              this.movesNumber=movesNumber;
              this.sc=sc;
         public void run()
              Game g=null;
              int retries=0;
              while(true)
                   try {
                        Thread.sleep(1500);
                   } catch (InterruptedException e) {}
                   g=(Game)sc.getAttribute(this.getName());
                   if(g==null){retries+=1;continue;}
                   if(g.getMoves().size()>movesNumber){break;}
    ---------------------------------------end of MovesStateChecker.class------------------------
    ---------------------------------------joinGame.jsp--------------------------------------------------
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.util.Map,java.io.IOException,chessoffice.*,java.sql.*" errorPage="" %>
    <%
    response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
    response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
    response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
    %>
    <html>
    <head>
    <link rel="stylesheet" href="styles.css" type="text/css" />
    <title>Read</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <%
         if (Strings.dbCheckSession(request))
              String user =(String)session.getAttribute("sessionUser");
              if(request.getParameter("gameId")==null || request.getParameter("gameId").equals(""))
                   response.sendRedirect(response.encodeURL("/jsp/chessOnline.jsp"));
              else
                   Game joinedGame=(Game)application.getAttribute(request.getParameter("gameId"));
                   if(joinedGame.getBlack()==null)
                   {joinedGame.setBlack(user);}
                   else
                   {joinedGame.setWhite(user);}
                   joinedGame.setGameOn(true);
                   application.setAttribute(request.getParameter("gameId"),joinedGame);
                   MovesStateChecker msc=new MovesStateChecker(joinedGame.getId(),application,0);
                   msc.start();
                   msc.join();
                   Game g=(Game)application.getAttribute(request.getParameter("gameId"));
                   if(g==null)
                        response.sendRedirect(response.encodeURL("/jsp/chessOnline.jsp?error=opponentQuit"));
                   else
                        out.println(g.getWhite()+" - white player<br />");
                        out.println(g.getBlack()+" - black player<br />");
                        out.println(g.getMoves().size()+" - size of Moves array list (number of moves)<br />");
                        out.println(g.isGameOn()+ " - is the game on <br />");
                        out.println(g.getDesk().get("b2")+" - b2 position<br />");
                        out.println(g.getDesk().get("b4")+" - b4 position<br />--------------------<br />");
                        out.println("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                        out.println("<tr><td>");
                        Read.drawDesk(false,g.getDesk(),out);
                        out.println("</td><td>");
                        Read.drawInfoForm(request.getParameter("gameId"),out);
                        out.println("</td></tr>");
                        out.println("</table><br /><hr />");
                        Read.drawQuitForm(request.getParameter("gameId"),out);
         else response.sendRedirect(response.encodeURL("/jsp/index.jsp"));
    %>
    </body>
    </html>
    ---------------------------------------end of joinGame.jsp-----------------------------------------
    ----------------------------------------hostGame.jsp-------------------------------------------------
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.io.IOException,chessoffice.*,java.util.*,java.sql.*" errorPage="" %>
    <%!
         public Map initGameMap() {
              Map m=Collections.synchronizedMap(new HashMap(64,(float)0.1));
              for(int ver=8;ver>=1;ver--)     {
                   for(int hor=0;hor<=7;hor++) {
                        switch(ver) {
                             case 1: m.put(""+Read.chars[hor]+ver,"white/"+Read.bfigs[hor]+".gif");break;
                             case 2: m.put(""+Read.chars[hor]+ver,"white/p.gif");     break;
                             case 7: m.put(""+Read.chars[hor]+ver,"black/p.gif");     break;
                             case 8: m.put(""+Read.chars[hor]+ver,"black/"+Read.bfigs[hor]+".gif");break;
                             default: m.put(""+Read.chars[hor]+ver,null);break;
              return m;
    %>
    <%
    response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
    response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
    response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
    %>
    <html>
    <head>
    <script language="JavaScript" type="text/javascript">
         function selectFigure(cell)
              /*oldPos=cell.name;
              bgImage=cell.background;
              document.write(bgImage.substring(0,bgImage.indexOf("."))+"_"+bgImage.substring(bgImage.indexOf(".")-1,bgImage.length()));
              cell.background=bgImage.substring(0,bgImage.indexOf("."))+"_"+bgImage.substring(bgImage.indexOf(".")-1,bgImage.length());
              alert("cell name is: "+cell.background);
    </script>
    <title>chess online</title>
    <link rel="stylesheet" href="styles.css" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <%
         if (Strings.dbCheckSession(request))
              String user=(String)session.getAttribute("sessionUser");
              Game initialGame=new Game();
              initialGame.setId(user);
              if(request.getParameter("color")!=null)
                   if(request.getParameter("color").equals("white"))
                        initialGame.setWhite(user);
                   else
                        initialGame.setBlack(user);
              else
                   initialGame.setWhite(user);
              initialGame.setGameOn(false);
              initialGame.setWhiteTime(10*60*1000);
              initialGame.setBlackTime(10*60*1000);
              initialGame.setMoves(new ArrayList());
              initialGame.setDesk(this.initGameMap());
              initialGame.setCaptured(new ArrayList());
              application.setAttribute(initialGame.getId(),initialGame);
              GameOnChecker goc=new GameOnChecker(initialGame.getId(),application);
              goc.start();
              goc.join();
              Game g=(Game)application.getAttribute(user);
              out.println(g.getWhite()+" - white player (host)<br />");
              out.println(g.getBlack()+" - black player<br />");
              out.println(g.getMoves().size()+" - size of Moves array list (number of moves)<br />");
              out.println(g.isGameOn()+ " - is the game on<br />");
              out.println(g.getDesk().get("b2")+" - b2 position<br />");
              out.println(g.getDesk().get("b4")+" - b4 position<br />-------------------<br />");
              out.println("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
              out.println("<tr><td>");
              Read.drawDesk(false,g.getDesk(),out);
              out.println("</td><td>");
              Read.drawInfoForm(user,out);
              out.println("</td></tr>");
              out.println("</table><br /><hr />");
              Read.drawQuitForm(user,out);
         else response.sendRedirect(response.encodeURL("/jsp/index.jsp"));
    %>
    </body>
    </html>
    ----------------------------------------end of hostGame.jsp----------------------------------------
    ----------------------------------------play.jsp-------------------------------------------------
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="chessoffice.*,java.sql.*" errorPage="" %>
    <%
    response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
    response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
    response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
    %>
    <html>
    <head>
    <link rel="stylesheet" href="styles.css" type="text/css" />
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <%
    boolean overtake=(request.getParameter("overtake").equals("true"))?true:false;
    String bgImage=request.getParameter("bgImage");
    String oldPos=request.getParameter("old");
    String newPos=request.getParameter("new");
    String gameId=request.getParameter("gameId");
    if(newPos!=null && oldPos!=null && bgImage!=null && gameId!=null)
         //tuk trqbva da ima proverka na hod-a
         //posle se suzdava obekt ot tipa Move i se zapisva v Game.moves:
         Move m=new Move(oldPos,newPos,overtake,bgImage);
         Game loadedGame=(Game)application.getAttribute(gameId);
         loadedGame.updateDesk(m);
         int currentMovesNumber=loadedGame.getMoves().size();
         application.setAttribute(gameId,loadedGame);
         MovesStateChecker msc=new MovesStateChecker(loadedGame.getId(),application,currentMovesNumber);
         msc.start();
         msc.join();
         Game g=(Game)application.getAttribute((String)session.getAttribute("sessionUser"));
         if(g==null)
              out.println("izvadenata igra e NULL");
              //response.sendRedirect(response.encodeURL("/jsp/chessOnline.jsp?error=opponentQuit"));
         else
              out.println(g.getWhite()+" - white player<br />");
              out.println(g.getBlack()+" - black player<br />");
              out.println(g.getMoves().size()+" - size of Moves array list (number of moves)<br />");
              out.println(g.isGameOn()+ " - is the game on <br />");
              out.println(g.getDesk().get("b2")+" - b2 position<br />");
              out.println(g.getDesk().get("b4")+" - b4 position<br />--------------------<br />");
              out.println("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
              out.println("<tr><td>");
              Read.drawDesk(false,g.getDesk(),out);
              out.println("</td><td>");
              Read.drawInfoForm(request.getParameter("gameId"),out);
              out.println("</td></tr>");
              out.println("</table><br /><hr />");
              Read.drawQuitForm(request.getParameter("gameId"),out);
    %>
    </body>
    </html>
    ----------------------------------------play.jsp----------------------------------------
    ------------------------------------------chessOnline.jsp----------------------------------------------------
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.util.*,java.io.*,chessoffice.*,java.sql.*" errorPage="" %>
    <%!
    public void drawJoinGameForm(javax.servlet.jsp.JspWriter out,ServletContext application) throws IOException
         out.println("<form action=\"joinGame.jsp\" method=\"get\">");
         out.println("<select style=\"width:300\" name=\"gameId\" size=\"6\" size=\"120\">");
         Enumeration e=application.getAttributeNames();
         while(e.hasMoreElements())
              String el=(String)e.nextElement();
              if(el.length()<=20 && ((Game)application.getAttribute(el)).isGameOn()==false)
              out.println("<option value=\""+el+"\" >"+el+"</option>");     
         out.println("</select>");
         out.println("<br /><input type=\"submit\" value=\"Join Game\" />");
         out.println("</form>");
    public void drawHostGameForm(javax.servlet.jsp.JspWriter out) throws IOException
         out.println("<form action=\"hostGame.jsp\" method=\"get\" name=\"hostGameForm\">");
         out.println("<input type=\"submit\" value=\"Host New Game\" />");
         out.println("<br />Choose your color:<br />");
         out.println("<input type=\"radio\" name=\"color\" value=\"white\" checked=\"checked\" /> White");
         out.println("<input type=\"radio\" name=\"color\" value=\"black\" /> Black");
         out.println("</form>");
    public void drawCancelForm(String user,javax.servlet.jsp.JspWriter out) throws IOException
         out.println("<form action=\"quitGame.jsp\" method=\"get\">");
         out.println("<input type=\"hidden\" name=\"gameId\" value=\""+user+"\" />");
         out.println("<input type=\"submit\" value=\"Cancel Game\" />");
         out.println("</form>");
    %>
    <%
         response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
         response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
         response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
         response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
    %>
    <html>
    <head>
    <link rel="stylesheet" href="styles.css" type="text/css" />
    <title>Chess Online</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <%
         if (Strings.dbCheckSession(request))
              if(request.getParameter("error")!=null && request.getParameter("error").equals("opponentQuit"))
                   out.println("<br /><br />"+request.getParameter("error"));
              out.println("<table border=\"0\" align=center>");
              out.println("<tr><td rowspan=\"2\">");
              drawJoinGameForm(out,application);
              out.println("<br /><p>As soon as you join, your opponent, who is hosting the game, is on the move and your browser is waiting/loading.</p>");
              out.println("</td><td>");
              drawHostGameForm(out);
              out.println("</td><td>");
              drawCancelForm((String)session.getAttribute("sessionUser"),out);
              out.println("</td></tr>");
              out.println("<tr><td align=\"right\" colspan=\"2\">");
              out.println("<p>After hosting a game by clicking on the button 'Host New Game' your browser will be in process of loading a page."
              +" As soon as an opponent joins your game you will be able to make the first move. If you do not wish to wait any longer for "
              +"an opponent to join - click on 'Cancel Game'.</p>");
              out.println("</td></tr>");
              out.println("</table>");
         else response.sendRedirect(response.encodeURL("/jsp/index.jsp"));
    %>
    </body>
    </html>
    -----------------------------------end of chessOnline.jsp--------------------------------------------------
    I also have a Read.class - its name doesn't mean anything - I have stored some out.println(); operations there - drawDesk(...), drawQuitForm(...), drawInfoForm(...) etc.
    MY PROBLEM IS: THE SECOND TIME THE HOST PLAYS A MOVE HIS OPPONENT GETS A NULL INSTEAD OF VALID Game OBJECT. CAN ANYONE TELL ME WHY BECAUSE I HAVEN'T SET IT TO NULL ANYWHERE IN THE CODE

    This forum is about JMS, NOT JSP!!!

Maybe you are looking for