Advertisement

07.02.2007 at 11:02PM PDT, ID: 22672201
[x]
Attachment Details

Java Servlet Open New Window

Asked by bangviz in Java Programming Language, Java Servlets

Tags: new, window, servlet, open, java

Hi,

I'm trying the following can anyone advice on the existing code.

1) open this page in a new window but for some reason it does not do that
   Instead it opens in the same.
   
2) Here I'm trying to get the URL from the prop file using the TranManager class.
   String URL = trans.getProperty("URL");
   (Where  URL on the prop file is ,   URL= https://www.hotmail.com/login.asp)
      
   but this does not work if I change to the following
   out.println("<form name=\"MyForm\" method=\"post\" action=\"URL">");
   How do i  pass the string value to my form action

   
public class LoginServlet extends ServletUtility {
      
      Cache cache = Cache.getInstance();
      TranManager trans = TranManager.getInstance();
      
      public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
                  resp.setContentType("text/html");
                  resp.setHeader("Cache-Control","no-store");
                  ServletOutputStream out = resp.getOutputStream();
                  String IdString = getId(req);
                  Para en = (Para)cache.getItem(IdString);
                  
                  String token = null;
                        displayPage(token, req, resp, out);
                  } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                  }
      }


      private void displayPage(String token, HttpServletRequest req, HttpServletResponse resp, ServletOutputStream out) throws IOException{
            
            //Here I'm trying to get the URL from the prop file using the TranManager class
            String URL = trans.getProperty("URL");
            
//            out.println("<html>");
//            out.println("<head>");
//            out.println("</head>");


            out.println("<body onload=\"document.MyForm.submit()\">");
            out.println("Please Wait...");
            //out.println("<form name=\"MyForm\" method=\"post\" action=\"URL">");
            out.println("<form name=\"MyForm\" method=\"post\" action=\"https://www.hotmail.com/login.asp">");
            out.println("<input type=\"hidden\" name=\"Token\"  value=\"New Window\" onClick=\"window.open(out.print(token))\">");
            out.println("</form>");
            out.println("</body>");
//            out.println("</html>");
            
      }
      
      
}


Regs
bangvizStart Free Trial
[+][-]07.02.2007 at 11:05PM PDT, ID: 19409014

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 11:38PM PDT, ID: 19409126

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 11:47PM PDT, ID: 19409162

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2007 at 12:13AM PDT, ID: 19409271

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Java Servlets
Tags: new, window, servlet, open, java
Sign Up Now!
Solution Provided By: harsha_dp
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.03.2007 at 12:39AM PDT, ID: 19409375

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2007 at 03:45PM PDT, ID: 19415384

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2007 at 10:36PM PDT, ID: 19416698

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.03.2007 at 10:39PM PDT, ID: 19416713

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2007 at 09:29PM PDT, ID: 19667710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32