Question about somepage.jsp?id=10

I have a few questions about passing variables inside the actual URL.
Say for example i have a products list, each product has an id. When i click on the product various information will be displayed including price, name etc etc. At the same time comments from various customers will be displayed.
I was just wondering how i'll generate the number embedded inside the jsp which takes the user to the product information page. For example <a href="getProduct.do?id=10> how is 10" generated? Is it generated based on the productID?
If i have 10 and in the products table i have the values do i just extract them according to the id and list the various values? At the same time i'll just locate the product id (which is a foreign key) in the comments table and list the comments also. I'm using struts if that makes any difference.
Do i have the right idea?

In other words, if i've printed out all the customer names from the database to my jsp how do i make it a hyperlink to point to the customer id using show.jsp?cust=1

Similar Messages

  • Quick question about url/jsp mapping

    Could anyone clarify whether the following mapping in the web.xml file is possible?
    I want to access the file webapps\examples\gate\login.jsp by going to the page http://192.168.2.143:8080/work/login.jsp instead of http://192.168.2.143:8080/examples/gate/login.jsp
    Currently I can map it fine to http://192.168.2.143:8080/examples/work/login.jsp,
    which is an existing folder, but when I try and get it above the examples folder, it gives me the 404 error.
        <servlet>
            <servlet-name>Login</servlet-name>
            <jsp-file>/gate/login.jsp</jsp-file>
        </servlet>
        <servlet-mapping>
            <servlet-name>Login</servlet-name>
            <url-pattern>/../work/login.jsp</url-pattern>
        </servlet-mapping>

    Using only work/login.jsp will cause an error, and the tomcat server to crash, if I use the pattern
    <url-pattern>/work/login.jsp</url-pattern>, I just map the URL http://192.168.2.143:8080/examples/work/login.jsp instead of
    http://192.168.2.143:8080/examples/gate/login.jsp
    My entire webaps structure is rather long, and contains code other than my own, so I'd rather not post it, I just need to figure out if it is possible to map the jsp page to a path above the file. (do you think I need to do it in another web.xml?)

  • Question about the jsp:useBean tag

    Hi, I'm a relative newcomer to jsp, but the following piece of javascript code has me very confused:
    <%@ page import="com.jinsoft.bank.web.*" %>
    <jsp:useBean id="account" class="AccountBean" />
    This will result in java.lang.ClassNotFoundException, and it complains that AccountBean cannot be found.
    However, when I fully qualify the class, it works:
    <%@ page import="com.jinsoft.bank.web.*" %>
    <jsp:useBean id="account" class="com.jinsoft.bank.web.AccountBean" />
    Am I doing something wrong?
    Isn't the import tag supposed to help?
    Thanks for any help!

    Hi Kim
    I'm really interested in the particular error that you are generating. I tried this out using Tomcat 3.2.3 and it doesn't seem to be a problem. What application Server are you using?
    Another way to find out if the problem is with the Application Server is to check the .java file that is created out of the jsp page before it is compiled. Individual Application servers have different ways of storing this intermediate .java file but most of them keep it if the compilation does not succeed.
    You may possibly have to file a bug if everything else checks out fine. Another point, are you able to import the same bean into a Servlet and use it there?
    Keep us posted.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc
    http://www.sun.com/developers/support

  • Questions About JSP?

    hi;
    I am php devloper and I am learning Java now.
    I am using NB6.1 , Tomcat 6.0 , J2ee 5.
    I have some questions about devleoping web application with jsp.
    1.What are
    /WEB-INF/web.xml
    /META-INF/context.xml
    /META-INF/MANIFEST.MF
    files that generated with NB.are important or optional.are auto generated or may I edit.
    2.can I distribute my web application in non text format.How?
    3.if I want to add some files to my application that its running in tomcat.how can i do that with out rebuild all.
    thank you
    Add to mtz1406's Reputation

    thank you all for helping.
    I will write more information about my questions may this help others:
    *{ /WEB-INF/web.xml* - The +Web Application Deployment
    Descriptor+ for your application. This is an XML file describing
    the servlets and other components that make up your application,
    along with any initialization parameters and container-managed
    security constraints that you want the server to enforce for you.
    This file is discussed in more detail in the following subsection.
    As mentioned above, the <code>/WEB-INF/web.xml</code> file contains the
    Web Application Deployment Descriptor for your application. As the filename
    extension implies, this file is an XML document, and defines everything about
    your application that a server needs to know (except the context path,
    which is assigned by the system administrator when the application is
    deployed).
    The complete syntax and semantics for the deployment descriptor is defined
    in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it
    is expected that development tools will be provided that create and edit the
    deployment descriptor for you. In the meantime, to provide a starting point,
    a [basic web.xml file|http://localhost:8080/docs/appdev/web.xml.txt]
    is provided. This file includes comments that describe the purpose of each
    included element.
    NOTE - The Servlet Specification includes a Document
    Type Descriptor (DTD) for the web application deployment descriptor, and
    Tomcat 6 enforces the rules defined here when processing your application's
    <code>/WEB-INF/web.xml</code> file. In particular, you must
    enter your descriptor elements (such as <code><filter></code>,
    <code><servlet></code>, and <code><servlet-mapping></code> in
    the order defined by the DTD (see Section 13.3).
    h4. } from tomcat documentation
    Tomcat Context Descriptor
    bq. A /META-INF/context.xml file can be used to define Tomcat specific \\ configuration options, such as loggers, data sources, session manager \\ configuration and more. This XML file must contain one Context element, which \\ will be considered as if it was the child of the Host element corresponding \\ to the Host to which the The Tomcat configuration documentation contains \\ information on the Context element.
    }from tomcat documentation
    but I still want more information about this question:
    Q3: I want to distribute (sell to another organaization) without give sorce code in jsp files.So I want to precompile it to be just class files or jar files.
    I want to use ant that become with netbeans 6.1.can anyone give me information about how to do that.
    thank you again

  • Newbie question about loading servlets on tomcat

    I have what is probably a very basic question about loading simple servlets on to tomcat to test its installation. I have followed instructions from numerous tutorials to the letter but still I can't get it to work.
    I have installed tomcat on win2k in c:\tomcat. I set up the jdk, environment vars (JAVA_HOME, CATALINA_HOME, TOMCAT_HOME) which all point at the correct dirs. I can compile a servlet without errors. I can also place a test jsp and html file into the root directory and they both work fine.
    However, now I am trying a test servlet and no matter what I do it gives me a 404. I have a servlet class file called "HelloServlet.class" which I placed into the %install_dir%\webapps\ROOT\WEB-INF\classes directory. I try to reference it using this url:
    http://localhost/servlet/HelloServlet
    Tomcat is configured to use port 80 and has been restarted after adding the servlet class file. Does anyone have a clue why this is not working for me?
    Many thanks
    Marc

    You have to add in the web.xml file that it is in the WEB-INF dir, the information about your servlet. An example:
    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>

  • BASIC Questions about JavaMail

    Hi Everyone
    I have some very basic questions about java mail.
    I have a weblogic web server. I think it's version 5 or something like that.
    when a user clicks a form on my application sends some information to my database (via my jsp/java program) , I need to send email to a person?
    Does anyone know how to do that ?
    Could someone please describe the process
    Stephen

    I would recommend that you first read the JavaMail design specifications http://java.sun.com/products/javamail/JavaMail-1.2.pdf
    Then, download JavaMail. It comes with a reference implementation of the API and also very good samples.
    Those samples should get you started very quickly on how to send email from Java program.

  • Question about dependent projects (and their libraries) in 11g-Oracle team?

    Hello everyone,
    I have a question about dependent projects. An example:
    In JDeveloper 10.1.3.x if you had for instance 2 projects (in a workspace): project 1 has one project library (for instance a log4j library) and project 2 is a very simple webapplication which is dependent on project 1. Project 2 has one class which makes use of log4j.
    This compiles fine, you can run project 2 in oc4j, and the libraries of project 1 (log4j) are added on the classpath and everything works fine. This is great for rapid testing as well as keeping management of libraries to a minimum (only one project where you would update a library e.g.)
    However in 11g this approach seems not to work at all anymore now that weblogic is used, not even when 'export library' is checked in project 1. The library is simply never exported at all - with a noclassdeffound error as result. Is this approach still possible (without having to define multiple deployment profiles), or is this a bug?
    Thanks!
    Martijn
    Edited by: MartijnR on Oct 27, 2008 7:57 AM

    Hi Ron,
    I've tried what you said, indeed in that .beabuild.txt when 'deploy by default' is checked it adds a line like: C:/JDeveloper/mywork/test2/lib/log4j-1.2.14.jar = test2-view-webapp/WEB-INF/lib/log4j-1.2.14.jar
    Which looks fine, except that /web-inf/lib/ is empty. I presume its a sort of mapping to say: Load it like it in WEB-INF/lib? This line is not there when the deploy by default is not checked.
    I modified the TestBean as follows (the method that references Log4j does it thru a Class.forName() now only):
    public String getHelloWorld() {
    try {
    Class clazz = Class.forName("org.apache.log4j.Logger");
    System.out.println(clazz.getName());
    catch(Exception e) {
    e.printStackTrace();
    return "Hello World";
    In both cases with or without line, it throws:
    java.lang.ClassNotFoundException: org.apache.log4j.Logger
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:42)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:169)
         at nl.test.TestBean.getHelloWorld(TestBean.java:15)
    Secondly I added weblogic.xml with your suggested code, in the exploded war this results in a weblogic.xml which looks like:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    <jsp-descriptor>
    <debug>true</debug>
    <working-dir>/C:/JDeveloper/mywork/test2/view/classes/.jsps</working-dir>
    <keepgenerated>true</keepgenerated>
    </jsp-descriptor>
    <library-ref>
    <library-name>jstl</library-name>
    <specification-version>1.2</specification-version>
    </library-ref>
    <library-ref>
    <library-name>jsf</library-name>
    <specification-version>1.2</specification-version>
    </library-ref>
    </weblogic-web-app>
    The only thing from me is that container-descriptor tag, the rest is added to it during the deployment. Unfortunately, it still produces the same error. :/ Any clue?

  • Question about Weblogic

    Hello,
    I have a question about Weblogic and would like someone to help me with it.
    I created a JSP and everything was doing fine while i was testing it in Tomcat. But once I started the tests with Weblogic, it seemed Weblo wasn't accepting a class that i used to call from my JPS ( a sax parser). Instead of using my parser, Weblogic was using his default SAXParser, what causes problems to my JSP. Trying to solve this, I changed the classpath in Weblo and putted the jar of my parser in the beginning of the classpath, but it still didn't work. Does anyone have an idea of why Weblogic don't accept my parser and uses its default parser instead?
    Thanks in advance!!
    M@G

    naveen.g wrote:
    How to get the path of the domain, where my application is running, in a java code?
    For example, my domain path is "D:\bea\user_projects\domains\production". How to get this path dynamically?Please start a new topic instead of resurrecting an old and non-related thread and hijacking others' threads.

  • Question about upcoming Studio 8

    Hi
    i have some question about upcomming studio 8 if some on know
    1-when will it come available as EA ?
    2-does it contain visuall web service design presented in conf?
    3-can it be integrate with Creator 2 or creator be installed into it as a module ?
    4-does it contain wysiwyg for jsp/struts/jsp ?
    5-can it deploy to other Apps ?
    thank you

    Sun Java Studio Enterprise 8 Early Access Program will be started soon.
    Here is registration link: https://feedbackprograms.sun.com/callout/default.html?callid=E53199507DE44123B7A13841206FFE08
    And AFAIK direct deployment will be supported into Sun Java System Application Server, Tomcat and WebLogic

  • Some question about 9iAs R1.2.2 & R2, need your help:

    Some question about 9iAs R1.2.2 & R2, need your help:
    Since 2000, we has used 9iAS Core (R1.2.2) to publish our website. The platform is Suns Solaris (SPARC). The database is Oracle 8i. But there are so many questions:
    1.     The Web Cache cant be installed well
    2.     The web pages use JSP to query database with SQL show errors when we refresh the page a few times. The error will disappear after restarting the 9iAS or refreshing the page again. On the other hand, the same pages dont show error on resin. The error is java.sql.SQLException : Closed Connection: next. I supposed that the connection of database has some hidden troubles, but I can find it, could you give me some advice.
    Now I have installed 9iAS R2, But when I visited the manage page, I found that a password is needed to visit the web cache manage page. I dont think I have set the password, and then I cant control the web cache. I want to know is a default password occurred? If not, what is the password.

    The default password for Web Cache is: administrator
    See walkthrough on the sample code page: http://otn.oracle.com/sample_code/products/ias/content.html
    HTH,
    Ashesh Parekh
    Oracle9iAS product management

  • Questions about JavaFX

    Hi all,
    I'm new to JavaFX. I have a couple of questions about this new technology.
    1. Can JavaFX provides a GUI layer like SWING in a standalone application where the GUI collects input and sends a request to the core application?
    2. Regarding Web applications, what can JavaFX do? I guess JavaFX allows us to create applets, and it does not provide what JSPs/Servlets or JSF do. Is it right?
    Thank you very much!

    The new technology is already 6 months old and the version 1.2 have just been released... :-)
    Which is good news: yes, JavaFX has now a rather complete GUI layer. Previously it depended on Swing to provide most GUI components, now it has native components.
    So it can indeed collect (and display) information and send requests to a server (via HttpRequest class).
    JavaFX is on the client side: you can create applets, drag them to the desktop, start programs with JNLP or even as standalone applications. But it is not suitable to build Web pages on the server side, so no JSP/JSF/Servlets. But it can communicate with them, of course.

  • Question about EJB and thread safe coding - asking again!

    sorry everyone, no one seems to be interested in helping me on this, so i post it again.
    i have a question about the EJB and thread safe coding. when we build EJBs, do we need to worry about thread safe issue? i know that EJBs are single threaded, and the container manages the thread for us. maybe i am wrong about this. if i wasnot, how can we program the EJB so that two or more instance of EJB are not going to have deadlock problem when accessing data resources. do we need to put syncronization in ours beans, do we even need to worry about creating a thread safe EJB? thanks in advance. the question really bothers me a lot lately.

    sorry everyone, no one seems to be interested in
    helping me on this, so i post it again.Excellent plan. Why not search a little bit on your own instead of waiting for your personal forum slaves to answer your call. See below.
    i have a question about the EJB and thread safe
    coding. when we build EJBs, do we need to worry about
    thread safe issue? Read this: http://forum.java.sun.com/thread.jsp?forum=13&thread=562598&tstart=75&trange=15
    i know that EJBs are single
    threaded, and the container manages the thread for us.
    maybe i am wrong about this. if i wasnot, how can we
    program the EJB so that two or more instance of EJB
    are not going to have deadlock problem when accessing
    data resources. do we need to put syncronization in
    ours beans, do we even need to worry about creating a
    thread safe EJB? thanks in advance. the question
    really bothers me a lot lately.
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

  • Questions about your new HP Products? HP Expert Day: January 14th, 2015

    Thank you for coming to Expert Day! The event has now concluded.
    To find out about future events, please visit this page.
    On behalf of the Experts, I would like to thank you for coming to the Forum to connect with us.  We hope you will return to the boards to share your experiences, both good and bad.
     We will be holding more of these Expert Days on different topics in the months to come.  We hope to see you then!
     If you still have questions to ask, feel free to post them on the Forum – we always have experts online to help you out.
    So, what is HP Expert Day?
    Expert Day is an online event when HP employees join our Support Forums to answer questions about your HP products. And it’s FREE.
    Ok, how do I get started?
    It’s easy. Come out to the HP Support Forums, post your question, and wait for a response! We’ll have experts online covering our Notebook boards, Desktop boards, Tablet boards, and Printer and all-in-one boards.
    We’ll also be covering the commercial products on the HP Enterprise Business Community. We’ll have experts online covering select boards on the Printing and Digital Imaging and Desktops and Workstations categories.
    What if I need more information?
    For more information and a complete schedule of previous events, check out this post on the forums.
    Is Expert Day an English-only event?
    No. This time we’ll have experts and volunteers online across the globe, answering questions on the English, Simplified Chinese, and Korean forums. Here’s the information:
    Enterprise Business Forum: January 14th 7:00am to 12:00pm and 6:00pm to 11:00pm Pacific Time
    Korean Forum: January 15th 10am to 6pm Korea Time
    Simplified Chinese Forum: January 15th 10am to 6pm China Time
    Looking forward to seeing you on January 14th!
    I am an HP employee.

    My HP, purchased in June 2012, died on Saturday.  I was working in recently installed Photoshop, walked away from my computer to answer the phone and when I came back the screen was blank.  When I turned it on, I got a Windows Error Recovery message.  The computer was locked and wouldn't let me move the arrow keys up or down and hitting f8 didn't do anything. 
    I'm not happy with HP.  Any suggestions?

  • Have questions about your Creative Cloud or Subscription Membership?

    You can find answers to several questions regarding membership to our subscription services.  Please see Membership troubleshooting | Creative Cloud - http://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting- creative-cloud.html for additional information.  You can find information on such topics as:
    I need help completeing my new purchase or upgrade.
    I want to change the credit card on my account.
    I have a question about my membership price or statement charges.
    I want to change my membership: upgrade, renew, or restart.
    I want to cancel my membership.
    How do I access my account information or change update notifications?

    Branching to new discussion.
    Christym16625842 you are welcome to utilize the process listed in Creative Cloud Help | Install, update, or uninstall apps to install and evaluate the applications included with a Creative Cloud Membership.  The software is fully supported on recent Mac computers.  You can find the system requirements for the Creative Cloud at System requirements | Creative Cloud.

  • Questions about using the Voice Memos app

    I'm currently an Android user, but will be getting an iPhone 6 soon. My most used app is the voice memos app on my Android phone. I have a couple questions about the iPhone's built-in voice memos app.
    -Am I able to transfer my voice memos from my Android phone to my iPhone, so my recordings from my Android app will show up in the iPhone's voice memos app?
    -When exporting voice memos from the iPhone to computer, are recordings in MP3 format? If not, what format are they in?
    -In your opinion, how is the recording quality of the voice memos app?

    You cannot import your Android voice memos to your iPhone's voice memo app.  You might be able to play the Android memos and have the iPhone pick up the audio and record it.
    Here is the writeup about sending voice memos from the iPhone to your computer (from the iPhone User Guide):
    App quality is excellent.

Maybe you are looking for