Same as PHP Functionality In JSP, HOw?

Hi,
I am a developer having experiance in PHP with Oracle, I recently have projects to develop in JSP, I want know does JSP also have the Variable in Variable functioanlity in as it's available in PHP?
In php I stored my variable name in a PHP variable as
$Asif='My Name is Asif';
$a='Asif';
Echo "Here we can get the result of variable Asif using variable a: ".$$a;
in the above by using $$ it understand the inside value is the actual variable name whose value is to print..
I need same functionality in JSP.....
if Any one can help...
THanks in Advance.
Asif

The same rule applies for textboxes as for checkboxes with the same name - indeed for any components accessed in the dom via javascript.
If there is only one element of that name, it is accessed directly.
If there is more than one element of that name, it reveals them as an array.
so document.testForm.a_date would return an array of input fiels
document.testForm.a_date[0], document.testForm.a_date[1] ... document.testForm.a_date[n]
However the order of submission of parameters is NOT guarunteed, which is why people normally DON'T have fields in this manner - because you can't know for certain that a_date[1] matches with b_date[1] at the server end.
The common practice is to give each field a unique name (numbered).

Similar Messages

  • Convert 'chr' php function in jsp

    Hello everybody
    I'll try to convert this php code in jsp but i've got several errors when using the "replaceAll" java function.
    I aim to have an html editor to insert it in my website forum.
    Can somebody help to solve this problem, otherwise, can anyone provide me an example of an html editor written in jsp.
    $conceptRTEvalue = str_replace(chr(92).chr(34),chr(34),$conceptRTEvalue);
    //convert all types of single quotes
       $tmpString = str_replace(chr(145), chr(39), $tmpString);
       $tmpString = str_replace(chr(146), chr(39), $tmpString);
       $tmpString = str_replace("'", "'", $tmpString);
       //convert all types of double quotes
       $tmpString = str_replace(chr(147), chr(34), $tmpString);
       $tmpString = str_replace(chr(148), chr(34), $tmpString);
       //replace carriage returns & line feeds
       $tmpString = str_replace(chr(10), " ", $tmpString);
       $tmpString = str_replace(chr(13), " ", $tmpString);

    What are the errors?

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • How to realize print function in JSP

    How to realize print function in JSP? I know use Javascript:window.print() can print,but it will print whole page,it don't fit me;Another method is to write JSP into Excel and then print it in Excel,but it don't fit me too,because it don't print directly. Anybody know how to print it directly?

    Many websites offer a "printer friendly" version of a certain page. That IMO is the only way to solve your problem, next to using CSS to use a different style for printer output. Here is a tutorial that covers this:
    http://www.alistapart.com/stories/goingtoprint/

  • How to write printing function using JSP?

    dear all,
    i want to add a printing function in my project but i do not know how to do it? could anyone teach me how to do it?
    thanks
    eric

    salut eric,
    you can do it this way :
    1 - create a html link in your code to this javascript
    function : (I am using Struts, but you can write it in
    pure html
    <html:link href="#bodyStart"
    onclick="openWindowForPrinting()"
    titleKey="msg.status.print">      <bean:message
    key='app.print' />
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html:link>
    >
    >
    2 - here is the javascript function : it open a window
    with the "print.jsp" page.
    function openWindowForPrinting(){
    window.open('/your_project/pages/common/print.jsp','',
    'left=150, top=150 , status=no, directories=no,
    toolbar=no, menubar=yes, location=no, scrollbars=yes,
    resizable=yes, dependant=yes');
    3 : here is the print.jsp page : You have only to
    create a session variable called
    "currentBodyRelativeLocation", which content the
    relative URL to the page you want to print (for
    example, the boby of the current page).
    <%@ taglib uri='/WEB-INF/tlds/perso.tld'
    prefix='perso' %>
    <html>
    <head>
    <perso:csslink page='${cssRelativeLocation}' />
    </head>
    <body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; printPage();; window.open = SymTmpWinOpen;">
    <body>
    <jsp:include page="${currentBodyRelativeLocation}"/>
    </body>
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html>
    <script language='javascript'>
    function printPage(){
    window.print();
    window.close();
    </script>
    hai,
    i'm not very understand how is your code work. when i write html code, do i need to mind about this code: "msg.status.print" ? what is this code mean?
    i have too much question on this thing. would you mind to be further explain to me? or is it any reference for me to refer? i'm really new to write printing function on JSP.
    i never write this function before. i'm feel so lost.....:(
    thanks again
    eric

  • How to call a php function from java...

    helllo fellow java developers!
    Im trying to figure out how I can call a php function from my java code.
    I know it sounds a bit unintiutive, seeing how java is a rich programming language, BUT java simply cannot do the task that the php script can do. It simply acts differently.
    So I am trying to call a php function, that returns a string object, and capture that string object....
    is this possible?
    something like....
    String strMyString = phpFunction( strVariable )
    ???????/ any ideaS?

    idea #1 - come up with a better plan that doesn't involve invoking php from java.
    Give one example of something php can do that java can't.
    idea #2 - forget java, and just write it in php.
    Involving multiple frameworks/languages/runtime environments is a recipe for an overcomplicated solution that will be impossible to maintain.
    I'd say keep it simple and stupid, and stick with one language.
    If you're still hooked on the idea, maybe try [this link|http://www.infoq.com/news/2007/10/php-java-stack]

  • How to run the recursive function in jsp

    hi, can any body tell me how to run
    rrays.sort(files);
    for (int i = 0, n = files.length; i < n; i++) {
    for (int indent = 0; indent < indentLevel; indent++) {
    System.out.print(" ");
    if (files.toString().endsWith(".jsp"))
    System.out.println(files[i].toString());
    if (files[i].isDirectory()) {
    listPath(files[i]);
    indentLevel--;
    this code in jsp
    thanks in advance

    Why are you writing scriptlets and functions in JSPs?
    Functions are supposed to be written in the Java Application layer.
    JSPs are best suited only to display information.
    Also why are you using Scriptlets insted of JSTL ?
    Anyway, if you want to write in JSPs only , here's how to write a function in them: http://forum.java.sun.com/thread.jspa?threadID=496577&messageID=2341986 you can figure out the rest.

  • How to create download function in JSP?

    Can I know how to make a download function in JSP? Any sample?. Thank You very much!

    http://forum.java.sun.com/thread.jspa?threadID=5312541&tstart=0
    Sorry but whining about it in duplicate threads doesn't help.
    HELP DENIED!

  • How to retrieve a string value from a PHP function call

    Should this string be the return value of the PHP function?
    Or should it be embedded in the response HTML? Any examples?

    This is what I got so far:
    footer.mxml in Flex Builder 3:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="ts_request()">
    <mx:Script>
    <![CDATA[
    public function ts_request():void {
    timestampRequest.send();
    ]]>
    </mx:Script>
    <mx:Canvas width="836" height="36"
    backgroundColor="#05075C">
    <mx:Label id="timestamp"
    text="{timestampRequest.lastResult.timestamp}" color="#FEFEFE"
    height="20" y="10" textAlign="left" width="221" x="10"/>
    </mx:Canvas>
    <mx:HTTPService id="timestampRequest" url="
    http://www.ABC.com/timestamp.php"
    useProxy="false" method="POST" />
    </mx:Application>
    Here is the timestamp.php on the www.ABC.com web server. I
    have tested the php by directly access it with
    "www.ABC.com/timestamp.php" and it shows the timestamp correctly:
    <?php
    putenv($timezone);
    $Return = "<timestamp>".date("m/d/Y H:i:s", time())."
    CST"."</timestamp>";
    print($Return);
    ?>
    When I run footer.mxml in Flex 3 Builder, I got an error:
    This file cannot be launched.
    Where did I do wrong?

  • How to call userdefined function in JSP

    Iam writing my own method in JSP ,how to call that method.
    thanks in advance
    thanks
    -RR-

    <%!
    static void sayHello(ServletOutputStream out){
    out.print("Hello");
    }%>
    <%
    sayHello(response.getOutputStream());%>
    You method can either be static or not, but in both case avoid instance/static variables as you will get concurrency issues
    if you use tomcat, take a look in tomcat/work/catalina/_localhost/org/apache/jsp
    open the .java file generated by the container and you will quickly understand how this works

  • Passing values to JavaBean function using jsp scriplet

    Hi,
    I have a JavaBean funtion that is SaveData(parameters)
    which save the values from HTML form.
    Now i want a code for pass the values from HTML form to SaveData() function using jsp scriptlet.
    I used the code
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(phonenumber,manufacturer,model,email,country,newsletter)%>
    Here
    JDBCBean -> Bean Name
    phonenumber,manufacturer,model,email,country,newsletter ->HTML form's text values
    But it didnt work properly.
    Anyone help me to correct this.

    Hi,
    i have the same code like above
    I have to pass the parameters with form name under the following code.
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values)%>
    Here
    registration -> HTML form name
    But i got the error for
    package registration does not exist
    out.print(JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values));
    How to i correct this?
    Anyone help me......

  • Taking my PHP/MySQL site online - how?

    Hi,
    Once I have developed a site on my local PC in DW, utilizing
    PHP and MySQL Administrator, how do I make it work online?
    Obviously I need to use the built-in FPT function in DW - but
    how do I transfer the database files to the server?
    I have searched for an anser to this question for a long time
    - but all the tutorials I find (and I have found a number!) help me
    develop my site locally - and then say nothing about taking it
    online.
    I have developed a number of sites using ASP/Access. When I
    take such a site online, I need to change the connection-string. Is
    the process the same for PHP/MySQL sites? If yes, what change do I
    need to make? And what database-file do I upload to the server, and
    where do I put it?
    Here is where I want to get: I want to have my site locally,
    so that I can make any changes to it when necessary - and then
    upload it so that it now uses the online database. ASP/Access
    allowed me to have both locally, so that I could make any changes.
    Downside is of course you have two versions of the database, one
    local, one remote.
    My host uses PHPMyAdmin. I see I can download a version of
    this and use it locally. Should I do that and use that? Does it do
    the same as PHP Administrator?
    As you can see I have many questions. I think I am missing a
    few key-thoughts that will help me understand PHP and MySQL and
    make go "oh, now I get it!'
    Please feel free to point me to tutorials that you believe I
    will find helpful.
    Thanks for your help in advance!
    Rogier

    RogierBos wrote:
    > Hi,
    >
    > Once I have developed a site on my local PC in DW,
    utilizing PHP and MySQL
    > Administrator, how do I make it work online?
    >
    > Obviously I need to use the built-in FPT function in DW
    - but how do I
    > transfer the database files to the server?
    >
    > I have searched for an anser to this question for a long
    time - but all the
    > tutorials I find (and I have found a number!) help me
    develop my site locally -
    > and then say nothing about taking it online.
    > I have developed a number of sites using ASP/Access.
    When I take such a site
    > online, I need to change the connection-string. Is the
    process the same for
    > PHP/MySQL sites? If yes, what change do I need to make?
    And what database-file
    > do I upload to the server, and where do I put it?
    >
    > Here is where I want to get: I want to have my site
    locally, so that I can
    > make any changes to it when necessary - and then upload
    it so that it now uses
    > the online database. ASP/Access allowed me to have both
    locally, so that I
    > could make any changes. Downside is of course you have
    two versions of the
    > database, one local, one remote.
    >
    > My host uses PHPMyAdmin. I see I can download a version
    of this and use it
    > locally. Should I do that and use that? Does it do the
    same as PHP
    > Administrator?
    >
    > As you can see I have many questions. I think I am
    missing a few key-thoughts
    > that will help me understand PHP and MySQL and make go
    "oh, now I get it!'
    >
    > Please feel free to point me to tutorials that you
    believe I will find helpful.
    >
    > Thanks for your help in advance!
    >
    > Rogier
    >
    Sounds like you need to export your database and then import
    it into
    your production server. Then upload the website, adjust the
    connection
    string so that its pointing to the correct server with the
    correct
    credentials and away you go.
    Steve

  • A friend of mine uses my apple id. he's getting same imessages beeing sent to me. how can i remove his device from my account

    a friend of mine uses mi apple id. he's getting same imessages beeing sent to me. how can i remove his device from my account

    Using FaceTime http://support.apple.com/kb/ht4319http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/http://www.apple.com/ca/ios/messages/
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Set Up Alert Sounds
    http://www.quepublishing.com/articles/article.aspx?p=1873027&seqNum=3http://www.quepublishing.com/articles/article.aspx?p=1873027&seqNum=3
    Extra FaceTime IDs
    http://tinyurl.com/k683gr4http://tinyurl.com/k683gr4
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htmhttp://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Fix Can’t Sign Into FaceTime or iMessage iOS 7
    http://ipadtutr.com/fix-login-facetime-imessage-ios-7/http://ipadtutr.com/fix-login-facetime-imessage-ios-7/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.htmlhttp://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457#19087457https://discussions.apple.com/message/19087457#19087457
    How to watch FaceTime calls on the big screen with Apple TV
    http://www.imore.com/daily-tip-ios-5-airplay-mirroring-facetimehttp://www.imore.com/daily-tip-ios-5-airplay-mirroring-facetime
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.htmlhttp://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    How to Receive SMS Messages on an iPad
    http://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.htmlhttp://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • Access session variable in Java Function in JSP

    Hi Experts !!
    I am developing an application using STRUTS MVC...
    Very sorry if u have problem understanding my question, i ll try to improve... and sorry if i can't post codes here
    Basic question is ....
    I want to open a word document on pageLoad of JSP, the word document is not a single document, there is a form in which there is a "name" and "template" whenever user clicks on a button there is one action attached to it which creates a copy of that template in a different folder.. on the next page OnLoad i want to open that particular document. for that i have created a variable and also have set in the session, just want to access it in the below code.
    I have a formbean in which i have a variable, the scope is session, that variable i have put it in session also. but i want to access that variable in a "java function" in JSP so that "onLoad" page that function should work.
    JSP---
    <script type="text/javascript">
    function openDocument() {
    var w = new ActiveXObject("Word.Application");
    var docText;
    var obj;
    var a;
    if (w != null) {
    w.Visible = true;
    obj = w.Documents.Open(I HAVE TO ACCESS THAT VARIABLE HERE);
    </script>
    FORMBEAN----
    public class CreateSOWFormBean extends ActionForm {
    private String workflowName;
    private String comment;
    private String sowTemplate;
    private String sowFileCreated;
    public String getSowFileCreated() {
    return sowFileCreated;
    public void setSowFileCreated(String sowFileCreated) {
    this.sowFileCreated = sowFileCreated;
    sowFileCreated is the variable that i have accessed in session and that value i have to pass in that function in JSP....
    I am aware of something like
    obj = w.Documents.Open(<%'sowFileCreated'%>);
    but i m not sure how to write....
    Plz help.....

    If you're working under a framework like struts you should definitely be using JSTL tags rather than scriptlet code to access variables within the page. With JSTL code <% codes can be almost entirely avoided.
    To transfer a value from a Servlet to a JSP don't use a session variable, use a request attribute. Session variables should only be used when values have to survive from one transaction to another.
    You can write something like:
    obj = w.Documents.open('<c:out value="${openURL}"/>');in the Javascript portion of your JSP.
    Just beware of potential problems with quotes. The coresponding code in the Servlet would be like:
    request.setAttribute("openURL", openUrl);

  • Enable data paging with parameters count() on new php function issue (BUG?)

    I've got my app prototyped quickly with the default settings in Flex Builder 4.  Now I'm going back and adding/modifying features to polish the app off.
    For this application I'm using PHP5 as the server side.
    The data paging is really cool and simple to call using the default settings.  However, I'm running into issues with customizing the data paging feature.
    This is the default header of the php function that was created for me:
    public function getTblbrowserrecord_paged($startIndex, $numItems){...}
    Instead of dumping all data back to the function I want to be able to search on certain fields so I created a new function called:
    getTblbrowserrecord_search_paged ($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems  ) {...}
    The new function is tested and operates as designed.
    I set the input types of the variables and return type (Tblbrowserrecord[]) of the new function then went to enable data paging.  The first screen came up and asked me for the key to use which I selected.  The next screen came up and asked me for the number of records which I set to 100 then went to select the count operation.
    I initially selected the automatically created count() function but it came up with the error " Count operation parameters should match the paged operation parameters list."
    So I created another function to match the search function's parameter's list:
    public function count_searched($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems)  {...}
    But I still ge the error "Count operation parameters should match the paged operation parameters list."
    But they DO match.  I looked at the default functions that were created by FB4 and noticed that the automatically generated function count() has no parameters and the paged function has the two functions $startIndex and $numItems which are not identical yet they work.  I tried removing those two fields from the count function but got the same results.
    What am I doing wrong?
    Thanks!

    Nevermind... For some reason my FB4 is not updating correctly.  After removing the two control fields at the end of the list AND exiting the app/re-entering everything worked ok.  I've been having this issue a lot lately and am thinking that is is a bug of some sort?

Maybe you are looking for

  • Help, I am unable to add my browsers

    I have been using Dreamweaver just fine and was able to preview my work in my browser using the Preview Icon. I had several browser options listed then all of the sudden they have disappeared.  Now, the only option to preview in Adobe Browser Lab. I

  • Searching for data

    I have a program that reads from a notepad file into an array, the user is then to enter a number into a message box and the program is supposed to find all entries like that find the average number and then show the highest number as well. how do i

  • BRUSH TOOL NOT SMOOTH

    I have an issue with my Cintiq not drawing smoothly in Flash. I need to sketch incredibly fast and loose. Flash used to work just fine but now it suddenly began drawing really crummy. I posted some examples of flash as well as Photoshop, Sketchbook P

  • Third posting : Where can I get document on WLI 8.1 DB schema?

    Hi All, I could not able to find the document on DB schema used in WebLogic Integration 8.1 in BEA e-docs site. Can somebody pass it on to me OR point to me to appropriate location?? Thanks, Prashanth Bhat.

  • Session disconnects when executing procedure

    For some reason when I execute my procedure I get a ORA-00603: Oracle server session terminated by fatal error. When I comment out the section of code below, the procedure executes without issue. I've run an Explain Plan on this SQL, but the cost is