Results 1 to 7 of 7

Thread: jsp servlet

  1. #1
    tamilram is offline Member
    Join Date
    Mar 2014
    Posts
    6
    Rep Power
    0

    Default jsp servlet

    I have three tables...... user,group and usergroup.in user jsp page, there is an list box which can list all the group name dynamically from database. my issue is in user jsp page, i can select the group name from that list box and after that click the submit button the groupid for that coresponding groupname can be stored in usergroup.... how can i store the groupid in usergroup table when i select hte groupname form jsp page.

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,900
    Rep Power
    5

    Default Re: jsp servlet

    A select box option has a label and a value; the value is the thing that is submitted and the label is the thing that is shown on screen. so simply make the value the group ID and the label the group name; then when you submit you get the group ID.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    tamilram is offline Member
    Join Date
    Mar 2014
    Posts
    6
    Rep Power
    0

    Default Re: jsp servlet

    Thanks... But i have dynamic values..... this is my sample code....
    <table style="text-align:left">
    <tr><td>Group Name</td>
    <td><select name="groupname" id="groupname">
    <option value="Select">----</option>
    <%List<String> gnamelist= (List<String>)request.getAttribute("AllGroupname") ;
    if(gnamelist!= null){
    for (String group : gnamelist) {
    %>
    <option value="<%=group%>"><%=group%></option>

    <%
    }
    }
    %>
    </select></td>

    how can i change the values?

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,900
    Rep Power
    5

    Default Re: jsp servlet

    Yes well you will have to find a way to put the groupId in your "dynamic values" then.

    Note that it is a very bad idea to use scriptlets, you should invest time into learning how to write JSPs without any Java code in them at all by using JSTL.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    tamilram is offline Member
    Join Date
    Mar 2014
    Posts
    6
    Rep Power
    0

    Default Re: jsp servlet

    if i update single row multiple rows can update at a time... i am using postgresql... how can solve this issue.....thanks in advance...

  6. #6
    tamilram is offline Member
    Join Date
    Mar 2014
    Posts
    6
    Rep Power
    0

    Default Re: jsp servlet

    I have one table named user.... i have created one jsp page which is used to search the user from user table... if i give the userid and select submit button that corresponding user details will display... if i give the username and select submit button that corresponding user details will display... but i want the details either i give id or name... how can merge two select statement in one query.... thanks in advance

  7. #7
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,900
    Rep Power
    5

    Default Re: jsp servlet

    I suggest you get a good book on SQL, learn SQL and then not have to ask these kind of "how to" questions in a forum anymore. This is as trivial as you can make it.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 1
    Last Post: 11-14-2013, 10:29 AM
  2. Replies: 13
    Last Post: 07-25-2013, 05:30 PM
  3. Replies: 1
    Last Post: 08-23-2011, 11:12 AM
  4. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •