Catching one page element...

Hello!
My jsp page has 2 components: a combo box and a text field. When the user chooses one element on the combo, i have to make a query to full fill the text field with the result of the query. My problem is: how do i get the selected element, to send it to the bean to make the query?
My source code:
<select name="selDesc_cc">
<%
String valor;
dados_cc = cc.dadosCentrosCustos();
while(dados_cc.next())
valor = dados_cc.getString("des_centro_custo")+" ";
valor = valor.substring(0,25);
%>
<option value="<%=valor%>"><%=valor%></option>
<%
%>
</select>
???something like this???
<input type="text" name="txtCod_cc" size="15" value="<%=getMethod(selDesc_cc.value)%>">
How do i manipulate the onChange event (to catch the selected element) of the selDesc_cc to use the setMethod of my bean??
Thank�s for your atention.
Rafael.

How do i manipulate the onChange event (to catch the
selected element) of the selDesc_cc to use the
setMethod of my bean??The onchange event is a javascript function, and is called on the client machine after the JSP is done and over with, and the results sent to the client. JSP runs on the Server, and javascript on the client (browser), so you can't do what you want.
What you would do is have the onchange event submit the form to a servlet or back to the same JSP page, passing the value of the combobox, then the servlet would check the value, do the appropriate method, and assign a value to the text box.
Do a search on these forums and you should come up with several similar problems, and solutions.

Similar Messages

  • Resolving conflicting JavaScript due to several Spry elements in one page

    I am fairly new to web coding, I would really appreciate some help in the following topic. I am working on a web page and I decided to insert some of the pre-coded Spry elements provided by Dreamweaver, I have in one page a HorizontalMenuBar, a SpryTabbedPanels, and an AccordionPannel. I have not modified any of the script that is automatically inserted into my code, all I did was to change some of the CSS to match my design, I saved the extension files in my own .js folder rather than the SpryAssets folder that is automatically created and I have verified that all the files are being called correctly in the <head> of my document. When I test the page with only the HorizontalMenuBar it works fine, as soon as I add the TabbedPanels and the Accordion only one of them works. I researched this subject and I think the problem is that eachof these /.js files created by Dreamweaver have a couple of variables that are named creating conflict when running the script. But I don't know what variable it is, in previous threads I found that the most common variable causing this problem is the 'onload' event, so I looked for it on each file and to my surprise neither of the .js files have an 'onload' element. I would guess that is being used as a global variable, but I don't write code and I wouldn't know how to fix that.
    I have some specific questions I would appreciate help with.
    1- Does anyone know a simple way to fix this problem?
    2- What other variable could be causing this problem? Specific names would help so I can run a Find search
    3- Will it cause a problem if I combined the 3 .js files into one?
    4- What can I do to avoid this problem later on if I decided to add another pre-coded JavaScript element into my site?
    Thanks in advance for any help provided.

    I'm having a similar problem and can't find the solution. I have a twitter feed widget and a image cycle widget on my site. On their own the widgets work fine, but when both in the same html document only one works. Here's my code, what do you think: I'd really appreciate any assistance. Thanks!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="scripts/jquery.cycle.all.js" type="text/javascript"></script>
    <script src="scripts/jquery.js" type="text/javascript"></script>
    <script src="scripts/twitter_search.js" type="text/javascript"></script>
    <style type="text/css">
    /* BeginOAWidget_Instance_2559022: #slideshow */
                                  #slideshow { 
                                      padding: 0px;
                                            margin:0; 
                                  #slideshow-caption{
                                            padding:0;
                                            margin:0;
                                  #slideshow img, #slideshow div { 
                                      padding: 0px;
                                      background-color: transparent;
                                            -webkit-border-radius: 0px;
                                            -moz-border-radius: 0px;
                                            border-radius: 0px;
                                      margin: 0;
    /* EndOAWidget_Instance_2559022 */
    </style>
    <script type="text/xml">
    <!--
    <oa:widgets>
      <oa:widget wid="2559022" binding="#slideshow" />
      <oa:widget wid="2125523" binding="#twitter" />
    </oa:widgets>
    -->
    </script>
    <style type="text/css">
    /* BeginOAWidget_Instance_2125523: #twitter */
                        #twitter { height: 200px; width: 250px}
    /* EndOAWidget_Instance_2125523 */
    </style>
    </head>
    <body>
    <script type="text/javascript">
    // BeginOAWidget_Instance_2559022: #slideshow
                               slideshowAddCaption=false;
    $(document).ready(function() {
              $('#slideshow').cycle({
                        after:                              slideshowOnCycleAfter, //the function that is triggered after each transition
                        autostop:                              false,     // true to end slideshow after X transitions (where X == slide count)
                        fx:                                        'fade,',// name of transition effect
                        pause:                              true,     // true to enable pause on hover
                        randomizeEffects:          true,  // valid when multiple effects are used; true to make the effect sequence random
                        speed:                              2000,  // speed of the transition (any valid fx speed value)
                        sync:                              false,     // true if in/out transitions should occur simultaneously
                        timeout:                    6000,  // milliseconds between slide transitions (0 to disable auto advance)
                        fit:                              true,
                        height:                       '400px',
                        width:         '900px'   // container width (if the 'fit' option is true, the slides will be set to this width as well)
    function slideshowOnCycleAfter() {
              if (slideshowAddCaption==true){
                                  $('#slideshow-caption').html(this.title);
    // EndOAWidget_Instance_2559022
    </script>
    <div id="slideshow">
      <!--All elements inside this will become slides-->
      <img src="images/beach1.jpg" width="100" height="100" title="caption for image1" /> <img src="images/beach2.jpg" width="300" height="300" title="caption for image2" /> <img src="images/beach3.jpg" width="200" height="200" title="caption for image3" />
      <div title="sample title"> you can add blocks of text instead!</div>
      <img src="images/beach4.jpg" width="200" height="200" title="caption for image4" /> <img src="images/beach5.jpg" width="200" height="200" title="caption for image5" /> </div>
    <!--It is safe to delete this if captions are disabled-->
    <div id="slideshow-caption"></div>
    <div id="twitter"></div>
    <script type="text/javascript">
    // BeginOAWidget_Instance_2125523: #twitter
    $(document).ready(function() {
              $('#twitter').twitterSearch({
                        term: 'from%3Abholtdesign',
                        title: 'cbb twitter',
                        titleLink: 'http://www.twitter.com/bholtdesign',
                        bird: true,                                                  // true or false (show or hide twitter bird image)
                        birdSrc: '/images/tweet.gif',                     // twitter bird image
                        birdLink: '',                    // url that twitter bird image should like to
                        avatar: false,                                        // true or false (show or hide twitter profile images)
                        anchors: true,                              // true or false (enable embedded links in tweets)
                        animOutSpeed: 500,          // speed of animation for top tweet when removed
                        animInSpeed: 500,          // speed of scroll animation for moving tweets up
                        pause: true,                                        // true or false (pause on hover)
                        time: true,                                                  // true or false (show or hide the time that the tweet was sent)
                        timeout: 4000,                              // delay betweet tweet scroll
                        css: {
                                  a:     { textDecoration: 'none', color: '#999999', fontWeight: 'normal'},
                                  container: { backgroundColor: '#000000' },
                                  frame: { border: '10px solid #333333', borderRadius: '10px', '-moz-border-radius': '10px', '-webkit-border-radius': '10px' },
                                  img:   { width: '30px', height: '30px' },
                                  loading: { color: '#888' },
                                  text:  {fontWeight: 'normal', fontSize: '12px', color:'#ffffff'},
                                  time:  { fontSize: '12px', color: '#CCC' },
                                  title: { backgroundColor: '#990066', padding: '5px 0 5px 0', textAlign: 'center', fontWeight: 'bold', fontSize: '12px'},
                                  titleLink: { textDecoration: 'none', color: '#ffffff' },
                                  user:  { fontSize: '12px'},
                                  fail:  { background: '#6cc5c3 url(/images/failwhale.png) no-repeat 50% 50%'}
    // EndOAWidget_Instance_2125523
    </script>
    </body>
    </html>

  • I am new to pages and want to know how to link elements together to create one unified element that I can then duplicate several times on the same page?

    I am new to pages and want to know how to link elements together to create one unified element that I can then duplicate several times on the same page?

    I think you are talking about grouping objects.
    1. They must all be floating objects
    2. Command click on each in turn
    Menu > Arrange > Group
    Peter

  • Printing only one page problem

    Hi,
    I have a printable class that needs to print some text only on 1 page.
    The thing is that when I hit print the printer prints 3 pages:
    page 1 - with correct content
    page 2 - empty page
    page 3 - page with content translated some how
    then the printing stops.
    Here is the code:
    private static final double FACTOR = 2.83;
    private double width, height;
    private void setupJob(){
              // page width and height
              width = 75*FACTOR;
              height = 50*FACTOR;
              job = PrinterJob.getPrinterJob();          
              pf = new PageFormat();
              //PageFormat pf =job.pageDialog(job.defaultPage());
              aset = new HashPrintRequestAttributeSet();
              // Create a letter sized piece of paper with one inch margins
              paper = new Paper();
              // resize the paper and the imageable area
              paper.setSize(width, height);
              paper.setImageableArea(0, 0, width, height);
              // set paper for the pageFormat
              pf.setPaper(paper);
              // set the job printable by calling the painter of this object with the pf pageFormat
              job.setPrintable(this, pf);
              job.setCopies(1);          
              // set the media printable area in mm
              aset.add(new MediaPrintableArea( 0f, 0f, 75f, 50f, MediaPrintableArea.MM));          
              try {
                   job.print(aset);
              } catch (PrinterException e) {
                   e.printStackTrace();
    @Override
         public int print(Graphics g, PageFormat pf, int page)
                   throws PrinterException {     
              if (page > 0) { // We have only one page
                   return NO_SUCH_PAGE;
              }else{          
                   Graphics2D g2d = (Graphics2D)g;
                   // no translation needed
                   // g2d.translate(11.34f, 0);
                   // scale to fit page size
                   double sx = 0, sy = 0;
                   sx = width/(75*4);
                   sy = height/(50*4);
                   double scale = Math.min(sx, sy);
                   g2d.scale(scale,scale);
                   // draw the elements
                   for (int i=0; i<4; i++){
                        texts.drawText(g);
              return PAGE_EXISTS;
    Any help would be appreciated!
    Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Solved myself

  • Why does FireFox truncate part of an E-mail of more than one page when I try to print it out? How can I sent an E-mail blaet to several but only show one name o

    When I try to print out an E-mail that is longer than one page, part of the 2nd page is truncated. I then have to go to Safari to print out the entire E-mail without part of it being truncated.
    When I have multiple E-mail addresses on a single E-mail, how can I send the E-mail so that each recipient only sees his/her name and E-mail address rather than everyone else that the E-mail is addressed to?
    Please advise.
    Thank you.
    Bill Leete

    Some style rules that Firefox handles well on the screen can cause this problem. Many email sites have a print button which simplifies the message format and removes navigation elements, etc., and Firefox generally handles print-formatted pages better. If your email site doesn't have print-formatted pages or those do not print, a "hack" is to select the text you want to print and then choose the Selection option in the print dialog.
    To hide email addresses from recipients, you need to place them in the BCC field. What do you put in the TO field in that case? You can use your own address.

  • How do i allow multiple pages to open in one page?

    Hi there,
    I want to be able to have one page with a left navigation where the viewer can click on the nav and get page content opening up on the right.  With each click of a new button on the nav, the content changes.  Like the apple site : http://www.apple.com/iphone/tips/
    Does anyone know how to do this?  I realise that frames used to do this i think but i know that's not the way to go.  Can anyone help?
    Cheers
    Nic

    No no no.
    What I'm saying is put the contents of what_is_it.html into the <desc> tag with CDATA to retain html elements. So your <desc> tag should look something like this:
    <desc><![CDATA[This is the desc area <b>with html elements</b>]]></desc>
    Which will render in your spry detial region as:
    This is the desc area with html elements
    Read this to see what I'm talking about.
    i wasn't able to view your XML
    One of my dynamically-generated spry xml datasets is located at http://DWFAQ.info/files/tutorials.php (view the source code to see xml syntax with embedded CDATA) If you store your info in a database and write your xml dynamically it is much, much easier to have control over your xml dataset. Then you can add, edit, and remove xml data dynamically by using insert, update and delete record server behaviors in Dreamweaver. Look Here to find out how to generate xml from a database dynamically although granted this may be a little over your head at this time since you're working with static html pages.

  • I am trying to re-print a portion of a photo enlarged through "poster" and can't get just the one "page" to print. Does anyone have a solution?

    I am trying to re-print a portion of a photo enlarged through "poster" in the print dialog box. The original photo printed just fine with the exception of one "page." This is what I'm trying to re-print. I have gone into the Multi- page box clicked on 4 x 4 and then selected the pages I did not want to print. This isn't working as it prints some pages and doesn't print others. All in all it is using a tremendous amount of ink for this project. Additionally I am printing on fabric which involves a deal of time in that preparation. The waste factor is turning into a huge cost. It should just be a simple thing to tell the print dialog box what I want it to do and have it do it. Help, does anyone have a solution?

    Hi Pat,
    Yes I marked the question as Assumed Answered. I needed to move on. I have never taken part in a forum and couldn’t wait any longer for any input so not wanting anyone to waste the time answering me, I marked the question as assumed answered. I guess this was the wrong thing to do and I apologize to the forum.
    I did go another route and loaded and enlarged the photo in Photoshop Elements, Then cropped the photo to the area I needed to reprint. I probably should have done this in the first place!
    Again, my apology to the forum for my lack of patience in waiting for a reply.
    Diane Harris
    Sent from Windows Mail

  • Can I open more than one Pages document at a time with the IOS app?

    This sounds crazy, but I can't find how to open more than one Pages document at the same time when using the Pages app on IOS.
    It's easy on the Mac, but on my iPad? Can't seem to do it!
    I'm working on a project where I'm writing one document, but having to frequently cross-refer to another. Having to continually open and close each document, one at a time, on my iPad is driving me mad!
    Am I missing something really obvious? Can anyone help please?

    Many thanks, that's really useful. I've saved the document I'm referring to as a PDF and can now work exactly as you described.
    As you say, it's not elegant, but it does work
    Just need to ensure my fingertips are very dry, as I fear any slight 'catching' with a four finger swipe and my iPad will fly across the room / train / office 

  • Moved page no longer displays Master Page elements.

    After moving a page in my document the master page elements no longer display on screen or in print. If I move the page to a different location in the document the master displays but if it is in the specific position that it needs to be it will not display. The document has multiple Masters and others do work on the page but the one that I need will not. I've tried deleting the page and adding a new one and that does not fix the problem. I've checked and "Hide Master Items" is not checked. The page in question is in position 48 with F-Master applied. If I move it to position 49 it works, 50, it works, 51, or any other it works. If I apply a different master to the page, it works. If I delete the page, add a new page and apply F-Master it still does not work. The only page that this problem is happening on is page 48.

    try exporting to .idml. See Remove minor corruption by exporting

  • Copy layers or pieces of a layer from one page to another, without masters?

    How can I copy layers or pieces of one page to another? I created a master, and I want to create a second master that uses much of the same setup, but I need to go in and input a background photo. However, the only quick way to get the menus and headers from the first master into the second master is actually assigning the master, but then I cannot move the photo to the back of everything. Is there such a way that I can copy those menus and such into a new master without having it assigned to the first master?

    In your site plan, right click on the master you would like to use as a second master and choose 'duplicate page'. This will create a new master with all of the elements from the first master but can be edited separate from the first menu.
    If I understood what you were trying to do that should work for you.

  • How to map more than one xml element with some Paragraph in a Text Frame

    Hi friends,
    I am new in InDesign Java Scripting and I have to place or map, more than one xml elements of different parents, into one textbox. Is it possible through JavaScript? Can anyone help me in this because I have no idea how it should work and it urgently required.
    Thanks in Advance

    I had answered to you already in your first post: the short answer is that it's not possible on the same text box unless you assign a common ancestor of these two "parents" item. That's not a question of scripting, it's the way Indesign handle the XML with the layout. Import a xml in Indesign and drop tags to page item. What you can do manually is quite representative of what can be done through scripting.
    If you assign this anscestor to the text frame, you have to expect that all text child items will be displayed in the text frame (including the text of all the child of the two "parents" and all the other parents/childs that could be under the common ancestor). Having a XML that is designed for Indesign usage is pretty much inevitable if you are doing anything "serious".

  • IBooks Author: in exported file, one page loads very slowly...

    iBooks Author: in exported file, one page loads very slowly and drags when scrolling through pages, almost stopping the scroll.  I have never seen this problem before with photo pages.  Normally they scroll just as smoothly as text pages.
    I have tried rebuilding the page with more compressed files to no avail.  The image files used on the page are not any bigger than others I have used previously without any problem.
    I have tried restarting my iBook.
    I am using a template that I have modified quite a bit.  The templates currently offered by Apple and third parties are not even close to what I am looking for in terms of layout, so I have to rip almost everything out of the page and start with a blank page, most of the time.  I tried modyfying the layouts to save time and then saved as a new template.  Apple really needs to add a module to create your own template at the beginning of a project.  Or they need to create one very open template, without much on the pages.

    I finally solved the problem by using an unmodified template. I would still like to know how my modifications to the other template caused the problem, but for now it remains a mystery.  Thanks for your ideas.
    Next I will try modifying the template without saving it as a template (merely saving it as a file) to see if I can get away with my modifications.  Also I will make fewer modifications.
    Slowly but surely I am learning this program by trial and error.  Each time I try a few formatting variations, output an iBooks file, and open it on my iPad.  I have probably done 20 of these tests, so far.  Once I work out every detail of the design and structure, I will build the final book.  I am lucky to have a beautiful PDF of the hardcover version, generously provided by my publisher.  This not only sets a high bar for me, but also allows me to use some of their design elements via screen capture.
    iBooks Author has great potential, but I along way to go to get there. One feature I would really like to see in the next update: the ability to add a hidden caption to a photo.  The reader would tap the image and the caption would appear. Tap again and it disappears.

  • Printing JPanel to fit one page, Urgent  (thanks for help)..........

    hi all,
    I am trying to print and can't get the right scaling. My problem is if the JPanel that has lot of images inside it is too big to come on one page width and height then I want the print out to be on one page. If my panel's height is too large to fit on one page and the width is only half of the page or less than page half of the width. Then I want to scale it's height only to fit on one page while keeping the width the same during printing and the images also to be scaled accordingly. And if my height is too small lets say less than half the page and the width is too large too fit on one page then in this case I want to print the original height or keep the height to be shown on the printout as it looks on the screen but scale the width to fit on to one page and the images also to be scaled accordingly. But my following piece of code doesn't honor this though it fits on one page. It keeps on increasing the width or height to fit the whole page thought the width or height is less than that and the images are also expaned accordingly. I want to scale the images too and only fit the width or height if any is greater than one page. Any help is really appreciated. Thanks in advance
    RepaintManager.currentManager(panel).setDoubleBufferingEnabled(false);
    //Creates and returns a PrinterJob.
    PrinterJob printerJob = PrinterJob.getPrinterJob();
    Book book = new Book ();
    PageFormat pf = printerJob.pageDialog(printerJob.defaultPage());
    int pagecount = this.calculatePageCount(pf);
    book.append (this, pf, pagecount);
    // set pageable
    printerJob.setPageable(book);
    if (printerJob != null && printerJob.printDialog())
    try
    //this print() method implements the Printable interface
    printerJob.print();
    catch (Exception e)
    e.printStackTrace();
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
    if ( pageIndex >= 1 )
    return NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D)graphics;
    // leave room for a page number
    double pageHeight = pageFormat.getImageableHeight();
    double pageWidth = pageFormat.getImageableWidth();
    double scaleFactorH = (panel.getSize().height)/(double)(pageFormat.getImageableHeight());
    // set the clip to the size of one page
    g2.setClip(0, 0, (int)pageWidth, (int)pageHeight);
    // translate down the graphics object to the top of this page
    g2.translate(0f, -pageIndex*pageHeight);
    // scale to fit the width
    g2.scale(scale,1.0/scaleFactorH);
    panel.paint(g2);
    return PAGE_EXISTS;
    //method to calculate
    public int calculatePageCount (PageFormat pf)
    double pageHeight = pf.getImageableHeight();
    double pageWidth = pf.getImageableWidth();
    double componentWidth = panel.getSize().getWidth();
    System.out.println("THe imageable width is " + pageWidth);
    if (componentWidth > pageWidth)
    scale = pageWidth / panel.getWidth();
    double componentHeight = panel.getSize().getHeight() * scale;
    printPageCount = (int)Math.round(Math.ceil (componentHeight/pageHeight));
    return printPageCount;
    Is there a way to fix this any help is appreciated.
    Thanks

    Dear Nadia,
    Thanks for the info.
    If I understand it correct I can make a copy of my actual css file.
    Rename it this copy to e.g. print.css
    And then make some changes such a letter fonts and colour
    Linking this css file to my pages and specify it is only for `print1`
    Right?
    I`m using a template so if I amend the template like this and have all pages updated automatically that should do the trick?
    Right?
    Is there somewhere where I need to mention that e.g. the page needs to be reduced onto 95% by printing?
    Or will the print.css do the trick?
    Sometimes I get confused on what css can do and it can do a lot.
    Many thanks for helping me out here.
    Kind regards
    martine

  • How to print the same picture multible times on one page

    how can i print the same picture multible times on one page
    Message title was edited by: Brett N

    Select all of the images you would like to print in the Elements Organizer, then go to File > Print. In Step 4, choose Picture Package from the drop-down menu. In Step 5, click the option to Fill Page with First Photo.

  • Keeping my query rows on one page.

    Please take a look at this URL
    http://dev.tms-hq.com/tmsreport.cfr
    and please tell me how to keep the query records on one page
    and not have the type and category elements repeated on 2 pages.
    Thanks so much.

    There's something covering the navbar on the About Me page.  As soon as you get the navbar cleared it should work.
    OT

Maybe you are looking for