Import javax.microedition.io.HttpConnection times out

Hello,
This is in a BlackBerry JDE application.
The call to 'openInputStream' always times out, as does,
connection.getResponseCode(); or
connection.getType();
try {
String URL = "http://www.google.com/index.html";
HttpConnection connection = (HttpConnection)Connector.open(URL);
connection.setRequestMethod(HttpConnection.GET);
InputStream is = connection.openInputStream(); // this times out
catch (Exception exc) {
String s = exc.getMessage();
Any ideas? Thanks.

not so much the import part, I copied the package include declaration to get the full name.

Similar Messages

  • Import javax.microedition.io.*; prob's

    Hello,
    Probably a stupid question but i really need help!!
    I've installed the jsme-wireless_toolkit-2_0-linux-1386.bin and that contains a file microedition, i want to be able a small wireless web-service from JBuilder but it needs the import javax.microedition.io.*;
    How can I import this ??
    Complete newb to programming so I'd really appreciate some help!!
    Thanks

    Note::my OS is Linux Mandrake 9.0
    So when i go to JBuilder and go tools, configure the jdk, add, I then select the microedition folder from my directory, this does nothing i still get the same errors? I downloaded a self extracting binary so can't add that any other ideas.
    Really really really need to get this sorted ASAP
    thanks

  • ADF Mobile Client : Error while trying to import javax.microedition.*

    Hi,
    JDev throws errors at compile time when I try to deploy a sample ADF Mobile Client application.
    These errors are related to javax.microedition.io.* imports.
    Error(11,29): package javax.microedition.io does not exist
    Error(12,29): package javax.microedition.io does not exist
    Error(180,9): cannot find class HttpConnection
    Error(191,27): cannot find class HttpConnection
    Error(191,42): cannot find variable Connector
    Error(250,49): inconvertible types
    Error(303,40): cannot find variable HttpConnection
    Any pointers as to how these errors could be resolved?
    Is there a JDev Wireless extension that should be installed to resolve these J2ME related errors?
    For JDev 10g, I could locate one such extension called JWE here : http://www.oracle.com/technology/products/iaswe/archive/developer/index.html
    I could not find any similar extension for JDeveloper 11.1.3.
    Regards,
    Prasad.

    Hi, just want to make sure - did you install the ADF MObile Client extension yet? Please go to JDev-Help-Check for Updates-Official Oracle Extensions and Updates, and find Oracle ADF MObile Client Extension in the list. Check it, download it, and then restart JDev. Sounds like the extension was not installed, so it's not able to load any J2ME libraries.
    If you have downloaded the extension already, please go to project properties-libraries and classpath, and then see if the sample app is referencing some third party libraries, for example something from RIM. If so, please double check the path to the library.
    Once you installed the extension, you can also access the ADF Mobile Client developer guide - it contains all the documentation around what you need to install first. Please take a look and see what you need to install - at a minimum, you need to install BlackBerry JDE if you want to deploy to BlackBerry, and Windows Mobile Emulator if you want to test the app on Windows Mobile. Lastly, if you need to synchronize data, then you also need Oracle Database Lite MObile Server installation.
    Thanks,
    Joe Huang

  • Getting error javax.microedition.rms.RecordStoreException

    Hello ..
    I am create records in RMS .. and some time i am getting error like ..
    javax.microedition.rms.RecordStoreException: error finding first fit block
    at javax.microedition.rms.RecordStore.allocateNewRecordStorage(+76)
    at javax.microedition.rms.RecordStore.addRecord(+65)
    i dont knw why this error is coming and it comes some time not always .. any idea what is the problem with that .. ??

    i just added ur code to simple midlet, its working fine.
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.rms.*;
    public class Test extends MIDlet
         public Display display;
         public Test()
         try
         display = Display.getDisplay(this);
         catch(Exception e)
         Form form;
         public void startApp()
         form = new Form("Test");
         display.setCurrent(form);
         Store();
         retive();
         RecordStore _rs;
         public void Store()
         try
         byte[] data = "abcd".getBytes();
         if(_rs==null)
         _rs = RecordStore.openRecordStore("x", true);
         _rs.addRecord(data, 0, data.length);
         catch(Exception e)
         System.out.println("e "+e.toString());
         public void retive()
         try
         String temp =new String(_rs.getRecord(1));
         form.append(temp);
         }catch(Exception e)
         public void pauseApp()
         public void destroyApp(boolean unconditional)
    }

  • Javax.microedition.lcdui.TextField.setChars exception

    Hi
    I am developing an application for Mobile Banking for my College Project the program need to send an SMS with the Name and PIN no. I am using Sun WTK 2.3 the program compiles and preverifies correctly but when the Submit button is pressed an Illegal exception is thrown.
    java.lang.IllegalArgumentException
         at javax.microedition.lcdui.TextField.setChars(+105)
         at javax.microedition.lcdui.TextField.setString(+27)
         at CheckBal.commandAction(+157)
         at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
         at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
         at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
         at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
         at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)
    This is the code.....
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.IOException.*;
    import javax.microedition.io.*;
    import javax.wireless.messaging.*;
    public class CheckBal extends MIDlet implements CommandListener
    private Form form;
    private Command exit;
    private Command submit;
    private Display display;
    TextField t1;
    TextField t2;
    public CheckBal()
    display = Display.getDisplay(this);
    exit = new Command("Exit", Command.EXIT, 1);
    submit = new Command("Submit", Command.OK, 1);
    form = new Form("Check Balance");
    public void startApp()
    t1 = new TextField("First Name:", "",30, TextField.ANY);
    t2 = new TextField("Enter PIN:", "",4, TextField.ANY);
    form.addCommand(exit);
    form.addCommand(submit);
    form.append(t1);
    form.append(t2);
    form.setCommandListener(this);
    display.setCurrent(form);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command command, Displayable displayable)
    if (command == exit)
    destroyApp(false);
    notifyDestroyed();
    if (command == submit)
    try{
    try{
    String s1 = t1.getString();
         String s2 = t2.getString();
         String s3 = s1+s2;
    MessageConnection conn = (MessageConnection)Connector.open("sms://:+919412130071");
         TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
         msg.setPayloadText(s3+ " Balance");
         conn.send(msg);
    } catch(Exception e) {
    t1.setString(e.toString());
         e.printStackTrace();
    catch(Exception ee) {
    t2.setString(ee.toString());
    catch(Error ee) {
    t2.setString(ee.toString());
    }

    Once again: you might want to look at some examples that are already out there.
    The IllegalArgumentException is throws in the midlet, judging by the stacktrace, so saying it orriginates from the servlet is not possible.
    Please do some more debugging. Check what you are sending, getting back and print some stuff in logs...
    Make sure the servlet works first: test it simply in your webbrowser, then try to get the midlet working.
    One tip: never count on length beeing more than -1, so simply do not use it!
    InputStream in = ...
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    byte[] buffer = new byte[512];
    int bs;
    while((bs = in.read(buffer)!=-1){
       bout.write(buffer,0,bs);
    String response = bout.toString();Much faster and works always.

  • Package javax.microedition.midlet does not exist

    Hi:
    I am trying to run the Currency Converter MIDlet. I am using SUnONE4. I have got all the updates for the SUN ONE. When I compile the Converter directory.. i get the following errors.. which indicate that it can't find the javax.micoredition..packages.
    converter/ConverterMIDlet.java [11:1] package javax.microedition.midlet does not exist
    import javax.microedition.midlet.*;
    ^
    converter/ConverterMIDlet.java [12:1] package javax.microedition.lcdui does not exist
    import javax.microedition.lcdui.*;
    ^
    converter/ConverterMIDlet.java [13:1] package javax.microedition.rms does not exist
    import javax.microedition.rms.*;
    I havem't downloaded the J2ME since i presume that i don't need it since i have updated SunONe. There inside the SUNone i can see under the Device Emulator registory the J2ME wireless toolkit.
    Can anyon ehelp please.

    make sure you have the microedition classes are in your classpath
    --Senthil                                                                                                                                                                                   

  • Javax.microedition.lcdui   &   javax.microedition.midlet.MIDlet

    When I import the following statements i got an error that the library does not exist (either in eclips or netbeans):
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    I have installed the "Wireless Toolkit 2.5.2", but the problem is still exist.
    Any advice what should do??
    Thanks you in advance.

    Post in the correct forum. Either an Eclipse or NetBeans forum (most probably where you should post) or in one of the Java Mobility forums here:
    http://forum.java.sun.com/category.jspa?categoryID=22

  • Package javax.microedition.media does not exist

    package javax.microedition.media does not exist
    import javax.microedition.media.*;
    Please tell me why this error occurs.Is it due to midlet version?

    Have you specified the correct setting for your MIDlet project? Note that javax.microedition.media (MMAPI) has been introduced in MIDP2.0.
    Cheers

  • Javax.microedition.location does not exist

    Hello everyone. I am new to J2ME development and having problems trying to compile some code. Here's the error message I keep getting:
    package javax.microedition.location does not exist
    import javax.microedition.location.*;
    I really don't know how to correct this. I've tried to download jsr179, but don't know where to put. Please help. Thanks.

    WTK 2.2 looks pretty old to me (released in 2005). It does not support location (jsr 179) -- this jsr is not listed at their download page http://java.sun.com/products/sjwtoolkit/download-2_2.html
    As for WTK 2.5.2, it works fine for me on WinXP with Java 5 Update 7 (jdk1.5.0_07). *) I did not try it with Java 6
    Given that you're already familiar with WTK, I think the safe way to start with location is to do it with WTK 2.5.2. They even provide a reference demo ("apps/CityGuide") which uses location API and is supposed to be buildable / usable.
    *) download page for JDK 1.5.0_07 is http://java.sun.com/products/archive/j2se/5.0_07/

  • In compileng time this class not found import javax.media.jai.JA

    Hi,
    I�m download
    jai_imageio-1_0_01-lib-windows-i586
    jai_imageio-1_0_01-lib-windows-i586-jdk
    jai_imageio-1_0_01-lib-windows-i586-jre
    jdk-1_5_0_02-windows-i586-p
    in compel time
    import com.sun.media.jai.codec.*;
    import javax.media.jai.JAI;
    The complier gave me error class not found
    How can i configured my system
    I have Windows XP
    [email protected]

    try compiling like this:
    java -cp "." myTest
    This is not compiling, here you execute the already
    compiled myTest.java file (or it should be already
    compiled). To compile you may want to use javac or any
    other available compiler.Oops, sorry, I didn't mean compiling.
    If you were able to compile ok, you can try running the program by using:
    java -cp "." myTest
    This usually will solve the problem when your program comples fine but can't find the class when you try to run it. It's almost like the compiler assumes to look in the current directory but the VM (java.exe) doesn't make this assumption.

  • Mb51 ; time-outs, important cpu costs

    Hello,
    Every day, users running transaction MB51 on the production system (ecc6, Oracle 10.2.0.4) are facing time-out issues (1200 sec).
    I had a look at the execution plan, there are important CPU costs, since this a sap standard transaction, I wanted some advice ;
    The statisctics are up to date both for the tables and the indexes
    SELECT STATEMENT ( Estimated Costs = 916 , Estimated #Rows = 0
           5 NESTED LOOPS
             ( Estim. Costs = 915 , Estim. #Rows = 2.383 )
             Estim. CPU-Costs = 9.314.135 Estim. IO-Costs = 914
               2 TABLE ACCESS BY INDEX ROWID MSEG
                 ( Estim. Costs = 438 , Estim. #Rows = 2.383 )
                 Estim. CPU-Costs = 5.052.644 Estim. IO-Costs = 438
                   1 INDEX RANGE SCAN MSEG~M
                     ( Estim. Costs = 5 , Estim. #Rows = 2.383 )
                     Search Columns: 5
                     Estim. CPU-Costs = 132.111 Estim. IO-Costs = 5
                     Access Predicates
               4 TABLE ACCESS BY INDEX ROWID MKPF
                 Estim. CPU-Costs = 1.788 Estim. IO-Costs = 0
    Table   MSEG
    Last statistics date                  05.03.2012
    Analyze Method               Sample 395.660 Rows
    Number of rows                        39.566.000
    Number of blocks allocated             4.205.760
    Number of empty blocks                         0
    Average space                                  0
    Chain count                                    0
    Average row length                           680
    Partitioned                                   NO
    UNIQUE     Index   MSEG~0
    Column Name                     #Distinct
    MANDT                                          1
    MBLNR                                    483.630
    MJAHR                                          3
    ZEILE                                        476
    Last statistics date                  05.03.2012
    Analyze Method               Sample 386.574 Rows
    Levels of B-Tree                               3
    Number of leaf blocks                    195.500
    Number of distinct keys               38.657.400
    Average leaf blocks per key                    1
    Average data blocks per key                    1
    Clustering factor                      5.744.200
                   3 INDEX UNIQUE SCAN MKPF~0
                     Search Columns: 3
                     Estim. CPU-Costs = 210 Estim. IO-Costs = 0
                     Access Predicates
    NONUNIQUE  Index   MSEG~M
    Column Name                     #Distinct
    MANDT                                          1
    MATNR                                     16.601
    WERKS                                         29
    LGORT                                         38
    BWART                                         52
    SOBKZ                                          5
    Last statistics date                  05.03.2012
    Analyze Method               Sample 394.562 Rows
    Levels of B-Tree                               3
    Number of leaf blocks                    379.900
    Number of distinct keys                   16.601
    Average leaf blocks per key                   70
    Average data blocks per key                6.681
    Clustering factor                     35.901.000
    NONUNIQUE  Index   MSEG~R
    Column Name                     #Distinct
    MANDT                                          1
    RSNUM                                    192.208
    Last statistics date                  05.03.2012
    Analyze Method               Sample 369.922 Rows
    Levels of B-Tree                               3
    Number of leaf blocks                    139.100
    Number of distinct keys                  404.600
    Average leaf blocks per key                    1
    Average data blocks per key                   15
    Clustering factor                      6.151.600
    NONUNIQUE  Index   MSEG~S
    Column Name                     #Distinct
    SMBLN                                        528
    SJAHR                                          4
    SMBLP                                        150
    Last statistics date                  05.03.2012
    Analyze Method               Sample 396.865 Rows
    Levels of B-Tree                               3
    Number of leaf blocks                    182.300
    Number of distinct keys                      582
    Average leaf blocks per key                  313
    Average data blocks per key                7.110
    Clustering factor                      4.138.300

    Table   MKPF
    Last statistics date                  05.03.2012
    Analyze Method                Sample 73.955 Rows
    Number of rows                         2.465.167
    Number of blocks allocated                70.524
    Number of empty blocks                         0
    Average space                                  0
    Chain count                                    0
    Average row length                           142
    Partitioned                                   NO
    NONUNIQUE  Index   MKPF~BUD
    Column Name                     #Distinct
    MANDT                                          1
    BUDAT                                        539
    MBLNR                                  2.465.167
    Last statistics date                  05.03.2012
    Analyze Method               Sample 219.184 Rows
    Levels of B-Tree                               2
    Number of leaf blocks                     12.750
    Number of distinct keys                2.499.699
    Average leaf blocks per key                    1
    Average data blocks per key                    1
    Clustering factor                      1.306.222
    NONUNIQUE  Index   MKPF~Z01
    Column Name                     #Distinct
    MANDT                                          1
    XBLNR                                     43.025
    Last statistics date                  05.03.2012
    Analyze Method               Sample 169.933 Rows
    Levels of B-Tree                               2
    Number of leaf blocks                     15.780
    Number of distinct keys                  462.223
    Average leaf blocks per key                    1
    Average data blocks per key                    1
    Clustering factor                        587.177
    UNIQUE     Index   MKPF~0
    Column Name                     #Distinct
    MANDT                                          1
    MBLNR                                  2.465.167
    MJAHR                                          3
    Last statistics date                  05.03.2012
    Analyze Method               Sample 225.313 Rows
    Levels of B-Tree                               2
    Number of leaf blocks                     10.044
    Number of distinct keys                2.274.411
    Average leaf blocks per key                    1
    Average data blocks per key                    1
    Clustering factor                      1.149.849
    *And here is the standard abap coding responsible
    *SAP include
    *RM07DOCS_GENERATED
    *FORM DATA_SELECTION .     "#EC CALLED
    * Data selection routine for standard access
    * process SELECT command depending on the
    * required material selection
      if  g_cnt_matnr_total  > 0                 and
          g_cnt_matnr_total  = g_cnt_matnr_i_eq.
    *   work with .. for all entries ...
        select (g_t_fields)
        into corresponding fields of table itab
        from mkpf inner join mseg
        on    mkpf~mandt = mseg~mandt
          and mkpf~mblnr = mseg~mblnr
          and mkpf~mjahr = mseg~mjahr
        for all entries in matnr
        where matnr = matnr-low
          and MKPF~BUDAT in BUDAT
          and MSEG~BWART in BWART
          and MSEG~CHARG in CHARG
          and MSEG~KUNNR in KUNNR
          and MSEG~LFBNR in LFBNR
          and MSEG~LGORT in LGORT
          and MSEG~LIFNR in LIFNR
          and MSEG~SOBKZ in SOBKZ
          and MKPF~USNAM in USNAM
          and MKPF~VGART in VGART
          and MSEG~WERKS in WERKS
          and MKPF~XBLNR in XBLNR
    %_HINTS
    ORACLE '&SUBSTITUTE VALUES&'
      else.
    *   wor

  • Custom Class file errors out on import javax.servlet.http.HttpSession

    I am trying to write a class file to handle events. This is a test class file copied from the UIX Docs. When I put this in JDeveloper 903 ,and build it the compiler gives the error:
    Error(2,27): cannot access class javax.servlet.http.HttpSession; file javax\servlet\http\HttpSession.class not found
    I am not sure what is the problem? Can anyone please help?
    Here is the code:--
    package mypackage1;
    import javax.servlet.http.HttpSession;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.event.PageEvent;
    import oracle.cabo.servlet.event.EventResult;
    public class MyClass
    /** This is handleStoreNameEvent version 1 */
    public static EventResult handleStoreNameEvent(BajaContext context,
    Page page,
    PageEvent event)
    String userName = event.getParameter("txt1");
    HttpSession session = context.getServletRequest().getSession(true);
    session.putValue("User Name", userName);
    Page nextPage = new Page("NextPage");
    return new EventResult(nextPage);
    }

    Hi, you are missing the servlet.jar file from your classpath.
    In JDeveloper, you can add this by opening up your project -> libraries and adding the servlet runtime library.

  • Session Time Out For UNLOGGED IN USER During Search -pls help SIR!

    Hi,
    The problem lies in searchresultscontroller.java/searchcontroller.java file under search/web/handler of an application that supports educational note sharing.
    The problem is that -
    When I search with query strings in different fields(as you will find in the above mentioned java files)..the keywords in resourcedto and get some files as search results.
    Then I click on one of the file from within the search result and visit the file.
    Here if I m logged in as an user, and the session time out is set to 1 minute in the web.xml file of the web folder not the admin folder then when I hit the BACK TO SEARCH button it easily goes back to the previous search result page along with the queries string that I had input previously.
    The problem is that when I m NOT LOGGED in as an user, and I've performed a search with queries and other dropdowns in the search panel, I get the search result page, I visit the file by clicking on one of them but when I hit the BACK TO SEARCH button I don't see the previous search result page from where I had navigated to view the file.
    Please suggest on what changes shall I make in the code so that even if I m not logged in as an user, I get back to the search result page on hitting the BACK TO SEARCH button from the file view page.Sir I m herein pasting the code of the searchresultscontroller.java file, but please feel free to ask for anyother file whose code you might want to see.SEARCHRESULTSCONTROLLER.JAVA FILE CONTENT-
    package com.mgh.sps.search.web.handler;
    import java.util.Map;
    import java.util.regex.Pattern;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.springframework.validation.BindException;
    import org.springframework.validation.Errors;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import com.mgh.sps.search.business.facade.Search;
    import com.mgh.sps.common.dto.ResourceDTO;
    import com.mgh.sps.common.util.SessionAttributeKey;
    import com.mgh.sps.common.util.SessionManager;
    import com.mgh.sps.fileusage.web.constants.FileUsageWebConstants;
    public class SearchResultsController extends SimpleFormController {
    * SearchResults Controller
    * @author Muralikrishna.s
    * @Codedondate DD-MM-YY=26-07-07
    * @Usecase/s associated =UC504
    private static final Logger logger = Logger
    .getLogger(SearchResultsController.class.getName());
    private final static String REG_EXP = "^[A-Za-z0-9]*$";
    private final static Pattern EMAIL_PATTERN_REG = Pattern.compile(REG_EXP);
    * Spring framework method used to hold reference data
    * @param request
    * HttpServletRequest
    * @param command
    * Object
    * @param arg2
    * Errors
    * @return Map
    * @throws Exception
    @Override
    protected Map referenceData(HttpServletRequest request, Object command,
    Errors errors) throws Exception {
    logger.debug("SearchResultsController.referenceData() method entered:"
    + request + "," + command + "," + errors);
    SessionManager.setSessionAttribute(SessionAttributeKey.tabIndex,
    FileUsageWebConstants.TAB_SEARCH, request);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    ResourceDTO resourceDto = (ResourceDTO) command;
    String[] allValues = new String[7];
    if (null != (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request)) {
    allValues = (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request);
    resourceDto.setKeywords(allValues[0]);
    resourceDto.setCountry(allValues[1]);
    resourceDto.setUniversityName(allValues[2]);
    resourceDto.setSubjectArea(allValues[3]);
    resourceDto.setQualification(allValues[4]);
    resourceDto.setYearLevel(allValues[5]);
    resourceDto.setSpecificType(allValues[6]);
    logger.debug("%%%%%%%%%%%%%%%%%qualification%%%%%%%%%%%%%%%"
    + resourceDto.getQualification());
    String flag = (String) request.getParameter("id");
    resourceDto.setFlag(flag);
    logger.debug("SearchResultsController.referenceData() method exited:");
    return search.retrieveReferenceData(resourceDto);
    * Spring framework method used to hold OnSubmit
    * @param request
    * HttpServletRequest
    * @param response
    * HttpServletResponse
    * @param command
    * Object
    * @param arg3
    * BindException
    * @return ModelAndView
    * @throws Exception
    @Override
    protected ModelAndView onSubmit(HttpServletRequest request,
    HttpServletResponse response, Object command, BindException errors)
    throws Exception {
    SessionManager.cleanup(request);
    logger.debug("SearchResultsController.onSubmit() method entered:"
    + request + "," + command + "," + response + "," + errors);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    Map dynamic = (Map) getServletContext().getAttribute("config");
    ResourceDTO resourceDto = (ResourceDTO) command;
    SessionManager.removeSessionAttribute(SessionAttributeKey.allValues,
    request);
    //changed by sreelatha on sep21
    //resourceDto.setKeywords(request.getParameter("keywords"));
    //String key = request.getParameter("keywords");
    //logger.debug("&&&&&&&&&&&&& key &&&&&&&&&&&&" + key);
    String keywords = (request.getParameter("keywords"));
    if(null!=keywords) {
    keywords = keywords.trim();
    resourceDto.setKeywords(keywords);
    // changes end
    resourceDto.setUniversityName(request.getParameter("universityName"));
    resourceDto.setSubjectArea(request.getParameter("subjectArea"));
    resourceDto.setCountry(request.getParameter("country"));
    resourceDto.setQualification(request.getParameter("qualification"));
    resourceDto.setYearLevel(request.getParameter("yearLevel"));
    resourceDto.setSpecificType(request.getParameter("specificType"));
    String[] allValues = new String[7];
    //changed by sreelatha on sep21
    //allValues[0] = request.getParameter("keywords");
    allValues[0] = resourceDto.getKeywords();
    //changes end
    allValues[1] = request.getParameter("country");
    allValues[2] = request.getParameter("universityName");
    allValues[3] = request.getParameter("subjectArea");
    allValues[4] = request.getParameter("qualification");
    allValues[5] = request.getParameter("yearLevel");
    allValues[6] = request.getParameter("specificType");
    SessionManager.setSessionAttribute(SessionAttributeKey.allValues,
    allValues, request);
    if(null!=keywords) {
    keywords = keywords.trim();
    String words="";
    for(int i=0;i<keywords.length();i++) {
    String key=String.valueOf(keywords.charAt(i));
    if(key.contains("*")) {
    key = key.replace("*"," ");
    } else if(key.contains("?")) {
    key = key.replace("?"," ");
    } else if(key.contains("[")) {
    key = key.replace("["," ");
    } else if(key.contains("{")) {
    key = key.replace("{"," ");
    } else if(key.contains("(")) {
    key = key.replace("("," ");
    } else if(key.contains(")")) {
    key = key.replace(")"," ");
    } else if(key.contains("+")) {
    key = key.replace("+"," ");
    } else if(key.contains("
    key = key.replace("
    } else if(key.contains(" ")) {
    key = key.replace(" "," ");
    } else if(key.contains("_")) {
    key = key.replace("","");
    } else if(!EMAIL_PATTERN_REG.matcher(key).matches()) {
    key = key.replaceAll(key," ");
    words = words + key;
    keywords = words;
    resourceDto.setKeywords(keywords);
    SessionManager.setSessionAttribute(SessionAttributeKey.test, search.setInputValues(resourceDto, dynamic), request);
    String name = (String) SessionManager.getSessionAttribute(SessionAttributeKey.tempName, request);
    String flag1 = request.getParameter("id");
    String status="";
    if (flag1 !=null && flag1.equals("loggedInUser"))
    if(name==null)
    return new ModelAndView();
    if (flag1 !=null && flag1.equals("loggedInUser")){
    status = "redirect:SearchResults.htm?id=loggedInUser";
    }else if(flag1 !=null && flag1.equals("nonLoggedInUser"))
    status = "redirect:SearchResultsnlu.htm?id=nonLoggedInUser";
    super.setSuccessView(status);
    ModelAndView mav = new ModelAndView(super.getSuccessView());
    logger.debug("SearchResultsController.onSubmit() method exited:");
    return mav;
    }

    Cross-posted in many forums. Don't answer this one.

  • Session Time Out For UNLOGGED USER During Search -pls help

    Hi,
    The problem lies in searchresultscontroller.java/searchcontroller.java file under search/web/handler of an application that supports educational note sharing.
    The problem is that -
    When I search with query strings in different fields(as you will find in the above mentioned java files)..the keywords in resourcedto and get some files as search results.
    Then I click on one of the file from within the search result and visit the file.
    Here if I m logged in as an user, and the session time out is set to 1 minute in the web.xml file of the web folder not the admin folder then when I hit the BACK TO SEARCH button it easily goes back to the previous search result page along with the queries string that I had input previously.
    The problem is that when I m NOT LOGGED in as an user, and I've performed a search with queries and other dropdowns in the search panel, I get the search result page, I visit the file by clicking on one of them but when I hit the BACK TO SEARCH button I don't see the previous search result page from where I had navigated to view the file.
    Please suggest on what changes shall I make in the code so that even if I m not logged in as an user, I get back to the search result page on hitting the BACK TO SEARCH button from the file view page.Sir I m herein pasting the code of the searchresultscontroller.java file, but please feel free to ask for anyother file whose code you might want to see.
    SEARCHRESULTSCONTROLLER.JAVA FILE CONTENT-
    package com.mgh.sps.search.web.handler;
    import java.util.Map;
    import java.util.regex.Pattern;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.springframework.validation.BindException;
    import org.springframework.validation.Errors;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import com.mgh.sps.search.business.facade.Search;
    import com.mgh.sps.common.dto.ResourceDTO;
    import com.mgh.sps.common.util.SessionAttributeKey;
    import com.mgh.sps.common.util.SessionManager;
    import com.mgh.sps.fileusage.web.constants.FileUsageWebConstants;
    public class SearchResultsController extends SimpleFormController {
         * SearchResults Controller
         * @author Muralikrishna.s
         * @Codedondate DD-MM-YY=26-07-07
         * @Usecase/s associated =UC504
         private static final Logger logger = Logger
                   .getLogger(SearchResultsController.class.getName());
         private final static String REG_EXP = "^[A-Za-z0-9]*$";
         private final static Pattern EMAIL_PATTERN_REG = Pattern.compile(REG_EXP);
         * Spring framework method used to hold reference data
         * @param request
         * HttpServletRequest
         * @param command
         * Object
         * @param arg2
         * Errors
         * @return Map
         * @throws Exception
         @Override
         protected Map referenceData(HttpServletRequest request, Object command,
                   Errors errors) throws Exception {
              logger.debug("SearchResultsController.referenceData() method entered:"
                        + request + "," + command + "," + errors);
              SessionManager.setSessionAttribute(SessionAttributeKey.tabIndex,
                        FileUsageWebConstants.TAB_SEARCH, request);
              Search search = (Search) super.getWebApplicationContext().getBean(
                        "searchfacade");
              ResourceDTO resourceDto = (ResourceDTO) command;
              String[] allValues = new String[7];
              if (null != (String[]) SessionManager.getSessionAttribute(
                        SessionAttributeKey.allValues, request)) {
                   allValues = (String[]) SessionManager.getSessionAttribute(
                             SessionAttributeKey.allValues, request);
                   resourceDto.setKeywords(allValues[0]);
                   resourceDto.setCountry(allValues[1]);
                   resourceDto.setUniversityName(allValues[2]);
                   resourceDto.setSubjectArea(allValues[3]);
                   resourceDto.setQualification(allValues[4]);
                   resourceDto.setYearLevel(allValues[5]);
                   resourceDto.setSpecificType(allValues[6]);
              logger.debug("%%%%%%%%%%%%%%%%%qualification%%%%%%%%%%%%%%%"
                        + resourceDto.getQualification());
              String flag = (String) request.getParameter("id");
              resourceDto.setFlag(flag);
              logger.debug("SearchResultsController.referenceData() method exited:");
              return search.retrieveReferenceData(resourceDto);
         * Spring framework method used to hold OnSubmit
         * @param request
         * HttpServletRequest
         * @param response
         * HttpServletResponse
         * @param command
         * Object
         * @param arg3
         * BindException
         * @return ModelAndView
         * @throws Exception
         @Override
         protected ModelAndView onSubmit(HttpServletRequest request,
                   HttpServletResponse response, Object command, BindException errors)
                   throws Exception {
              SessionManager.cleanup(request);
              logger.debug("SearchResultsController.onSubmit() method entered:"
                        + request + "," + command + "," + response + "," + errors);
              Search search = (Search) super.getWebApplicationContext().getBean(
                        "searchfacade");
              Map dynamic = (Map) getServletContext().getAttribute("config");
              ResourceDTO resourceDto = (ResourceDTO) command;
              SessionManager.removeSessionAttribute(SessionAttributeKey.allValues,
                        request);
              //changed by sreelatha on sep21
              //resourceDto.setKeywords(request.getParameter("keywords"));
              //String key = request.getParameter("keywords");
              //logger.debug("&&&&&&&&&&&&& key &&&&&&&&&&&&" + key);
              String keywords = (request.getParameter("keywords"));
              if(null!=keywords) {
                   keywords = keywords.trim();
              resourceDto.setKeywords(keywords);
    //          changes end
              resourceDto.setUniversityName(request.getParameter("universityName"));
              resourceDto.setSubjectArea(request.getParameter("subjectArea"));
              resourceDto.setCountry(request.getParameter("country"));
              resourceDto.setQualification(request.getParameter("qualification"));
              resourceDto.setYearLevel(request.getParameter("yearLevel"));
              resourceDto.setSpecificType(request.getParameter("specificType"));
              String[] allValues = new String[7];
              //changed by sreelatha on sep21
              //allValues[0] = request.getParameter("keywords");
              allValues[0] = resourceDto.getKeywords();
              //changes end
              allValues[1] = request.getParameter("country");
              allValues[2] = request.getParameter("universityName");
              allValues[3] = request.getParameter("subjectArea");
              allValues[4] = request.getParameter("qualification");
              allValues[5] = request.getParameter("yearLevel");
              allValues[6] = request.getParameter("specificType");
              SessionManager.setSessionAttribute(SessionAttributeKey.allValues,
                        allValues, request);
                   if(null!=keywords) {
                   keywords = keywords.trim();
                   String words="";
                   for(int i=0;i<keywords.length();i++) {               
                        String key=String.valueOf(keywords.charAt(i));
                        if(key.contains("*")) {
                                  key = key.replace("*"," ");
                             } else if(key.contains("?")) {
                                  key = key.replace("?"," ");
                             } else if(key.contains("[")) {
                                  key = key.replace("["," ");
                             } else if(key.contains("{")) {
                                  key = key.replace("{"," ");
                             } else if(key.contains("(")) {
                                  key = key.replace("("," ");
                             } else if(key.contains(")")) {
                                  key = key.replace(")"," ");
                             } else if(key.contains("+")) {
                                  key = key.replace("+"," ");
                             } else if(key.contains("\\")) {
                                  key = key.replace("\\"," ");
                             } else if(key.contains(" ")) {
                                  key = key.replace(" "," ");
                             } else if(key.contains("_")) {
                                  key = key.replace("_","_");
                             } else if(!EMAIL_PATTERN_REG.matcher(key).matches()) {
                                  key = key.replaceAll(key," ");
                        words = words + key;
                   keywords = words;
                   resourceDto.setKeywords(keywords);
              SessionManager.setSessionAttribute(SessionAttributeKey.test, search.setInputValues(resourceDto, dynamic), request);
              String name = (String) SessionManager.getSessionAttribute(SessionAttributeKey.tempName, request);
              String flag1 = request.getParameter("id");
              String status="";
              if (flag1 !=null && flag1.equals("loggedInUser"))
              if(name==null)
                        return new ModelAndView();
              if (flag1 !=null && flag1.equals("loggedInUser")){
                   status = "redirect:SearchResults.htm?id=loggedInUser";
              }else if(flag1 !=null && flag1.equals("nonLoggedInUser"))
                   status = "redirect:SearchResultsnlu.htm?id=nonLoggedInUser";     
              super.setSuccessView(status);
              ModelAndView mav = new ModelAndView(super.getSuccessView());
              logger.debug("SearchResultsController.onSubmit() method exited:");
              return mav;
    }

    Cross-posted in many forums. Don't answer this one.

  • Erorr " import javax.servlet.*"

    For every one!
    I use JDK1.4.0 to develope in Java . But when i study come to Servlet and when i import the library :
    "-----import javax.servlet.*---------"
    to explore the erorr that can't open this package. Now i don't know to answer this question.
    Can any one help me with this?
    Outside , these are some erorr for this , when i import this Package : Javax.servlet.*, ....
    Thanks for read my post.

    Here a direct answer to your question, cutting all the bullcraps that's meaningless to you, which other people told you on the forums you been looking at including this one:
    1. install j2ee, I think everyone is clear on that.
    2. there should be a page pop up after you finish the installation, and on top it says "Congratulations - You've Completed Installation!"
    3. If you don't see this page or you closed it b4 you realize you have a problem on the classpath, go to your j2ee folder and look under doc folder, it will be under the name (((((((about.html/htm))))))) whichever it is.
    4. Then look down about 20 lines including empty lines, there should be a link that says:
    "Your First Cup: An Introduction to the Java EE Platform: Provides detailed instructions for compiling and running your first program."
    If some varies from the instruction than your machine:
    1. make sure your system is compatiable with the version of java you installed, it will not run on some of the OS including some version of Windows last time i checked. XP and Vista should be okay i believe.
    2. recheck and make sure you done everything correctly.
    3. contact java support if there's one if you still think something is worng.
    (That's assuming you have no error messages while installing the program, if you not sure about that, reinstall it and note it carefully)
    And finally if you are too lazy to look through this instruction or still too dumb to figure this out:
    1. uninstall your j2ee.
    2. quit your job/school study/hobby as a programmer.
    3. choose a new job/school study/hobby.
    Took me 2 hours to figure this out while i'm watching youtube so shouldn't be hard once you find this step by step instruction.
    And also there's a lot of other goodies such as: Setting up a tomcat server, which got NOTHING to do with coding a java servlet page, it's a server you host the page on.
    And please read carefully on other people's comment before you reply so the person who wrote the original message won't be like "WTH is this guy talking about??$*@&!?"
    Good luck too you! :)

Maybe you are looking for