[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Not running in JSP script

If you see the attach code when the run reach to line
  if (lang.toUpperCase() == "AR")
stopped

But when I remove if statement and write this
   String url = "imfIdentifyDefault.jsp"
   + "?loid=" + activeLayer.getObjectId()
   + "&lyr=" + activeLayer.getId();

running fine.

What the problem with if statement ?
function startup()
 {
<%
  if (buffer != null) {
    AimsEnvelope bufferExtent = buffer.getExtent();
    if ((bufferExtent.getWidth() > 0.0) && (bufferExtent.getHeight() > 0.0)) {
      map.setExtent(bufferExtent);
    }
    out.println("parent.frames['mapFrame'].refreshMap();");
  }
  boolean printed = false;
  var lang ="<%= strLanguageSession %>"; 
  if (lang.toUpperCase() == "AR")
  	{ 
    	String url = "imfIdentifyDefault.jsp"
        + "?loid=" + activeLayer.getObjectId()
        + "&lyr=" + activeLayer.getId();
    }
  else
  	{
    	String url = "imfIdentifyDefault.jsp"
        + "?loid=" + activeLayer.getObjectId()
        + "&lyr=" + activeLayer.getId();      
  	}  
	//String strLanguageSession2 = (String) session.getAttribute("strLanguage") == null? "" : (String) session.getAttribute("strLanguage");
	//if (strLanguageSession2.equals("AR"))	
		//{  
    		//String url = "imfIdentifyDefault.jsp"
            //+ "?loid=" + activeLayer.getObjectId()
            //+ "&lyr=" + activeLayer.getId();
		//}
	//else
		//{
    		//String url = "imfIdentifyDefault.jsp"
            //+ "?loid=" + activeLayer.getObjectId()
            //+ "&lyr=" + activeLayer.getId();		
		//}
%>
}

Open in new window

0
bworld
Asked:
bworld
2 Solutions
 
Ajay-SinghCommented:
Change

if (lang.toUpperCase() == "AR")

to

if (lang.toUpperCase().equals("AR"))
0
 
Ryan ChongCommented:
to prevent null value, you can always try like this instead...

if ("AR".equals(lang.toUpperCase()))
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now