IndexOf() Method in JSP *Help*

I have a jsp with a textarea field. which gets user Id, The user can enter any text inside that . The problem here is I dont want the user enters any html tags inside that such as ">" or "<", I know I can use method indexOf(), but I dont know how??? can you please advice me.
following is sample of my code at the moment:
String ID = request.getParameter("id");
if (ID.equals("<") || ID.equals("<")) {...}
Thank you inadvance

String ID = request.getParameter("id");
if (ID.indexOf("<")>-1 || ID.indexOf(">")>-1) {...}Message was edited by:
jgalacambra

Similar Messages

  • How to access java method in JSP

    Hi all,
    I need to access java class (abstract portal component) method doContent() in a JSP which is under PORTAL-INF/jsp folder.
    I did
    <%@ page import = "com.mycompany.Aclass" %>
    <%com.mycompany.Aclass a = new com.mycompany.Aclass (); %>
    Aclass is coming as autofill/prepopulated with cntrl+space
    Till this time, it is working. no errors. But when I do
    a.
    a. (a dot) no methods are populating (autofill..cntrl+space) or If I forcebly add method a.doContent(req,res)... at runtime its giving error.
    It's not only with doContent method... Its with any simple methods in that class or any other class.
    (Other than doContent method in the APC java class are prepopulating/autofilling but giving error in runtime)
    Can anyone help me... how to access java method in JSP.
    I already gone through many SDN forum post... and implemented too---but no use I refered below forum thread
    Retrieve values from Java class to JSP
    URGENT! How to call a java class from JSP.
    Calling a java method from jsp file -
    this thread is same as my issue
    Thanks,
    PradeeP

    1st. The classes must be in packages. 2nd, the package that they are in must be under the WEB-INF/classes directory. 3rd Look on google and/or this site for web application deployment

  • Problems using GET method in JSP

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET method in JSP?
    If anyone have solutions, please let me know.
    thanks.

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in
    windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is
    good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET
    method in JSP?
    If anyone have solutions, please let me know.
    thanks.This problem appears, when one use UTF-16 encoding in JSP - am I right?
    If so there are two solutions:
    1) Temporary: Use "UTF-8" - or any other 8 bit encoding scheme and
    encode Korean symbols with "&1234;" kind of escapes - though it
    may not work
    2) Absolute: get my piece of code, which I have managed to write
    just a month ago resolving absolutely similar problem with UTF-16
    in code using Chinese/Russian/English encodings
    But I wouldn't say that it's costs 10 DDs :) - it's much more
    expensive... So try 1st variant if it wouldn't help - let me know.
    I'll figure :)
    Paul

  • Using bean methods within JSP declaration

    Is it true that bean methods will not work in JSP Methods ?
    For example:
    // get the bean
    <jsp:useBean id="FormValidate" scope="session" class="fsm.frontendCtr.FormValidate" />
    // build a new method in jsp
    <%!
    boolean validate(HttpServletRequest req, String submitFlag) {
    FormValidate.checkMandatory("ADRNACHNAME");
    %>ServletExec return:
    Undefined Variable or class name: FormValidate
    If i use the bean Methods outside the method it worx.
    Is there a trick with which I can use BeanMethods in a JSP Method?

    Is it true that bean methods will not work in JSP
    Methods ?
    For example:
    // get the bean
    <jsp:useBean id="FormValidate" scope="session"
    class="fsm.frontendCtr.FormValidate" />
    // build a new method in jsp
    <%!
    boolean validate(HttpServletRequest req, String
    submitFlag) {
    FormValidate.checkMandatory("ADRNACHNAME");
    %>ServletExec return:
    Undefined Variable or class name: FormValidate
    If i use the bean Methods outside the method it worx.
    Is there a trick with which I can use BeanMethods in a
    JSP Method?FormValidate is this Object. If you need others, pass them from parameters. Try to understand the structure of servlet generated by your JSP.
    <%!
    boolean validate(HttpServletRequest req, String submitFlag) {
    this.checkMandatory("ADRNACHNAME");
    %>
    hope this helps,
    yang

  • How to call java method using jsp

    how to call java method using jsp.....
    anyone can help me.....i having problem here...coz i very new in java and jsp.....
    thanks.....

    keep an eye on this person's thread...they have code there and everything.
    http://forum.java.sun.com/thread.jspa?threadID=777263&tstart=0

  • How to use protected method in jsp code

    Could anyone tell me how to use protected method in jsp code ...
    I declare a Calendar class , and I want to use the isTimeSet method ,
    But if I write the code as follows ..
    ========================================================
    <%
    Calendar create_date = Calendar.getInstance();
    if (create_date.isTimeSet) System.out.println("true");
    %>
    ============================================================
    when I run this jsp , it appears the error wirtten "isTimeSet has protected access in java.util.Calendar"

    The only way to access a protected variable is to subclass.
    MyCalendar extends Calendar
    but I doubt you need to do this. If you only want to tell if a Calendar object has a time associated with it, try using
    cal.isSet( Calendar.HOUR );

  • How can we write methods in Jsp ?

    I want to write methods in jsp in such a way that in one method I should have "Creating database connection" and in another method I want to create ResultSet and in another method I want to access the ResultSet.

    u can write methods in jsp using the following tag
    <%!
    public void myMethod()
    %>

  • Skip standard select method in search help exit

    Hi experts,
    how to skip standard select method in search help exit? Currently I'm selecting my custom data with select statement in 'DISP' section, but still text: 'more than 500 results were found' is shown. I just want to skip/disable standard selection. Thank you.
    BR
    Paul

    Hi check my weblog: https://wiki.sdn.sap.com/wiki/x/du0

  • My wife's iCloud locked and she is don't remember her email but she knows her old password and she don't have apple id how can she unlocked her iPhone or restore iCloud password. normal method can't help us

    my wife's iCloud locked and she is don't remember her email but she knows her old password and she don't have apple id how can she unlocked her iPhone or restore iCloud password. normal method can't help us

    Actually, I want her to have a separate iTunes account. Our marriage is fine, but our musical tastes are vastly different  That's another issue; right now want to focus on getting my wife in .icloud email address.

  • Casting an int to a string to work indexOf method

    I'm trying to see what interger value occurs in a specific token.
    For examplethe token: "6-" the integer 6 occurs.
    But I have to pass the indexOf method a string.
    if (tokenCountdown == 0)
         while(gotGoals != 1)
              String(varGoal);
              if (tokenStr.indexOf(varGoal) = -1)
                   goalsScored = (int)(varGoal);
                   gotGoals = 1;
                   varGoal++;
         }Any ideas on how to get around this?

    I have tokenised a text file and the specific token
    can contain a string of form XX-
    X being interger values.
    What I want to do is extract whatever integer value is
    XX and store it in a variable.
    Again, not clear. In "XX-X", are "XX" and "X" both integers? As in "12-3" and you want to extract "12" and "3"?
    Is the first int always 2 digits and the second always one? In short, what, precisely, are the invariants in terms of lenght, position, etc.?
    You reckon I cant use indexOf? What will you do indexOf on? If it's always "somenumber-someothernumber" then you can use indeOf("-") to find the split point.
    What method can I use?
    subString?You could use that in combination with indexOf("-"), yes.
    Or you could use StringTokenizer, or String.split, or regex if it's actually more complex than I've been assuming. Assuming it's always "num1-num2", but num1 and num2 are not fixed length (e.g. couuld be 1 or 2 digits) StingTokenizer is probably the simplest.
    If num1 and num2 are a fixed number of digits, you could just use substring, since you know exactly which positions you want.
    Ultimately, which is best depends on your constraints. What's variable, what's fixed, how much flexibility you need.

  • Calling method from jsp file

    Hi
    is it possible to call any method with in the class except handle method from jsp file?

    You can call , but it would not be a good design approach.A droplet can do the same task for you.
    otherwise :
    eg :
    <%@ page import="com.mypackage.MyClass"%>
    for Static access :
    <%
    String test= MyClass.myMethod();
    %>
    for normal classes :
    <%
    MyClass object = new MyClass();
    String test= object .myMethod();
    %>
    http://stackoverflow.com/questions/10918526/call-java-method-in-jsp-file
    http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag.html?page=2
    ```
    Praveer
    Edited by: Praveer Rai on Mar 26, 2013 5:08 PM

  • Can we overide jspService() method in jsp?

    can we overide jspService() method in jsp? Pls reply

    uh, what exactly do you know about the internals of JSP compilation?
    Apparently not enough to even think about doing anything like that or you'd know what your question makes no sense at all!
    The service method is generated at compile/generation time from the content of your JSP, which should give you a pretty good idea about why you can NOT override it inside the JSP...
    And seeing as you should never use scriptlets there's no place you should ever use where you could even define the overridden method.
    Nor is there any name you could give it as the name isn't predefined.

  • After trying many times with two different debit cards still does not allows me to buy a game from the app store gives error "YOUR PAYMENT METHOD WAS DECLINE.PLEASE ENTER VALID PAYMENT METHOD INFORMATION"  Please help me out

    I WANT TO PURCHASE NFS MOST WANTED GAME FROM APP STORE BUT IT DOESN'T ALLOW ME TO PROCEED FURTHER
    after trying many times with two different debit cards still does not allows me to buy a game from the app store gives error "YOUR PAYMENT METHOD WAS DECLINE.PLEASE ENTER VALID PAYMENT METHOD INFORMATION"  Please help me out

    In most cases, you can't use a Debit card anymore. So, either redeem an iTunes gift card or use a credit card.

  • Hello, I have a MacBook Air, when I was watching a movie it started to freeze, so I turned off. But when I turn it on just the white screen appears nothing else. I looked on other websites, but the methods didn't help.

    Hello, I have a MacBook Air, when I was watching a movie it started to freeze, so I turned off. But when I turn it on just the white screen appears nothing else. I looked on other websites, but the methods didn't help.

    Try a Safe Mode boot ...
    Startup your Mac in Safe Mode
    A Safe Mode boot takes much longer than a normal boot so be patient.
    Once you are in Safe Mode, click Restart from the Apple () menu.

  • How to access class method in jsp page

    hi ,
    I am new to JSP . I want to access a method returning an arraylist
    of a class.
    this class i saved in WEB-INF>classes folder > where other classes like logonform , etc. are saved ....
    import stmt is <%@ page import="java.io.*, java.util.*, readXml " %>
    <% readXml rd= new readXml();
    Arraylist list=rd.parseDoc();
    %>
    It is not recognizing readXml class......
    Can any body help me in this regard......
    plz help .... i m in urgent need
    thanks in advance.......

    better to put class in a pkg inside webinf> classes folder ...
    but in my case constructor was not public......
    public readXml(){}
    now it works fine...... :)

Maybe you are looking for

  • How can I hide a JPanel?

    I have some JPanels and using the mouse motion listeners you can scribble on them. I want to be able to switch between these panels but the problem is the drawings get wiped off when I use repaint() and frame.add(panel). Any ideas how else I could tr

  • Com.sun.identity.authentication.spi.AuthLoginException:

    Hello - I'm currently trying to integrate IDM 7.1, Access Manager 7.1 and Directory Server 6.0... The problem that I am running into is trying to register Access Manager 7.1 as a resource in IDM: I am utilizing the Sun Java Access Manager Realm Resou

  • HOW TO REINSTALL THE GATEWAY PLUGIN in Mountain Lion

    The gateway keeps crashing when I try to download sofware off of Amazon's site. Their support instruscted me to look here to find the solution. I would appreciate any advice on how to either replace what I am told is a plug-in - or some other way to

  • What is crystal report?

    Anyone know what is crystal report? Can someone provide a brief graphical information of crystal report linking to J2ME? Willy

  • SAP B.S 7.0 VS SAP ECC 6.0

    Dear Experts, Want to share something & ask also. Yesterday I have attended one interview for SAP FI Consultants Trainee position. In my CV I have mentioned about my certification in SAP FI module which I have taken in Sept 2011. The interviewer aske