How To Make Void That Prints Something In JSP

hi Everyone I'm Very New To Java & JSP I'm Expert In PHP , Anyway . .
I want A Code like The Following Print Something Out :
<%@ page import = "java.io.*"%>
<%!
public void str_repeat(String str2,int num){
     int i;String FINAL="";
     for(i=0;i<num;i++)FINAL=FINAL+str2;
     System.out.print(FINAL);
%>
<%
str_repeat("SOMETHING",2);
%>And Please I don't Want Anyone to Come UP with A Function That Makes The String Repeat (( I Wan To Learn How To Make A Void That Outputs Something )) And Not A Function . .
notice : The Above Code Gives Nothing At All And When I Use
out.print Instead Of System.out.print It Gives Error

My Code Now Is As Follows :
<%@ page import = "java.io.*"%>
<%!
public void str_repeat(String str2,int num, JspWriter out){
     int i;String FINAL="";
     for(i=0;i<num;i++)FINAL=FINAL+str2;
      out.print(FINAL);
%>
<%
str_repeat("SOMETHING",2, out);
%> and it gives the following error :
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 17 in the jsp file: /index.jsp
Unhandled exception type IOException
14: public void str_repeat(String str2,int num, JspWriter out){
15:      int i;String FINAL="";
16:      for(i=0;i<num;i++)FINAL=FINAL+str2;
17:       out.print(FINAL);
18: }

Similar Messages

  • How to make it repleatedly printed out by using timer??

    Dear Friends:
    I have following code to run, When I press R to repeat println, only 1 line print out,
    But I hope to make it continueously print out.
    How to make it repleatedly printed out until I press CTRL + C key ??
    Thyanks
    import java.util.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    public class CertainAndRepeatTime{
      public static void main(String[] args) throws IOException{
        int delay = 1;
        Timer timer = new Timer();
        ActionListener actionListener = new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              System.out.println("Hello World Timer");
        System.out.println("What do you want (Certain time or Repeat time)?");
        System.out.print("Please enter \'C\' or \'R\' for that: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String ans = in.readLine();
        System.out.print("Please enter  ans=" + ans  + " IsTrue=  " + (ans.equals("R") || ans.equals("r")) +"\n");
        if (ans.equals("C") || ans.equals("c")){
          //System.out.println("This line is printed only once start...");
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed only once.");
          },delay,1);
        else if(ans.equals("r") || ans.equals("R")){
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed repeatedly.");
          },delay, 1000);
        else{
          System.out.println("Invalid Entry.");
          System.exit(0);
        System.exit(0);
    }

    The Timer is working fine, but because it runs in another Thread, your program is ending before the Timer can repeat.
    The simplest way to make your program wait until it is force-quitted as you describe would be to make an infinite loop (although this isn't very good practice), like this:
        else if(ans.equals("r") || ans.equals("R")){
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed repeatedly.");
          },delay, 1000);
        while(true){} //This will make your main thread hang.
        }A better way, though, would be to listen again with your System.in reader until they enter a letter that means quit.

  • HT4515 How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    Double tap the Home button, tap & hold the Safari icon until it starts to wiggle, tap the red minus sign to remove it from the Multi-Tasking bar. Tap the Home button when finished.

  • How to make table that will include controls such as drop list?

    How to make table that will include controls such as drop list?
    I need to create table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...

    Hi Nadav,
    I figured out where I missed your point. When you wrote
    table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...
    I was thinking mixed data-types in a [2d] table!
    Looking at the property browser again it looks like no single LV function can do all of that. It can be developed as a pop-up (like the browser is set-up) and then code all of the elegance using an event structure to control the background color of a string indicator while controling the visability of rings that are only made visable when a mouse down is detected. That will get you pretty close.
    So no, my previous response ws not correct for what you are trying to do if you want to duplicate all of the wistles and bells of the property browser pop-up window.
    Please forgive my distraction.
    Ben 
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to make sure that schema name is not included with generated sqls

    How to make sure that schema name is not included with generated sqls with tableadapter wizard.
    What should I use? Oledb, ODT.NET, where can set that I want "pure" sqls, not schemas, not ", or anything like this
    I want
    "Select a,b from t1" ,not "select "a","b" from schema.t1"
    Also schema name is put in all parameters, all over the place... What if schema name changes. (b1test to b1prod)
    . I now manually edit XML files of dataset. It works but....
    thanks

    The full hardware :
    Processor Intel core due 3.00 MHz
    RAM:1.5GB
    psu:650 Watt (but i baught i cheap one so it may be actually about 400 watt)
    HD Disk:160 GB
    But about the power supply if it not able to run the VGA card ,Is it will not show any screen or it will not able to run the computer??

  • How to make report that contains only summaries?

    How to make a report in Designer/2000 that shows only summary fields? For example something like:
    select count(*) from emp;
    null

    How to make a report in Designer/2000 that shows only summary fields? For example something like:
    select count(*) from emp;
    null

  • How to make a wireless printer?

    I have laptop with wifi,  and  have a wireless router  ,a HP color Laserjet 1515n.  now I  want to  put the printer  in the other room  far from the router and  laptop.  how can I  make a  wireless printer(no wire connect to the router)?  shall  I  buy  a  device?  what  kind  device?  thank you!
    This question was solved.
    View Solution.

    As far as I can tell your printer only has a USB connection, right?
    If so, you may be able to buy a wireless print server, but they are somewhat difficult to set up.  If you buy one, get one the same brand as your wireless router (I don't think HP makes one for this printer from my quick search). 
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • How to make sure that Invoices went through?

    I'm not sure if this is the right place to ask this question about EDI/IDocs.
    I want to make sure that the invoices for a particular day were received by the customer. How can I do this at the SAP level?
    I checked in WE02 and it shows me quite a few IDocs with status "07 Error during syntax check". Others are "53 Application document posted". But the customer complains that they have not been getting any invoices. Also, is there a way to see which IDoc number belongs to which Invoice number?
    Please suggest.
    Thanks

    Hi John,
       If you double click on the status 26 in IDOC (Txn. WE05), it will show you the error message with details of the error. Also you will notice that the IDOC is displayed as flat structure as opposed to a hierarchy. If IDOC is successfully sent out it will have a status record with status "03". I am not sure how you EDI subsystem is setup,  but if you are sure that it has been passed to EDI subsystem then why not check in the logs on EDI subsystem whether is was processed or not.
    Cheers,
    Sanjeev
    Message was edited by: Sanjeev Singh

  • How to make apparent that the VM is starting...

    Hello,
    even on pretty recent Windows boxes, the Java VM may take a few seconds to come up, especially the fist time it is launched. If the user double-clicks on a desktop icon that launches a Java-based application, nothing seems to happen for a while. Is there a way to make apparent that something is going on? For instance, is it possible to temporarily change the mouse cursors' appearence until the VM is warm?
    TIA to all volunteers.

    java -splash:"exedata\icons\MainTripBackgrounds\AAAwelcome.jpg" -Xms10m -Xmx500m -jar Presenter.jar
    is well working

  • How to make it that when i click my logo, it goes to the home page?

    I want to make it on my website, that when i click on my logo on the top of my webpages, it should go to the home page. How can I do that?
    My website is www.iphoneappguru.com
    Thanks!
    -RahulR

    Select the logo in iWeb and use the Inspector/Link/Hyperlink pane to link the logo image to "One of my pages"
    Click to view full size
    However, I would not use the First menu option but select the page name instead.
    OT

  • How to make sure that Safari opens in Full Screen

    When I open Safari in Mountain Lion it does not open in Full Screen.  I then get it there.  I close it.  I open it.  Does not open in full screen.  How to make it do so?

    you can download my fla project from here : http://www.megaupload.com/?d=V7QQ417Sthanks for help

  • How to make sure that "hello" uses gmail to send the invites?

    I am trying to invite someone to join a hello conversation but hello uses applemail in stead of my preferred gmail

    hi klaus, please make sure that you have set gmail as preferred app to handle mailto:-links in the firefox options like it's described in [[Change the program used to open email links]]

  • How to make a custom print template as a base template?

    Is there any way we can make a custom print template as a base template for the the QLDs we make in SAP instead of the one given by SAP?
    Bharath S

    Bharath,
    Your question is not very clear.  Is this thread good for you?
    Rename a query linked to QLD
    Thanks,
    Gordon

  • How to make J2EE engine auto load The JSP Pages

    After I modify some JSP pages, If I just copy them to  the folder in the Server, The pages didn't update.
    How to make it auto update?

    Hello Shen,
    please take in consideration, that JSP page is translated to HttpServlet  component when deployed. It's not accessed via original JSP file.
    You can try to modify the final HttpServlet class file, but then you have to go through pre-compiling.
    Hope it helps,
    regards.
    mz

  • How to Make Sure that the Apple Device and Printer are on the same Network

    Depending  on when one looks on this page, one can find members posting about issues with AirPrint or not being able to find the printer to use AirPrint. The first Item that people are told to check is the Apple Device’s settings. Sometimes the person giving instructions breaks down what to check and how to check and sometimes they do not.  Below is a video that walks one through how to print a network configuration page, what information they need to pull from that report and how to then access the Apple devices’ settings and put the device on the same network as the printer.  It then walks one through printing to the printer using the AirPrint feature. 
    I am a former employee of HP...
    How do I give Kudos?| How do I mark a post as Solved?
    This question was solved.
    View Solution.

    I hope that this is helpful. 
    I am a former employee of HP...
    How do I give Kudos?| How do I mark a post as Solved?

Maybe you are looking for

  • Refreshing tab strip

    Hello Experts, I am working on Web Dynpro Java and I have created two tab strips and when I select the first tab for the first time the contents of that tab strip gets generated and the same with the second one. Now when I make changes in the second

  • Third party Client copy tools -

    Hi, We have a production system copy in our QA which has about 6.5 terrabyte. How do we know the size of the client in that system? If I have to make another client copy in my QA it will be highly impossible - considering storage, memory, backup time

  • Bridge email not loading...

    bridge kinda works... ive never been able to connect bridge browser, however everything else worked fine... until today... all of a sudden, my bridge email stopped responding ... restarted both torch and pb...now it onoy stays at white screen with th

  • Problem installing CM on WAS 640

    I have installed ep6 and now I am trying to install CM and I get the following error. ERROR 2004-10-30 23:53:45 CJS-00278 SAPinst could not complete the upgrade. Some components could not be upgraded. Contact your local support center. Thanks Jeremy

  • Tab Order Control on Custom Screens

    Does anyone know how to set the tab stops on a custom screen?  I would like to change the order of where the cursor goes when I hit the tab key.