In a JSP having a problem using out.println in method

I am trying to update a field on a form using JAVASCRIPT generated by JSP. The following code works fine when in the main body of the code.
The field tota on form mainform is updated based on the contents of strTest.
out.println("<SCRIPT LANGUAGE='JavaScript'>")
out.println("document.mainform.tota.value = " + strTest);
out.println("document.mainform.tota.focus()");
out.println("</SCRIPT>");
But if you have 10 flds that you want updated, it would be nice NOT to have to use 40 lines of code to do it. I am trying to build a method that will accept a field name and some data to put in a form field. I started small and just wanted to update 1 fld using the method below:
<%!
//Declare method to update form fields
void Update_Frm_Fld()
out.println("<SCRIPT LANGUAGE='JavaScript'>")
out.println("document.mainform.tota.value = " + strTest);
out.println("document.mainform.tota.focus()");
out.println("</SCRIPT>");
%>
I keep getting the error:
Time_Entry_jsp.java:21: cannot resolve symbol
symbol : variable out
location: class org.apache.jsp.Time_Entry_jsp
out.println("");
^
Help.....

try this:
<%@ page import="java.io.*" %>
<%!
//Declare method to update form fields
public void Update_Frm_Fld(HttpServletResponse response)
     throws ServletException, IOException{
          PrintWriter out=response.getWriter();
          out.println("<SCRIPT LANGUAGE='JavaScript'>");
          out.println("document.mainform.tota.value = "+1);
          out.println("document.mainform.tota.focus()");
          out.println("</SCRIPT>");
%>and when you call the function use this:
<%Update(response);%>

Similar Messages

  • Good Morning.  I'm having a problem using both my Photoshop elements and premiere programs.  I've installed the programs, redeemed my code and entered the serial numbers, and created the adobe log-in.  I am able to open up the organizer without problems,

    Good Morning.  I'm having a problem using both my Photoshop elements and premiere programs.  I've installed the programs, redeemed my code and entered the serial numbers, and created the adobe log-in.  I am able to open up the organizer without problems, but when I try to open up the photo editor (either by trying to open up the program from the main menu, or right-clicking on a photo in the organizer to edit in elements), the program asks me to sign in to adobe (which I can do and it doesn't give an an "incorrect password" or log-in ID error) then accept the terms and conditions.  When I click to accept the terms and conditions, nothing happens and the editor fails to open.  Everytime I click on the program, I get this same "loop" of signing in and accepting T&C's, but the program fails to open.  Any advice?

      Premiere Elements 10 is now 64 bit, but not PSE10.
    Take a look at your scratch disk set-up and if you have a spare volume, allocate that first before the C drive. Elements use scratch disks when it gets low on RAM.
    Click image to enlarge
    Turn off face recognition and the auto-analyzer to improve performance.
    When editing photos or videos check the task manager to see what background processes may be running and end them temporarily if not needed.

  • I am having a problem using the help menu in Adobe elements 5

    I am having a problem using the help menu in Adobe elements number five.
    When I open the help menu, the dialogue box defaults to an unreadable display font. Is there any way to change that default font? Using the help menus to find a solution is not possible for I cannot read what it is displaying.

    For product, there is an option in preferences where we can set fonts. There are two options: One is application font and other is system font. I am talking about elements 8 which I have but not sure that will solve your problem which is help related.
    Hope Help in 5th version is html which opens in Browser? Please confirm.

  • I am having a problem using Acrobat Pro in trying to merge documents.

    I am having a problem using Acrobat Pro to merge documents.   I can still use other functions withing Acrobat Pro.  Help - I have a deadline to meet!

    For product, there is an option in preferences where we can set fonts. There are two options: One is application font and other is system font. I am talking about elements 8 which I have but not sure that will solve your problem which is help related.
    Hope Help in 5th version is html which opens in Browser? Please confirm.

  • Problem using java String.split() method

    Hi all, I have a problem regarding the usage of java regular expressions. I want to use the String.split() method to tokenize a string of text. Now the problem is that the delimiter which is to be used is determined only at runtime and it can itself be a string, and may contain the characters like *, ?, + etc. which are treated as regular expression constructs.
    Is there a way to tell the regular expression that it should not treat certain characters as quantifiers but the whole string should be treated as a delimiter? I know one solution is to use the StringTokenizer class but it's a legacy class & its use is not recommended in Javadocs. So, does there exist a way to get the above functionality using regular expressions.
    Please do respond if anyone has any idea. Thanx
    Hamid

    public class StringSplit {
    public static void main(String args[]) throws Exception{
    new StringSplit().doit();
    public void doit() {
    String s3 = "Dear <TitleNo> ABC Letter Details";
    String[] temp = s3.split("<>");
    dump(temp);
    public void dump(String []s) {
    System.out.println("------------");
    for (int i = 0 ; i < s.length ; i++) {
    System.out.println(s);
    System.out.println("------------");
    Want to extract only string between <>
    for example to extract <TitleNo> only.
    any suggestions please ?

  • Display newline using out.println

    Can anyone tell me how can I put a new line using the out.println?
    Because I wanna to display the record in the following format
    which is
    Username : xxx
    UserID : xxx
    Age : xxx
    so on .....
    Actually I wanna to do it in a table form(HTML)....
    Can anyone suggest a better way to do it?

    Put the stuff in table then:
    <table>
    <tr>
    <td>username=<%=xyz%></td>
    </tr>
    <tr>
    <td>pwd=<%=abc%></td>
    </tr>
    </table>
    HTH,
    J.Clancey

  • How to put tab for alignment using out.println?

    can anyone tell me how to put something like \t in out.println of JSP/

    out.println("<blockquote>your text</blockquote>");

  • Is anyone having a problem using the nytimes digital subscription?

    i signed up for the new york times digital subscription on 28 march, then a few days later was told my account was canceled for nonpayment. according to customer service, my account is in good standing. but now when i try to access an article, i'm told i've already used my 20/month and wants me to pay again.
    i cleared the cookies and browsing history; tech support reset my password, but i still can't get access on firefox. no problems with internet explorer.
    any suggestions? thanks

    add me to the list. i have reluctantly concluded that the nytimes digital service is not compatible with firefox. over the past 5 days, i have had daily conversations with the nyt techies, who gave me the same useless advice: clear cookies and browsing history and reset password. i did so, repeatedly, but four passwords and hours of frustration later, the nyt digital service still refuses to recognize me as a home delivery subscriber entitled to total access and instead keeps telling me i have used up my 20 free articles. its techies now tell me that firefox is to blame in some way that they can't explain, and i must use internet explorer to access the nyt site. IE works fine but it is not my browser of choice, and i don't like having it open all day long, given its well known vulnerabilities. i am outraged that the nyt didn't see this problem coming, and is doing nothing to fix it! obviously, they have screwed up in a big way.

  • Having extreme problems using the new iMac, adobe CS5 (in particular InDesign) and OSX 10.8.2 (and now also 10.8.3) Mountain Lion

    Is anyone else experiencing the same thing? My computer is 2 months old and has hardly any files stored on it. Also, my
    Graphics  NVIDIA GeForce GT 650M 512 MB and my memory is 16 GB 1600 MHz DDR3.
    I am only running one thing on the computer as we speak - making a small pattern in InDesign - yet is has been frozen for over 20 mins, and that's not the first time this has happened.
    I updated to the latest Mountain lion this morning (10.8.3) and its exactly the same.
    I dont understand why this is happening, but on the older iMac i could run several windows of the entire creative suite without a problem - i was also using Snow Leopard.
    please help!

    noellia wrote:
    Is anyone else experiencing the same thing? My computer is 2 months old and has hardly any files stored on it. Also, my
    Graphics  NVIDIA GeForce GT 650M 512 MB and my memory is 16 GB 1600 MHz DDR3.
    I am only running one thing on the computer as we speak - making a small pattern in InDesign - yet is has been frozen for over 20 mins, and that's not the first time this has happened.
    I updated to the latest Mountain lion this morning (10.8.3) and its exactly the same.
    I dont understand why this is happening, but on the older iMac i could run several windows of the entire creative suite without a problem - i was also using Snow Leopard.
    please help!
    Do you have any Security/Anti-Virus software installed? Mackeeper? Any Third Party programs you have installed recently?
    Pete

  • Having a problem using Workflow to update a field based on ZIP code

    I created a Workflow to update a Yes/No picklist called eligibility based on a Text (Short) field called Applicant ZIP code.
    It's set to update on the Opportunity page:
    Before modified record saved
    And the value function is:
    IIf(InStr("60601_60602",[&lt;stApplicant_Zip_Code_ITAG&gt;|http://forums.oracle.com/forums/]+)&gt;0,"Yes","No")+
    That was a guess of how to try it while relying on my limited MS SQL & Access knowledge.
    It does work correctly using what I did. The problem I have is that I actually need to choose from over 600 ZIP codes. The function window only allows for 256 characters. (And I suspect my way is fairly inelegant for search a multi-thousand character string.)
    Any suggestions?

    I created a Workflow to update a Yes/No picklist called eligibility based on a Text (Short) field called Applicant ZIP code.
    It's set to update on the Opportunity page:
    Before modified record saved
    And the value function is:
    IIf(InStr("60601_60602",[&lt;stApplicant_Zip_Code_ITAG&gt;|http://forums.oracle.com/forums/]+)&gt;0,"Yes","No")+
    That was a guess of how to try it while relying on my limited MS SQL & Access knowledge.
    It does work correctly using what I did. The problem I have is that I actually need to choose from over 600 ZIP codes. The function window only allows for 256 characters. (And I suspect my way is fairly inelegant for search a multi-thousand character string.)
    Any suggestions?

  • Is anyone else having a problem using "search" in the store. Everything else seems find but selected search results produce a blank screen.

    Every time I try to use 'search' in iTunes, it will bring up available related results, but when you click one the results screen is blank. Plus I'm continuing to notice since downloading iOS 6 this phone seems a little glitchey and slow at times

    Same here. Searching iTunes Store and touching a result often results in blank screen. Hopeless isn't it. Can't select and download a film because of it. Stuff in the featured/category/chart sections selects ok, it's just searched items for me. Surely others have noticed same with ios6. This only happens on my iPhone 4. On iPad 3 search is fine but I think it's different because iPad 3 tends to bring a kind of pop out window when selecting.

  • Having a problem using touchEvents

    hi..this might be totally obvious but want to debug a mobile app on the laptop before trying it out on a phone but when using touchTap events or other touchEvents the laptop won't respond to mouseEvents...which makes sense but is there a way around it so i don;t have to go replacing events. thx

    If you're using only gesture events and have a Mac, the Magic Trackpad dispatches the same events as the Macbook Pro trackpad.
    There are systems to simulate multitouch events at the system level on win7.
                            http://multitouchvista.codeplex.com/

  • Is everyone who is having detection problems using XP S

    Trying to narrow down whats the deal with the product not being detected by such large numbers of users who have spend their hard earned cash on product that does not work and no tech support can fix. If this is a SP2 problem then maybe its time to reinstall XP with SP only?

    that's no SP2 problem, since the bug happens with other OS. It's more a software error/conflict, which is really hard to point out.

  • Is anybody else having big problems using the new pages?

    Everything has moved and even the help section isn't that helpful. I have been sitting in class for over an hour trying to make a portfolio, but can't because everything is so different. I have no idea how any of the changes are supposed to make it simpler. You can't even save as a word document! Instead there's all this export rubbish. I'm going to fail this class because of the new pages update. I have been putting off this update for weeks but since the newest OS update, everything is automatically updating so I had no choice. Actually make it easier, or make it possible to undo the update.

    It's been 7 months since it came out. Didn't you read the reviews in the App Store? Plus all the forum posts here?
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&mforum=iworktipsn trick
    Use Pages '08/'09 it should still be in your Applications/iWork folder.
    Peter

  • Having a problem using an Access 2003 database on a Windows 2012 Server

    We have an old application developed in Visual Basic 6.0 with an Access 2003 database.  We have recently migrated the application from a D-link data server to a new Windows Server 2012.  At first everything seemed OK, but then the application
    began running erratically slower, till after about two weeks it was unusable.  I have found various "fixes" for the problem which seem to have worked for some people and not for others.  We temporarily resolved the problem by rebooting
    the server but do not anticipate that will be a permanent solution.
    The one fix that would apparently work, to update the database to at least Access 2007, is not available to us as we would then have to rewrite our application and we cannot afford to do that. 
    What I am considering doing now is moving the database to a different platform while leaving the application on the network server (Server 2012). 
    In the course of researching the server problem, I encountered some suggestions that Windows 8 is incompatible with Access 2003.  We have one Windows 8 desktop, one XP and the rest are Windows 7. 
    I would be interested in people's opinions as to whether moving the database might solve the problem and also whether the Windows 8 machine might be contributing to the problem.
    LouatMonaco

    For VB6 support you might try here.
    http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
    For access compatability I'd ask over here.
    http://answers.microsoft.com/en-us/office/forum/access?sort=lastreplydate&dir=desc&tab=Threads&status=&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&tm=1412847746948
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

Maybe you are looking for

  • Spry menu rendering errors

    Hi, I created a spry horizontal menu bar in Dreamweaver.  It renders correctly in Dreamweaver designer but not in Firefox or Internet explorer. Below are three pictures.  The menu is the blue line above the title "Cliff Steele". The Firefox displays

  • Par file deployment error

    Hi I am trying to deploy the par file from NWDS. First time i was able to deploy with out any error. But after that i get the following error (Taken from sap-plugin.log) [30.05.06 / 11:05] #ERROR LEVEL# com.sap.portal.developmentTools.ideSpecific.ecl

  • HOW TO DELETE INBOX and outbox workflows  in SBWP

    hai TEch Pals,            Can any body  say , how to delete WORKFLOWS IN INBOX AND OUTBOX in SBWP. Thanks in advance . balaji.

  • Tiff file causing finder and preview to crash

    Intially I thought there was something wrong with finder however it seems to be just in relation to a tiff file. Also crashes when opening with preview but photoshop 6 is fine. Below it the problem report from preview. Can anyone help? Thanks! I've d

  • Can't see completed faxes

    I have an iMac g5 with OSX 10.4.9. I can send and receive faxes just fine using the built-in modem and my acrobat software BUT i cannot check to make sure my sent faxes were successfully sent. When I open my printer/fax preferences, and choose the "f