Solved

source a request.getParameter in method

Posted on 2004-10-28
193 Views
Last Modified: 2010-04-01
Hi,
I'm new to all this, but  I want to source a param in this but it errors on the request.getParam.
What do I need to do??

<%!
// Builds include filename for localization
private String includeLocArrays() throws Exception {

      String inc_name = "test";
      String fileExt = ".inc";
        String countryCode = request.getParameter("lang");

      if (countryCode == null){
            countryCode = "-DA";
      }
            
      inc_name += countryCode + fileExt;
       return inc_name;
}
%>
0
Question by:894359
    2 Comments
     
    LVL 8

    Expert Comment

    by:kiranhk
    is the request coming to this jsp from another jsp?? if yes, check if the other jsp is setting a parameter lang??
    0
     
    LVL 13

    Accepted Solution

    by:
    transfer this function to a Java Class

    Class MyUtil
    {
     public String includeLocArrays(HttpRequest request) throws Exception {

         String inc_name = "test";
         String fileExt = ".inc";
            String countryCode = request.getParameter("lang");

         if (countryCode == null){
              countryCode = "-DA";
         }
             
         inc_name += countryCode + fileExt;
          return inc_name;
     }
    }

    and then call it from ur Jsp
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Phishing is at the top of most security top 10 efforts you should be pursuing in 2016 and beyond. If you don't have phishing incorporated into your Security Awareness Program yet, now is the time. Phishers, and the scams they use, are only going to …
    This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now