Converting a class for use in a jsp page.

I was just wondering if it is possible/normal to convert complex(ish) classes to change the output from the system.out, to a return value from a method that is displayed via a jsp page. (I am just beginning, and trying to make the coversion from asp with COM to jsp with beans/servlets and I am not yet fully understanding the technologies, and how you import classes etc - please bear with me!)
first, I made a class that has a method that just returns a string. like:
     public String GetAValue()
          return "Hello there.";
     }and then I made a jsp page that imported the class (test) like:
<%@ page import="Test" %>
<jsp:useBean id="tst" scope="page" class="Test" />
st = tst.GetAValue();
out.println(st);
Which to my delight, worked fine! Then I made another class that retrieved a value from a web service. kind of like...
     public String GetAValueFromAWebService(){
          return theWebService.GetValueFromWebServiceMethod();
     }This class also works good when I just run via "java testit". But when I went to do the same as above ,ie, import the class, do a usebean then do st=tst2.GetValueFromWebServiceMethod(), I could not get it to work at all. This class does lots more tricky stuff then the first one though - it loads its properties from a .properties file via an instance of another class, and imports funky stuff like - import org.uddi4j.* and import java.util.Vector; and more.
Ok, now the question! Is what I am trying to do stupid? If so, how should I do it? If its not stupid, how do I include all the extra import statements on the jsp page (there are about 10)
Wow, sorry about the length of this post. I hope someone can understand my ramblings!
Thanks,
nmoog.

Sorry, yeah...
I am actually using the UDDI4J package, and it loads various settings with the
config = Configurator.load(); (a seperate class to load stuff in with)
The Configurator.Load method basically just does:
config.load(new java.io.FileInputStream("samples.prop"));
and then does System.setProperty() with the config.getProperty()
values.
I have a test class when I do "java Test" it runs and in the Main method just instantiates the MyWebService class and does the MyWebService.GetAWebServiceValue() which returns a string.
As I said, this runs fine. But from the JSP code if I do the same thing it gets a NullPointerException.
"java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:389)
at java.util.Properties.setProperty(Properties.java:102)
at java.lang.System.setProperty(System.java:654)
at Configurator.load(Configurator.java:43)"
Why can it load okie-dokey from the test class, but not the jsp page? Any ideas?

Similar Messages

  • Plugin for eclipse for using log4j in jsp ?

    Hello all,
    Plz tell me is there any plugin (eclipse) for using log4j in jsp pages similar to log4e. As log4e is not working with jsp in Myeclipse
    Thanx

    Hello Prasad,
    I used log4e plugin to use log4j in eclipse. Its also working fine with servlets in eclipse. For working with web applications i installed MyEclipse. In this when i right click on the servlet editor log4e item is shown for automatic adding of log4j instructions(like adding logger etc) but when i try to use it by opening the jsp page log4e option is not in menu when right clicked. So i think for jsp seperate plugin is needed.
    What do u think.

  • 10.2 crashes when I try to convert old libraries for use in the new software. Is there a workaround for this? Or will i have to continue using the previous version to complete older projects?

    Final Cut Pro X 10.2 crashes when I try to convert old libraries for use in the new software. Is there a workaround for this? Or will I have to continue using the previous version to complete older projects? the only foreseeable solution is to begin any new projects on 10.2 or importing footage on 10.2 and starting form scratch--which is something i definitely don't want to do or have time to do. ANY advice, thoughts, or opinions would be greatly appreciated! Thank you!
    Running 10.10.3 // MacBook Pro (Retina, 15-inch, Early 2013) // 2.4 GHz Intel Core i7 // 8 GB 1600 MHz DDR3

    Exactly the same problem with me.
    Some other threads advice to remove fonts, clean the caches, remove add ins but nothing works consistenty, for some it looks like it works, for me it failed.
    What I did not try yet, was to move the Render files out of the malicious library to trash.

  • How do you convert .AVI files for using in iMovie without losing the original clip time and date

    Hi everyone! does anyone know how to convert .AVI files for using in iMovie without losing the original clip time and date? Handbrake, MPEG Streamclip and Evon all replace the original timecode with the date of modification. This is very frustrating when you are trying to keep the chronology right. I know that if you upload the files to iMovie from one device the chronology isn't a problem, but I'm adding video files from a couple of iPhones and a couple of camcorders. any help much appeciated.
    paul

    Hi everyone! does anyone know how to convert .AVI files for using in iMovie without losing the original clip time and date? Handbrake, MPEG Streamclip and Evon all replace the original timecode with the date of modification. This is very frustrating when you are trying to keep the chronology right. I know that if you upload the files to iMovie from one device the chronology isn't a problem, but I'm adding video files from a couple of iPhones and a couple of camcorders. any help much appeciated.
    paul

  • Convert vob files for use in FCP X

    I need to convert VOB files for use in FCP X on my macbookpro in OS X Lion (10.7.5) I use Clipwrap to convert other formats, but it does not seem to accept VOB for conversion (or if it does, I have not figured out how). In searching the web, I've come across several products that tout themselves as the best, fastest, easiest VOB to Prores converters etc., some that advertise as "free" when actually only a watermarked trial version is free. I have no idea of the actual quality of any of these (some examples are Brorsoft video converter for Mac, and Acrok HD Video Converter...), and would like some input from folks w/ experience in these things before dropping $ on the problem.
    In another thread on this site I read something about MPEG Streamclip, & something about needing to separately download an MPG2 converter for it w/ Lion or Mountain Lion - the process sounded confusing and I couldn't tell if it applied to my situation or not...
    Thanks in advance for any light anyone can shed.

    Midnighttrain wrote:
    …  MPEG Streamclip, & something about needing to separately download an MPG2 converter for it w/ Lion or Mountain Lion - the process sounded confusing …
    MpegStremclip is THE Swiss Army Knife, when it comes to conversion, a 100% reliable, it IS absolutely free (any download a dollar = Stefano would be a millionaire!), I dare to say it is THE most recommended 3d party tool in the editor community ....
    How & why you need to install the mp2 plug-in does Signore Cinque explain in simple words on his website:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html

  • Converting wmv files for use in imovie 9 for users who have pc

    To convert wmv files use your pc windows movie maker. (if you have one) On your pc, open windows movie maker, get collections and get your wmv project/video, drag it into the timeline, and then save in your computer, save it as an avi file and rename it. After send file to your memory card reader, that way you can transfer that file onto your mac!! And voila! I tried to email it but file became too large so transfering it to a memory card is the easiest. This took me days to figure out, I hope I have helped someone out there.....

    I don't want to use DV because these .m2t files are from an HDV camcorder and I want to preserve the aspect ratio and resolution in the files. What other "flavor" of HD would you suggest that I convert them to since (a) I can't bring the files into FCP6 or Compressor (b) I don't see any other flavors of HD to use in VisualHub.
    The whole business of converting .m2t files to a FCP6 compatible format, i.e. a Quicktime format, would seem to be one that is commonly encountered, and yet I have never found a thread on this forum that really answers this question: What is the best workflow for converting .m2t files for use in FCP? Surely, one of the pros who frequent this forum must have dealt with this issue and have an answer.
    I don't want to have to recapture the files from tape all over again just to use them in FCP6.
    Tom

  • Justifications needed for using tags in JSP, Please reply

    Hi forum
    My question is to those java people who have also done JSP. I m sound in java server side (servlet programming), now I have asked by my project manager to do server side programming in JSP using tagLibraries (as these are used by those ppl who didnt have much java knowledge). I have worked inserver side java, then my question is y should I start working on tags,
    On the other hand I can do all the work in java embedding in JSP (on some extent, seperated by diffrent helper/util classes to reduce the thickness of JSP page).
    so I want to ask u ppl that should a java programmer needs to use tag libraries to code a JSP page, however he can code it in java directly.
    I will feal great pleasure if u will write ur opinions and help me to ease my life.
    thanx in advance
    Best Regards
    Tahir

    You should use tag libraries whenever you can because:
    1) They increase code re-useability. You can insert the same tag in many pages using just a few lines to do complex tasks, as opposed to writing a lot of scriptlet code in each JSP.
    2) Enhance your ability to seperate logic from display. Everything in your tags is logic. Everything in your JSP is display - with the tags bridging the logic to the display.
    3) Make the JSPs cleaner and easier to maintain. They read easier with tags than with a lot of scriptlets. Non-java people can be used to update the look and feel of the web page, or to debug the HTML later on, relieving the Java programmers for the tag work, or other jobs more suited to them.
    4) Your boss said to do tags, so do tags.

  • Converting VOB Files For use in FCP

    Hello,
    I have a large FCP project using VOB files shot on a DVD Recorder.
    I have been been using a freeware called MPEG Streamclip to convert them into Quicktime Files for use with FCP7. The resulting QT files have all been very choppy when used in the FCP Timeline etc.
    I have options with this freeware to convert to MPEG, TS or export to Quicktime, DV, AVI, MPEG4 or other formats.
    Any suggestions on how to bring these VOB files into Final Cut Pro so that they work well.
    Thanks,
    Marc

    Nick's tutorial is good. Read it.
    I had been using Cinematize for this but would always have trouble with the aspect ratio.
    With MPEG Streamclip I have no problems if I do it this way:
    Export to QuickTime
    Change Compression to: Apple DV/DVCPro-NTSC
    Quality: 100%
    Frame Size: 720x480 (DV-NTSC)
    Sound: Uncompressed (the default)
    Make Movie
    I do a preset of the above.
    Now, when you take that resultant file into FCP:
    In FCP make sure your sequence set-up is DV anamorphic (if footage is anamorphic/16:9). When you bring that file into FCP it will not be flagged as anamorphic. In the browser scroll over and check mark it as anamorphic. NOW drag into the timeline. Aspect ratio is good if you do it this way.
    Sharon

  • Converting WMA files for use in Logic

    How do convert .wma files recorded on an Olympus Voice recorder for use in Logic? I can play the files with Flip4 Mac but Logic does not recognise them when you try to import?
    Cheers
    MS

    You're welcome.
    I forgot to mention there's another good utility [All2MP3|http://download.cnet.com/All2MP3/3000-2140_4-190407.html] which is free, but only converts to mp3.

  • Converting .avi files for use on ipad without using a laptop

    Hi, I have a head cam (for use on the slopes and on my bike) that records .avi files to an sd card.  I was wanting to know before I buy the sd connector for the ipad if there is any easy way (I appreciate that there are some complicated ways) to convert then edit the video with a movie editor.  I was thinking about buying iMovie but I understand it doesn't recognise .avi files so would need to convert them beforehand - I don't intend to take my laptop though so need to do it all on the ipad - qu therefore is can it be done, in a simple straightforward way, with full knowledge that I am not a techie ?

    Here is an article that will help you and has links to some software to help convert your wma files to a usable format.
    http://www.everymac.com/systems/apple/consumerelectronics/ipodfaq/ipod-supported-music-formats-good-sound-quality.html

  • Error while accessing remote server using applet in jsp page

    hii..
    We are accessing a data repository MDSPlus. Its used for storing data such as signals in tree like structure. We r coding for client side in JSP .
    For this we are invoking applet which uses jar files of jScope(java tool for displaying waveforms). We r getting the following error when we try to access a remote server in network. But it works fine with local server.
    So kindly help .
    ERROR IS:
    java.security.AccessControlException:access denied(java.net.SocketPermission 202.41.112.140:8000 connect,resolve)
    url mds:://202.41.112.140/SST_DAQ/11/\SST_DAQ::TOP.BOLOMETER:BOLO_1
    Use ploicytool.exe in JDK or JRE installation directory to add socket access permission.
    The IP address mentioned above in error is the computer with which v have to connect. SST_DAQ is the expt name,11 is the shot no. , BOLOMETER and BOLO_1 are the tree node s..
    plzz reply fast........

    Hi Frank,
    Are you using standalone OC4J or 9iAS ? If you are using standalone OC4J then you need to add a proper data source entry in %OC4J_HOME%j2ee\home\config\data-sources.xml file.
    If you are using 9iAS the you can log in to the Enterprise Manager console and add the data source entry by using wizard provided by 9iAS.
    Ensure the case of the JNDI lookup string, since, it is case sensitive.
    Hope this helps.
    Abhijeet

  • XML transformation using XSLT in JSP page

    Hi,
    Please help, I'm getting this error when I try to render my xml file using an xsl style sheet in my JSP page. Am I missing a JAR? Thanks
    Error 500: org/apache/xalan/xslt/XSLTInputSource
    Here's xsl file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
    <xsl:template match="/">
      <html>
      <body>
      <h2>My CD Collection</h2>
        <table border="1">
          <tr>
            <th align="left">Title</th>
            <th align="left">Artist</th>
          </tr>
          <xsl:for-each select="catalog/cd">
          <tr>
            <td><xsl:value-of select="title"/></td>
            <td><xsl:value-of select="artist"/></td>
          </tr>
          </xsl:for-each>
        </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    And here's my JSP page
    <%@taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xsl"%>
    <html>
    <head><title>Phone Book</title></head>
    <body>
    <xsl:apply xml="/xml/book.xml" xsl="/xml/book.xsl" />
    </body>
    </html>
    And here's my xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- Edited with XML Spy v4.2 -->
    <catalog>
         <cd>
              <title>Empire Burlesque</title>
              <artist>Bob Dylan</artist>
              <country>USA</country>
              <company>Columbia</company>
              <price>10.90</price>
              <year>1985</year>
         </cd>
         <cd>
              <title>Hide your heart</title>
              <artist>Bonnie Tyler</artist>
              <country>UK</country>
              <company>CBS Records</company>
              <price>9.90</price>
              <year>1988</year>
         </cd>
    </catalog>

    i would think the browser should be able do the transformation itself, rather than having to do this transformation on the server.
    If you want to do this on the server, you can always try adding xalan.jar, xml-apis.jar and xercesImpl.jar to your server's lib directory, downloaded from
    apache.org

  • Get the class file name of the JSP page

    Hi
    I'm wondering how I can get the class name associated with the current JSP page...
    I found on this forum how get the name of current JSP page, but it doesn't help me...
    Thanks

    Hi,
    Sometimes I can be really dumb; of course, the solution is to call the getClass() method on the this object, and eventually store the Class object returned in the SessionBean file if it's necessary (in a SessionBean field/property, or in a parameter of a SessionBean's method).
    Sorry for this thread without any interest. :(

  • Error "_blank is undefined" for a new popup jsp page opening from a button

    Added a new button, by personalization to a self service page. The new button on click should open a new jsp page. The jsp page is opening properly on the same page if I remove the blank from the target frame property. For opening the jsp page on a new window, on specifying blank property, getting page error as "_blank is undefined". Also the appearance of the new button added by personalization is different from other buttons. Please help me as I am clueless regarding what might be the cause of such java script(page error).

    If your button appears as a normal html button then your display server might not be generating the image properly, check the logs after turning on logging to see if there are any errors thrown from the display server. Secondly the images generated at runtime are cached in $OA_HTML/cabo/images/cache/en folder, check to see if that folder has proper write permissions for the display server to write the image there.
    What is the OAf version you are using ? Setting _blank on the target frame is the right approach, once you get the above problem rectified try it again.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Browse for folder button in JSP Page

    Trying to create a browse for folder button in a JSP page. Anybody with some ideas on how to do this? Applet, Bean, some other way? Has anybody done this before? Is it even possible?
    Thanks in advance!

    We have done it with Struts before. Also seen it done with javascript.

Maybe you are looking for