Results 1 to 3 of 3

Thread: JSP help

  1. #1
    hussain4hunt is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default JSP help

    Can any one help me to solve this please

    <%@page import="myutil.*" %>
    <%String input = request.getParameter("s1");%>
    <%String occur = request.getParameter("s2");%>

    <%int output=B.repeatCount("input","occur");%>

    <%=input%>

    In the above code , i want to pass the variable of Strings input and occur to the method repeatCount.. can any one suggest how to do it
    for example if i get input = abc and occur =qwe
    i want to get in the generated servlet as follows:
    int output=B.repeatCount("abc","qwe");

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    uh wouldn't it be just this, without the quotes o the name of variable. ?

    Java Code:
    <%@page import="myutil.*" %>
    <%String input = request.getParameter("s1");%>
    <%String occur = request.getParameter("s2");%>
    
    <%int output=B.repeatCount(input,occur);%>
    
    <%=input%>
    I mean, you can't have a request parameter read from the URL, after a JSP has been compiled into a Java class, influence the generation of the Java class, so that the parameter entered becomes a literal string constant in the generated java class.

    perhaps it might be possible to have something that would write out a jsp page inside your application folder, and then if the user invoked that generated jsp page, it would have the literal string value, i guess.

  3. #3
    hussain4hunt is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by travishein View Post
    uh wouldn't it be just this, without the quotes o the name of variable. ?

    Java Code:
    <%@page import="myutil.*" %>
    <%String input = request.getParameter("s1");%>
    <%String occur = request.getParameter("s2");%>
    
    <%int output=B.repeatCount(input,occur);%>
    
    <%=input%>
    I mean, you can't have a request parameter read from the URL, after a JSP has been compiled into a Java class, influence the generation of the Java class, so that the parameter entered becomes a literal string constant in the generated java class.

    perhaps it might be possible to have something that would write out a jsp page inside your application folder, and then if the user invoked that generated jsp page, it would have the literal string value, i guess.
    thanks for ur quick reply ... i got it

Tags for this Thread

Posting Permissions

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