Newbie in JSP...help

pls post some codes in jsp in adding,editing,deleting and viewing data in the database..i am using tomcat,apache,mysql...thanx

Asking for code is not going to work here. Rather elaborate your coding problem in detail. Where exactly are you stucking while writing code?
It is fairly straightforward. Write a DAO class with create/read/update/delete methods which interacts with the database. Write a Servlet which handles the request parameters and interacts with the DAO class. Write a JSP file with HTML tables and forms which sends the request parameters to the Servlet.

Similar Messages

  • Total newbie for jsp..plz help

    frendz...me a total newbie to jsp.havin some problem in it.i have already installed jdk,jwsdp2.0 wif its tomcat container.Already set the path for both ..such as JAVA_HOME=E:\Program Files\Java\jdk1.5.0_06
    TOMCAT_HOME=E:\tomcat50-jwsdp
    and could execute the sample jsp's perfectly.But having problem wif my jsp tutorials. such as when i wrote this counter codes in notepad..
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <html>
    <head>
    <tittle>Jsp Declaration</tittle>
    </head>
    <body>
    <h1>Declarations</h1>
    <%! int j=0;%>
    <h2>Counter</h2>
    <p>This page has been hit <span> <% ++j %> </span> times since it was first loaded.</p>
    </body>
    </html>
    and i paste it in webapps in tomcat folder.
    What should i do to view the jsp file?isaved as counter.jsp.if i right click and view it in IE/firefox it only shows the source code.is there any mistake in the codes?or i did i do anything wrong?how shall i compile these files?help me aout wif my basics please.thanks bro's..

    "I pasted it in webapps in tomcat folder".
    Webapplications need to go in their own subdirectory inside the webapps directory. Say you want a webapp 'test', then you would store your JSP as
    TOMCAT_DIR\webapps\test\counter.jsp
    Now you can open this JSP in your browser. Assuming Tomcat is running on the localhost and the default port 8080, the url would be:
    http://localhost:8080/test/counter.jsp
    If that doesn't work something is horribly misconfigured.

  • Hi I am newbie to Jsp,could anybody please help me

    Hi ,I am designing one login form using Jsp and servlets,these are my programs:
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class login2 extends HttpServlet {
         private String target = "/welcome.jsp";
         private String getUser(String username, String password) {
    //          Just return a static name
    //          If this was reality, we would perform a SQL lookup
              return "Shopping cart";
         public void init(ServletConfig config)
         throws ServletException {
              super.init(config);
         public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          If it is a get request forward to doPost()
              doPost(request, response);
         public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          Get the username from the request
              String username = request.getParameter("username");
    //          Get the password from the request
              String password = request.getParameter("password");
              String user = getUser(username, password);
    //          Add the fake user to the request
              request.setAttribute("USER", user);
    //          Forward the request to the target named
              ServletContext context = getServletContext();
              RequestDispatcher dispatcher =
                   context.getRequestDispatcher(target);
              dispatcher.forward(request, response);
         public void destroy() {
    This is my servlet program and these are my jsp programs:
    <html>
    <head>
    <title>OnJava Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <b>Welcome To: <%= request.getAttribute("USER")
    %>
    </html>
    this is welcome.jsp and this is login.jsp
    <html>
    <head>
    <title>OnJava Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <SCRIPT language=JavaScript>
    function checkUserName( thisform ) {
    if ( thisform.username.value == null || thisform.username.value == "") {
         alert( "You must supply value for Name");
         thisform.username.focus();
         thisform.username.select();
         return false ;
    /* if ( thisform.eMail.value == null || thisform.eMail.value == "" ) {
         alert( "You must supply value for eMail");
         thisform.eMail.focus();
         thisform.eMail.select();
         return false ;
         var myreturn = 0;
         myreturn = thisform.eMail.value.search("@");
         if ( myreturn == -1 ) {
         alert( "Please provide a valid eMail address like '[email protected]'");
         thisform.eMail.focus();
         thisform.eMail.select();
         return false ;
    return true;
    //end hiding -->
    </SCRIPT>
    <body bgcolor="#66CCFF" onLoad="document.loginForm.username.focus()">
    <Form name=loginform onsubmit="return checkUserName(this);"
    action=welcome.jsp method=post>
    <h><font face="Times New Roman" size="+3" color="#FF0000">Shopping cart Login form</font></h>
    <table width="500" border="0" cellspacing="0" cellpadding="0" align="center" >
    <tr>
    <td>
    <table width="500" border="0" cellspacing="20%" cellpadding="10%">
    <form name="loginForm" method="post" action="servlet/login2">
    <tr>
    <r>
    <td width="401" align="center"><div align="right">User Name: </div></td>
    <td width="399" align="left"><input type="text" name="username"></div></td>
         </center>
    </tr>
    <tr>
    <td width="401"><div align="right">Password: </div></td>
    <td width="399"><input type="password" name="password"></td>
    </tr>
    <tr>
    <td width="401"> </td>
    <td width="399"><br><input type="Submit" name="Submit" value="Login"></td>
    </tr>
    </form>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    and I got Welcome to:null,but instead of i would like to get Welcome To Shopping Cart.
    What's the with my code,could anybody please help me...

    Hi,
    change loginform action to login2 (servlet) for validate user.
    <Form name=loginform onsubmit="return checkUserName(this);"
    action=login2 method=post>Regards,
    Ram.

  • Newbie to JSP needs help

    I'm running tomcat and apache and basic servlets work fine, however when I try the usebean tag; I get an error message "CLASS not found". The class object is in the same directory as the servlet?
    Any suggestions?
    Kurt Radamaker
    Orlando FL

    I don't think it is. How do I tell? I'm pretty green with jsp and java, so I'm sorry I can't be of more help.
    Kurt Radamaker
    Orlando FL

  • Newbie to JSP/Struts: Where to get started

    I would like to begin experimenting with JSP and the struts framework. I'm a java newbie but a relatively quick learner.
    First, what products do I need to use struts/JSP ?
    I have 9iAS standard edition release 1.0.2.1 and an oracle database std edition without the JVM installed. Do I need the JVM in the database ? Can JSP use a JVM outside the database ? Do I need enterprise edition ?
    Do I need Jdevelopper 9i or can I learn to use JSP with simple tools (HTML editor) first ?
    Does struts need JSP 2.0 spec or the JSP 1.1 that comes with iAS 1.0.2.1 is OK ? Is JSP 2.0 = JSP 1.2 (Like J2EE = JDK1.2 and up) There is a lot of version/naming confusion going on in java, you got any site that can help me untangle this mess ?
    Thanks a lot
    You can reply to [email protected]

    Thanks for your response.
    We actually use oracle 8.1.7 and 9iAS (PL/SQL gateway and http server). We would like to jump on the Java Bandwagon before we are left in the dust. We first need to be able to understand a lot of technology/concepts/buzzwords.
    We started basic Java programming (Applications) but would prefer to get an idea of "The big picture".
    By that, I mean, we need to be able to understand/design/architect sound applications and be able to talk to the community and understand what they are saying. Right now, reading the media or forums is just a big bunch of buzzwords that are ever changing and we cannot get a grasp on it.
    We not only need to get aquainted with the concepts, but we also need to be able to determine wether product xyz fits in the architecture, etc...
    If you were to get a couple of good books to answer some questions, where would you begin ?
    Kind of questions we might have are:
    - What is the difference between Jserv and Tomcat ?
    - What excatly is tomcat ? A replacement for Jserv ?
    - Can Jserv be used as a container for struts apps or do you need tomcat ? If you need tomcat, does it come with some version of 9ias ?
    - What is a java web service ?
    - I read a lot about Enterprise Java Beans etc.. What are they, what are there purpose ? It seems like it is a standard, what are they used for ? If it is a standard, does this mean that If I buy a set of EJB from a vendor, it would offer the same beans as another vendor ? Is Oracle BC4J an implementation of EJB with added functionality ? Is it proprietary ?
    - Buzzwords everywhere: MVC, EJB, J2EE, BC4J etc.. What are the definitions.
    - Is oracle's java vision proprietary or are they really following the rest of the world ? For example, is BC4J compatible with EJB ?
    - What is a Framework
    - What exactly is JSP.
    - Can STRUTS be used to access an oracle database ? If so, what are the required components (I guess you need JDBC or SQLJ) but does the oracle database need to be java enabled ?
    - Even if you use oracle 9ias as an application server, can you use non-proprietary development methods/architectures/techniques that could be easily implemented somewhere else using another vendor's application server (Ex: Apache + Tomcat, WebSphere, etc...)
    - Struts seems to be an interesting thing. I see that it was developped to encourage code reuse and prevent everyone from reinventing the wheel. But I cannot understand what exactly a developper had to write before struts was there. I mean, there must be alternatives to strut, if so what is the purpose of the framework ?
    A lot of questions, but we need to understand the basics before we jump on the java bandwagon. If we wait, we'll be left in the dust and we need to keep current.
    Thanks in advance.

  • Unable to compile class for JSP--- help me plz!!!!!

    hi friends;
    Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
    TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
    and all the jsp and html in /test3. my jsp an javabeans are--
    1. GetName.html
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    2. SaveName.jsp
    <jsp:useBean id="user" class="UserData" scope="session">
    <jsp:setProperty name="user" property="*"/>
    </jsp:useBean>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>
    3. UserData.java
    public class UserData {
    String username;
    String email;
    int age;
    public UserData(){}
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    4. NextPage.jsp
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <HTML>
    <BODY>
    You entered<BR>
    Name: <%= user.getUsername() %><BR>
    Email: <%= user.getEmail() %><BR>
    Age: <%= user.getAge() %><BR>
    </BODY>
    </HTML>
    url: http://localhost:8080/test3/GetName.html
    is it related to context path??
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    UserData user = null;
    ^
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
    ^
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = new UserData();
    ^
    3 errors
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
    Apache Tomcat/5.0.30
    please Reply me ASAP
    i'll be glad if you reply. please

    I am using Tomcat 6.0.
    I have put my UserData class in user package and
    used in below jsp(SaveName.jsp)
    <%@ page import="user.UserData" %>
    <jsp:useBean id="user" class="user.UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>
    I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
    UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
    My UserData class is
    package user;
    public class UserData {
    String username;
    String email;
    int age;
         public UserData(){
              this("","",0);
              System.out.println("najn thanne puli");
         public UserData(String username,String email,int age){
              this.username=username;
              this.email=email;
              this.age=age;
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    But running SaveName.jsp shows exception
    org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Please help me.thanks in advance.

  • JasperException: Unable to compile class for JSP HELP

    I added couple of extra class files into the jar file.. and now its not able to find it! I am running JBoss latest version and using eclipse... any help wud be nice
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Only a type can be imported. org.jfree.chart.servlet.WebHitChart resolves to a package
    Generated servlet error:
    Only a type can be imported. org.jfree.chart.servlet.WebHitDataSet resolves to a package
    An error occurred at line: 10 in the jsp file: /bar_chart.jsp
    Generated servlet error:
    WebHitChart cannot be resolved
    An error occurred at line: 10 in the jsp file: /bar_chart.jsp
    Generated servlet error:
    WebHitDataSet cannot be resolved
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

    just a random guess...
    I had a ton of issues with JBoss and jfreechart. JBoss uses a different classloader, and its internal versions of the jfreechart classes will be loaded before yours, causing all sorts of issues. Dig through the jboss directories and you'll find a different, older version of jfreechart of one of its classes. Remove them and you'll be in better shape.
    Alternatively, look around the JBoss docs for how to disable/turn off the unified classloader for your app (its a directive in jboss-web.xml IIRC). This should make the classloader for your webapp perform to spec, getting rid of the class colission issues.

  • Java mail and jsp -HELP!! HELP!!

    Hi all
    I have a simple email module with a jsp page and a html page I am trying to connect to a yahoo smtp server and send a mail from the webpage to the smtp server - I am getting an Authentication required error.
    error ##
    org.apache.jasper.JasperException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html
    Can anyonne tell me how to use a simple smtp email facility
    how to use an authenticator in the jsp
    ciao
    laodingdockjavaguy

    It's required that you authentificate yourself at the smpt server
    The following snipplet sends a msg using the smtp protocol.
    Transport tr = session.getTransport("smtp");
    tr.connect(smtphost, username, password);
    msg.saveChanges();     // don't forget this
    tr.sendMessage(msg, msg.getAllRecipients());
    tr.close();If this still fails You can also try to set the property mail.smtp.auth to true.
    mail.smtp.auth      boolean      If true, attempt to authenticate the user using the AUTH command. Defaults to false.see also http://java.sun.com/products/javamail/1.3/docs/javadocs/com/sun/mail/smtp/package-summary.html
    for a complete description of the properties supported by the smpt transport.
    hope it helps

  • J2ee security newbie: integrated authentication help

    I am trying to build a set of JSPs/servlets that require authentication and probably authorization. The jsp / sevlets should be able to authenticate against any underlying password system, or should cope with most common systems such as win2k / unix etc. I do not want to force the organisation to build a new database of users / passwords or to type in passwords in clear text in xml files.
    I would preferably like to use form-based authentication to avoid Http basic clear text password sending. This will also allow me to custmize the UI of the login screen.
    The solution should not be container specific. or at least the containers (tomcat + webspehere) should allow for it in their own way.
    After a lot of reseasrch on the web, I cant seem to find an accepted way of doing this. I would like comments on the choices I have made so far and the choices I should be making. Any links to reading material would be helpful. I would like to understand which lower level technologies to depend upon eg LDAP / Kerberos etc. Any help will be appreciated
    TIA,
    Zdz

    Most container come with the ability to put security constraints in the web.xml file.
    Then, you can set up your container to do the authentication (tomcat call this Realm). And there is a JAAS realm that can be configured a little bit like PAM in Unix/Linux.
    There is also a Security Filter around on the net.
    Hope this helps.

  • Newbie to JSP

    Hi ,
    I ran into a problem running JSPs. I am working with Tomcat 6.0 and JDK 1.5. I ran a very simple jsp file and it worked. Then I configured and got servlets working and now JSPs are no longer working. Looking at the code I have already included el-api.jar in my classpath but yet still get the same error. can anybody please help me?...
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ELResolver
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:274)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    java.lang.NoClassDefFoundError: javax/el/ELResolver
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(Unknown Source)
         java.security.SecureClassLoader.defineClass(Unknown Source)
         java.net.URLClassLoader.defineClass(Unknown Source)
         java.net.URLClassLoader.access$100(Unknown Source)
         java.net.URLClassLoader$1.run(Unknown Source)
         java.security.AccessController.doPrivileged(Native Method)
         java.net.URLClassLoader.findClass(Unknown Source)
         java.lang.ClassLoader.loadClass(Unknown Source)
         sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         java.lang.ClassLoader.loadClass(Unknown Source)
         java.lang.ClassLoader.loadClass(Unknown Source)
         java.lang.ClassLoader.loadClassInternal(Unknown Source)
         org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:200)
         org.apache.jsp.index_jsp._jspInit(index_jsp.java:22)
         org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
         org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.

    There are multiple class loaders involved here and each of them uses its own classpath. The environment classpath will be used by java.exe that starts up your Tomcat unless it is overriden by -classpath parameter. The class loader that loads your web application a standard set of directories in its class path too - all jar files under WEB-INF/lib, all classes under WEB-INF/classes.
    Generally, it's a good idea to add a jar file to the class path of the most relevant class loader (web app class loader in this case). That makes your application self-contained and totally transparent to environment changes outside the web app. So put this jar under WEB-INF/lib and make it work. Once you get more comfortable with Java technology, you can read more about class loaders, delegation used by class loaders and class loading hierarchy. You will then be able to appreciate why the approach mentioned by us is the best way to do things. Hope this helps!

  • Newbie to JSP, Need to convert some ASP code to work for JSP

    Can I get some aid in converting the following ASP code to work using JSP. I have never used JSP before but I now need to because of a recent server change.
    <%
    DIM URL
    URL = LCase(Request.ServerVariables("URL"))
    if InStr(URL, "/about/") then
    %>
    <p>About Test</p>
    <% elseif InStr(URL, "/menu/") then %>
    <p>Menu Test</p>
    <% elseif InStr(URL, "/contact/") then %>
    <p>Contact Test</p>
    <% else %>
    <p>Test</p>
    <% End if %>Thanks in advance
    Ned

    Can I get some aid in converting the following ASP
    code to work using JSP. I have never used JSP before
    but I now need to because of a recent server change.
    <%
    DIM URL
    URL = LCase(Request.ServerVariables("URL"))
    if InStr(URL, "/about/") then
    %>
    <p>About Test</p>
    <% elseif InStr(URL, "/menu/") then %>
    <p>Menu Test</p>
    <% elseif InStr(URL, "/contact/") then %>
    <p>Contact Test</p>
    <% else %>
    <p>Test</p>
    <% End if %>Thanks in advance
    Ned<%
    String sURL = request.getRequestURL();
    if (sURL.indexOf("//about//") > 1) {
    %>
    <p>About Test</p>
    <%
    } else if (sURL.indexOf("//menu//") > 1) {
    %>
    <p>Menu Test</p>
    <%
    } else if ......
    %>
    I wont do the other cases. Im sure you can figure it out. Hope it helps!

  • Newbie question: JSP x JSTL (Will JSTL kill JSP?)

    Hi,
    I'm newbie in java development and know I'm learning about jsp and jstl.
    I'm reading some articles about jstl, but my doubt remains...
    Was jstl create to kill jsp in apresentation layer?
    Please, if possible, show me an example that I really need use jsp instead of jstl?
    What kind of things can't I do with jstl?
    Thanks a lot

    Ranieri wrote:
    I'm sorry, my question wasn't very clear.
    When I said JSP, I wanted say Scriptlet...
    My central point is that Scriptlet is very confortable for me at the moment...
    So, I don't see a motive to change:
    <% if (1 == 2) }....
    to
    <c:if test="1 eq 2">...Lots of motive to change.
    Now... you can say that jstl is more easy, Or you can say that JSTL is easier.
    but if a big number of people start to use it, it will increase and will turn another programming language...It sounds like you think this is a new thing. JSTL has been around for a very long time. 2001 vintage. It's already here, dude.
    Besides, it's not a programming language per se. There will be other tag libraries, but those are custom. JSTL as written hasn't changed in years. The standard won't expand.
    So, why create another programming language if we have Scriptlet to do the same?Like I said before, scriptlets were the mistake. They're unreadable, ugly, and encourage putting logic in JSPs. Very bad, indeed.
    %

  • Newbie with JSP & JDBC questions

    Hi. I have a quick question. I have a client jsp page with a table, listing all the fields from my mySQL table called kellybclients. At the end of each row, I also have a submit button that I would like navigate the user to the campus jsp page that only shows the data associated with the client who's button they clicked on in the table. I'm trying to figure out how to pass this data from my JSP into the rowset.setCommand method in my connection/data bean. I am using a cached row set. Here's the code from my bean:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package ETS;
    import java.sql.SQLException;
    import javax.sql.rowset.CachedRowSet;
    import java.util.ArrayList;
    import com.sun.rowset.CachedRowSetImpl;
    public class CampusDataBean {
        private CachedRowSet rowSet;
      public CampusDataBean() throws Exception
        Class.forName("com.mysql.jdbc.Driver");
        rowSet = new CachedRowSetImpl();
        rowSet.setUrl("jdbc:mysql://traderseven.nmsu.edu/is470Spring08?relaxAutoCommit=true");
        rowSet.setUsername("is470Spring08");
        rowSet.setPassword("1DoNtier");
        rowSet.setCommand("SELECT campid, clientid, campname,campcounty FROM kellybCampus WHERE clientid=?");
        CampusBean camp = new CampusBean();
        rowSet.setString(1, camp.getClientID());
        rowSet.execute();
      public ArrayList<CampusBean> getCampusList() throws SQLException
        ArrayList<CampusBean> campusList = new ArrayList<CampusBean>();
        rowSet.beforeFirst();
        while(rowSet.next())
          CampusBean campus = new CampusBean();
          campus.setCampID(rowSet.getString(1));
          campus.setClientID(rowSet.getString (2));
          campus.setCampName(rowSet.getString(3));
          campus.setCounty(rowSet.getString(4));
          campusList.add(campus);
        return campusList;
    public void addCampus(CampusBean campus) throws SQLException
        rowSet.moveToInsertRow();
        rowSet.updateString(1,campus.getCampID());
        rowSet.updateString(2,campus.getClientID());
        rowSet.updateString(3,campus.getCampName());
        rowSet.updateString(4,campus.getCounty());
        rowSet.insertRow();
        rowSet.moveToCurrentRow();
        rowSet.acceptChanges();
    }I'm sorry if this is too vague. I'd appreciate any help, fixes, or pointers on where to learn how to do this. Thank you again.
    KellyJo

    So the button should be a Submit button for a form. There are a couple of different methods for doing this:
    1) Each row on the table can be a different form, each form uses the same action (servlet) target and has a hidden input with a unique identifier for each of the clients:
    <table>
      <tr><form action="selectClient" method="post"><td> etc </td><td><input type="hidden" name="id" value="1"/><input type="submit"/></td></form></tr>
      <tr><form action="selectClient" method="post"><td> etc </td><td><input type="hidden" name="id" value="2"/><input type="submit"/></td></form></tr>2) Use a single form with a button type=submit for each row with different values (Note: This is broken in IE7 so you probably shouldn't use it)
    <table><form action="selectClient" method="post">
      <tr><td> etc </td><td><button type="submit" name="id" value="1">Submit</button></td></tr>
      <tr><td> etc </td><td><button type="submit" name="id" value="2">Submit</button></td></tr>3) Use a single form, have a hidden value with a blank value. Each row has a submit button with a javascript onclick method that sets the form's hidden value to one appropriate to the row, then submits the form. I won't show you this code but there are examples on the web.
    4) Use a single form with an input="submit" element on each row. Each button would have a different name with the ID info encoded in it, then you would have server-side code that takes parameters, finds the right one and parses out the proper row to edit:
    <table><form action="selectClient" method="post">
      <tr><td> etc </td><td><input type="submit" name="submit__id_1"/></td></tr>
      <tr><td> etc </td><td><input type="submit" name="submit__id_2"/></td></tr>I think most people end up doing some variant of 3, which I don't like because I hate to rely on JavaScript to make my web apps work properly. I would prefer 4, which takes more work on the server side (which I like better) but 1 works just as well with a lot more typing and uglier HTML code. Actually, I would like 2 the best because that is pretty much what the <button> element was designed for, but Microsoft screwed that up.

  • OpenDocument.jsp help needed

    I am trying to configure a URL link to a crystal reports.
    This has been done
    1. Crystal reports created, connected to SAP.
    2. Report saved to CMS.
    3. Run, Viewed last instance in Infoview.
    I would like to create a URL to view this report, so I have this.
    http://hostname:port/OpenDocument/opendoc/openDocument.jsp?docid=7941&sInstance=Last
    I get directed to a logon page. the logon page has url properties of this:
    http://hostname:port/PartnerPlatformService/service/app/logon.do?appKind=InfoView&service=%2FOpenDocument%2FappService.do&backContext=%2FOpenDocument&backUrl=%2Fopendoc%2FopenDocument.jsp%3Fdocid%3D7941%26appKind%3DInfoView%26isApplication%3Dtrue%26sInstance%3DLast&backUrlParents=1&appName=OpenDocument&prodName=BusinessObjects+Enterprise&cmsVisible=false&cms=hostname%3A6400&authenticationVisible=false&authType=secEnterprise&sso=true&sm=false&smAuth=secLDAP&persistCookies=true&sessionCookie=true&useLogonToken=true
    I logon with crystal admin user
    And I get the page http://hostname:port/PlatformServices/service/app/error.do
    An error has occurred: An error occured while trying to view the document
    Any direction as to what has gone wrong is greatly appreciated! Thank you!

    Hi,
    do you use docid or iDocID in your URL. Please note that the parameter names are case-sensitive.
    I would recommend to take a look at the documentation in order to identify the correct syntax for your URL
    [http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf]
    Regards,
    Stratos

  • Who will help me ????JSP help

    Hi ,
    I am using tomcat and try to play around the authentication provided by tomcat examples ....
    i go here http://localhost:8080/examples/jsp/security/login/login.jsp ,i think most of u guys knows where the hell is this page .....but do i know the user name and password.
    <html>
    <body>
    <h1>Login page for examples</h1>
    <form method="POST" action="j_security_check" >
    Username: <input type="text" name="j_username"><br>
    Password: <input type="password" name="j_password"><br>
    <br>
    <input type="submit" value="login" name="j_security_check">
    </form>
    </body>
    </html>

    <tomcat-users>
    <user name="tomcat" password="tomcat" roles="tomcat" />
    <user name="role1" password="tomcat" roles="role1" />
    <user name="both" password="tomcat" roles="tomcat,role1" />
    <user name="cypoon" password="pcyuen98" roles="admin" />
    </tomcat-users>
    This is the file you mentioned about ,and i have tried all those password but none of it able to login.
    All *.xml settings are original unzip from apache web site.
    PLEASE HELP.

Maybe you are looking for

  • Editor not working correctly in photomerge

    Trying to merge three pics, and at end get above message windows to close.. help please

  • Script or smartform for Dunning Letter????

    Hi All, I have to develop a SF for Dunning Letter. When I checked in standard Program for Dunning Letter printing, there SSF FM.... But my doubt is can we go for Smartforms??? When I checked in the customization, there is a SF for dunnig letter.. but

  • HT1414 Home Button Not working

    My iphone 3 dropped yesterday, since then; the home button has stopped working and in my itunes its no longer showing my phone as a device

  • Connecting an SPA 3102 after the computer

    I am moving to a house in a fairly remote part of Australia without a telephone connection. To get the phone connected will be very expensive and take considerable time. I have mobile phone and wireless internet connection available but only with the

  • OS X 10.5 download, where Can I?

    Where can I get an original os x 105 installation disk or iso image, etc?