Using a class in a web module

I'm using netbeans and the web module template.
I'm pretty new to jsp, so please bare with me. I just want to be able to use a class in my jsp page.
I have 2 files:
WEB-INF/classes/Customer
index.jsp
in the Customer Class, i declare the package at the top:
package com.mycompany.data
public Class Customer {
in index.jsp, I want to use the Customer Class. I try like this:
<%@ page import="com.mycompany.data.*" %>
<%
Customer cust = new Customer();
%>
I keep getting an error in index.jsp on both the page directive and on the line where I declare and instantiate the Customer object.
Can someone inform me or point me to the right place to understand how to use a class in a .jsp?
Thanks

If the class Customer is in package com.mycompany.data
Then Customer.class should be a file in
web-inf/classes/com/mycompany/data/Customer.class
Apart from that it looks ok.
You might consider using a <jsp:useBean> tag instead of declaring customer in a scriptlet.
I'm very much a fan of minimum scriptlet code on a page.
Cheers,
evnafets

Similar Messages

  • JSP does not have visibility of java classes in simple Web Module Project

    Dear Experts
    I am developing what I thought would be a very simple Web Module Project for a simple webservice
    to allow a user to logon to Netweaver Portal with a simple logon and password.
    I have not done this in over 8 years, and am somewhat rusty.
    The webservice is package in  a .war and is deployed via an Enterprise Application project as a .ear.
    The issue I am having is that I want to enhance the presentation of the webservice through the
    provision of css and adding a couple of images. The "libraries" are visibile in the build path of web
    module project.
    At the top of my .jsp for logon form I want to import some java libraries in order
    to get String webpath = componentRequest.getWebResourcePath()"/":
    <%@ page session = "true"%>
    <%@ page import = "com.sapportals.portal.prt.resource.IResource" %>
    <%@ page import="com.sap.security.core.sapmimp.logon.SAPMLogonLogic" %>
    <%@ page import="com.sap.security.core.sapmimp.logon.SAPMLogonCertLogic" %>
    <%@ page import="com.sap.security.core.logonadmin.IAccessToLogic" %>
    <%@ page import="com.sap.security.core.logonadmin.ComponentAccessToLogic" %>
    <%  IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
    final boolean inPortal = true;
    String webpath = componentRequest.getWebResourcePath()"/";
    // todo: find layout schema...
    aResponse.addResource(componentRequest.getResource(IResource.CSS, "css/main2.css"));
    %>
    However, during runtime the libraries are unknown and I get the following SAPJ2 EE errors
    indicating the methods etc are not known to the jsp:
    Full Message Text
    application [ctxhrofm] Processing HTTP request to servlet [jsp] finished with error.
    The error is: com.sap.engine.services.servlets_jsp.server.jsp.exceptions.CompilingException: Error while executing the compilation rocess: [/usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java22: package com.sapportals.portal.prt.resource does not exist
    import com.sapportals.portal.prt.resource.IResource;
                                              ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:23: package com.sap.security.core.sapmimp.logon does not exist
    import com.sap.security.core.sapmimp.logon.SAPMLogonLogic;
                                              ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:24: package com.sap.security.core.sapmimp.logon does not exist
    import com.sap.security.core.sapmimp.logon.SAPMLogonCertLogic;
                                              ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:25: package com.sap.security.core.logonadmin does not exist
    import com.sap.security.core.logonadmin.IAccessToLogic;
                                            ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:26: package com.sap.security.core.logonadmin does not exist
    import com.sap.security.core.logonadmin.ComponentAccessToLogic;
                                            ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:60: cannot resolve symbol
    symbol  : class IAccessToLogic
    location: class jsp_LoginForm1310122356593
    IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
                              ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:60: cannot resolve symbol
    symbol  : class ComponentAccessToLogic
    location: class jsp_LoginForm1310122356593
    IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
                                                        ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:60: cannot resolve symbol
    symbol  : variable componentRequest
    location: class jsp_LoginForm1310122356593
    IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
                                                                                ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:60: cannot resolve symbol
    symbol  : variable aResponse
    location: class jsp_LoginForm1310122356593
    IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
                                                                                    ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:60: cannot resolve symbol
    symbol  : variable IAccessToLogic
    location: class jsp_LoginForm1310122356593
    IAccessToLogic proxy = new ComponentAccessToLogic (componentRequest, aResponse, IAccessToLogic.ENV_LOGONCOMPONENT);
                                                                                    ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:63: cannot resolve symbol
    symbol  : variable componentRequest
    location: class jsp_LoginForm1310122356593
    String webpath = componentRequest.getWebResourcePath()"/";
                    ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:66: cannot resolve symbol
    symbol  : variable IResource
    location: class jsp_LoginForm1310122356593
    aResponse.addResource(componentRequest.getResource(IResource.CSS, "css/main2.css"));
                                                      ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:66: cannot resolve symbol
    symbol  : variable componentRequest
    location: class jsp_LoginForm1310122356593
    aResponse.addResource(componentRequest.getResource(IResource.CSS, "css/main2.css"));
                          ^
    /usr/sap/SQ1/JC20/j2ee/cluster/server3/apps/com.shell/sp~ctxhroap/servlet_jsp/ctxhrofm/work/jsp_LoginForm1310122356593.java:66: cannot resolve symbol
    symbol  : variable aResponse
    location: class jsp_LoginForm1310122356593
    aResponse.addResource(componentRequest.getResource(IResource.CSS, "css/main2.css"));
    ^
    14 errors
    Exception id: [0019996862AA007E00000436000077FB0004A78CA1BA8324]
    I have added the associated DCs for classes to used DCs and they are visible on the buildpath
    of my webservice.
    What am I missing?
    Many thanks for any advice offered
    Mike

    Have you made runtime references to used libraries...?
    refer page 20 ...in
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60d99678-1a29-2d10-94b4-9d9a67b7199b?quicklink=index&overridelayout=true

  • How to use ABAP Class to modify Web Query Result ??

    Hi all !
    We are using Web Templates to display our Query.
    What I would like to do ( and seems a really important issue for our users! ) is to have a "PAGE BREAK" everytime the value of a charateristics change in the report
    For Example :
    -Page 1-
    Division     Project
       A               1
                        2
                        3
    -Page 2-
    Division     Project
       B               1
                        2
                        3
    and so on....
    I read threads about using ABAP CLASS but no example what so ever...
    We are presently under BW 3.1 but are considering upgrading to 7.0 by the end of the year so if there is a solution to my problem on either version i'd like to know.
    If anyone has any information about how I can do this it would be most appreciated
    Thx
    JB.

    Hi Yong,
    Ravi is right, first check the blogs by Jocelyn, and if you still have specific questions you can ask them. I have used ABAP classes in workflow and I know Mike Pokraka tries to use classes exclusively.
    Regards,
    Martin

  • Using 2jee library in a web module dc for an applet

    hi,
    i have create an external library dc, added some jars to it and wrapped that external library DC in a  j2ee library dc.
    the web module dc uses the j2ee library dc. after building the web module dc, the jars will not be a part of the war file. 
    the web module dc delivery an applet that reference the jars in the applat tag.
    how i can resolve this problem in nwdi?
    regards
    h.rohr

    hi marc,
    i have create an external library with a compilation and an assembly public part. the j2ee server component library use (wrapped) external library and the web module dc use the j2ee server component library.
    the public parts are visible in j2ee component library dc.
    the web module dc use the dc reference  to j2ee server component dc.
    regards,
    heiko

  • How to refer to the class in regular functional module

    Hi ABAP guru's
    I wish to get details of GET_REQUID parameter of method IF_RSBK_REQUEST_GENERAL that is available in
    class CL_RSBK_REQUEST.
    I am writing a ABAP function module and I wish to use this class in that function
    module. Can someone help to write this code on how to read value of GET_REQUID in my function module?
    Thanks for your help in advance
    Ag

    Hi Allgon,
    welcome to the SAP Community Network. I hope you become a valuable member by contributing regularly.
    You need to appreciate a few things.
    Firstly read Welcome and Rules of Engagement.
    It includes the following suggestions...
    Please...
    - Use the correct or most appropriate forum,
    - Do not cross-post or multiple-post, and
    - Search for information before asking basic questions, again.
    Cheers
    Graham Robbo

  • Web module generator security conflicts with DAD

    Hi,
    using the WSGSEC package for web module security, I'm running into issues related to the mod_plsql configuration. There are 3 values for setting session state behaviour (PlsqlSessionStateManagement) following to the dads.README:
    1. StatelessWithResetPackageState (is default)
    2. StatelessWithFastResetPackageState
    3. StatelessWithPreservePackageState
    1. and 2. work well when switching security off (preference SECVAL=N), but prevent successful logon (cookie cannot be stored or read correctly) and logon screen returns ever and ever.
    3. allows logon but brings the "erratic behavior" mentioned in the README, mainly after DML operations.
    How can I manage the session state for the generated application? Logon needs a preserved state, the generated application needs cleaning and resetting. Now, we are developing on Windows 2003 Server but production will run on HPUX.
    regards
    Thomas

    Sorry,
    some minutes after posting this question I found the hidden chapter on Security in the online help. I hope to mange it now with the information provided.
    regards
    Thomas

  • Web Module Creation in j2ee perspective and jsp dynpage

    Hi all,
    Can someone tell me when to use jsp via creation of web module using suspend and resume plugs and jsp dynpage.  I am not clear with these two concepts.  Basically I want to work with jsp's and tht too want to be able to view it in portal iview.
    Regards,
    Preeti

    hi
    check this out
      /message/413811#413811 [original link is broken]
      /message/864533#864533 [original link is broken]
      /people/community.user/blog/2006/11/02/jspdynpage-with-client-side-eventing-and-database
      https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a08c287b-96a5-2a10-a691-b8b8bc40ea43

  • How do I use the Web module to upload video to my website?

    I'm using the Lightroom HTML gallery to upload my photos, fine and dandy, very happy with it. I also have some videos trimmed in Lightroom that I want incorporated into the gallery. This doesn't seem to be happening, instead I just get thumbnails. What/how do I incorporate my video clips into my web gallery? I moved over from jAlbum so I could have a simple one-tool workflow, so I'm really hoping that this is possible.

    You can combine stills and video for output to h.264 (mp4 file) for example to upload to Youtube or Vimeo.
    FTP upload will be subject to the limitations of your host. The web module within Lightroom creates all resources to link to the file index.html
    The forthcoming LR6 is anticipated to have HTML5 galleries.

  • I want to use the Web module to publish to the a website... What kind of server do I need to be able to publish my website?

    I want to use the Web module to publish to the a website... What kind of server do I need to be able to publish my website?

    You don't need a server, you just need a web hosting package such as the ones from GoDaddy or many other hosts. You then send the web gallery directly from LR to your web space.
    As you're asking such basic questions, it might be best if you read articles like this and see if a friend or colleague can get you started.

  • How can you develop photo galleries with multiple pages using the web module?

    Going through the web module I can see there are many options for developing a web page with a single collection of photos.  How can you develop a web site with multiple pages containing different categories of photos using the Lightroom web module?

    This thread will give you several ideas.
    Re: How do you embed a gallery into an existing website?

  • Create web service using java class

    Hi,
    I created the web service using java class then i deployed this web service in to the weblogic admin server.when i tested this process it is working fine.
    when I tested The generated WSDL to this process in browser(IE). it is not working.
    I need to to invoke this webservice from another BPEL but this WSDL is not working.

    Hi,
    when i created the webservice in jdeveloper by default it is connected to integrated weblogic server and generates this wsdl.
    http://localhost:7101/helloApplication-javaexcel-context-root/MyWebService1Soap12HttpPort?WSDL
    then I deployed this webservice in to the Adminserver.it gives the following URL.
    http://192.168.56.1:7001/extracExcelToCSV-extractExcelToCSV-context-root/ExtractExcelToCSVSoap12HttpPort?wsdl
    This URL is not working but when i tested this process it is working fine.
    It is giving below error when i try to invoke from jdeveloper
    Error while reading wsdl file
    caused by:java.net.connectExcepption :Connection timed out:connect

  • Need help using WEB module in Lightroom 2 for .mac/mobile me accounts

    Hello,
    I need help in finding the Server path information for Lightroom 2.  I am trying to use the Web module of Lightroom and build a website and instead of going through another hosting service, I want to use my Mobile ME account, can't I do that?
    I have the user name and password obviously but what is the server path, protocol, path?
    Help please!
    Thanks
    Ray

    For those Mac Users using iWeb, MobileMe, and Lightroom 2, here are step-by-step instructions on how to create a web gallery in Lightroom, upload the gallery to MobileMe, and finally, how to link the uploaded files to the wesite you created in iWeb.
    1. In the Lightroom Library module, create a collection of photos you want to display in your web gallery.  For illustration purposes, we will call your collection Sunsets.  Once created, it will be listed under Collections in the left panel of Lightroom.
    2. Switch to the Lightroom Web module and select the Sunsets collection (from the panel on the left of the screen.)
    3. Chose whichever template you like (from the list of Templates in the left panel).
    4. Fine tune the appearance of the gallery using the controls in the right hand panel of Lightroom 2.
    5. When you are satisfied with the gallery’s appearance, use your keyboard to type Command-S.  That will save your template settings (give it a unique name when saving).
    6. Open up Finder on your Mac.  Inside your username folder, create a new folder… I'll call it Web Files.  (You can choose any name you like, and locate the file anywhere on your Mac HD.)  You have just created the folder username/Web Files.
    7. Back in the Lightroom Web module, chose Export, at the bottom of the right panel, and export your gallery to the folder you just made (e.g. export to username/Web Files).  By doing so, you will have created /username/Web Files/Sunsets.
    8. Once again open Finder on your Mac.  Go to /username/Web Files/Sunsets and you will see 3 files in the Sunsets folder: bin, index.html, and resources.
    9. Open a second Finder window and in it, click on your iDisk icon.  You will soon see all of the files on your iDisk.
    10. In iDisk, click on the folder called /Web.  You will now see the /Sites folder inside the /Web folder.  I.e., /Web/Sites.
    11. Drag the Sunsets file from your Mac HD to the /Sites folder on your iDisk.  E.g, drag Sunsets from /username/Web Files/Sunsets on your Mac HD to the /Sites folder in iDisk /Web/Sites.  The Sunsets folder (and the three files it contains) will now upload to your iDisk on MobileMe.
    12. Open iWeb on your Mac. Add a new page to your website.  Call it “Galleries,” or anything you like. (You can also use an existing page if you wish.)
    13.  On that “Galleries” web page (or on an existing web page), create a picture icon, or a word, or a symbol, or anything else that you will activate as a hyperlink to your iDisk web files - specifically, you will link it to the Sunsets folder you just uploaded to iDisk.
    14. Activate the hyperlink in iWeb’s Inspector.  In the URL box, type:
    http://web.me.com/username/Sunsets  (Don’t forget to substitute your name for “username” and the name of your gallery for “Sunsets.”)
    15. Save your website in iWeb, and then publish your site.
    You will NOT see your gallery in iWeb – you will see only the link to the gallery that you uploaded to iDisk..  To view your gallery, either make hyperlinks active, using the Inspector in iWeb and click on he link to the gallery, or visit your website on the internet.  If you want to edit your gallery, you will have to do that in Lightroom… then repeat steps 7 – 11.  You cannot edit your gallery in iWeb, but you can use iWeb to change the appearance of the link to your gallery, or to change it’s location within your website.

  • Deployment of the SiteMinder WebAS module using SDA is no longer supported

    I just came to know  that "the deployment of the SiteMinder WebAS module using SDA is no longer supported by SAP "
    Can any body please verify that how much this is correct.
    Also,just out of curiousity, i want to know that do SAP still support SDA as the mean of deploying various modules?
    Edited by: David Garrison on Mar 6, 2008 12:27 PM
    Edited by: David Garrison on Mar 6, 2008 12:30 PM

    To move to Safari 6 you would have to install Lion or Mountain Lion.  Perhaps try contacting Google/gmail about the issue and why they are not supporting your version of Safari.

  • Web Module App not using custom login page.

    Iu2019ve created a simple Web Module Application that I wish to use a custom login page for authentication.  From previous posts it looked like this would be easy.  Iu2019ve made the changes below and have redeployed my application.  When the application runs it forwards to the standard SAP login page rather than my login page.  What am I missing?  Thanks in advance.  /Greg
    Web.xml.
    <login-config>
         <auth-method>FORM</auth-method>
         <form-login-config>
              <form-login-page>login.jsp</form-login-page>
              <form-error-page>error.jsp</form-error-page>
         </form-login-config>
    </login-config>

    Moderator message -
    When closing old threads, there is no need to add a comment. Adding a pasted answer like "Resolved ourselves" only brings old threads to the top of the forum list and pushes current ones down. If you do add a comment, please indicate just how the problem was resolved.
    Rob

  • Expose Web Module Java Class as Web Service

    Hi Expert,
    can you please tell me whether Web module java class method can be expose as Web service in sap netweaver 7.1?
    if possible give me some scenario.
    Please Help
    Regards,
    Vanita

    Please Help.
    I am stucked in middle.
    Regrads,
    Vanita

Maybe you are looking for