[SOLVED]Convert JSP to static HTML...
Hi guys... Sorry I wasn't able to get back to you immediately on this question I had asked... I was pretty busy on other things and had asked my friend to work on the same... The way he had implemented was by using the Apache Commons HTTP Client... Here is code snippet... It's very simple... HttpClient client = new HttpClient(); StringBuffer url = new StringBuffer(http://localhost:8080/E47;); url.append(/CMSWebDriver?actionName=aacommandName=ccId= + Id); // Create a method instance. HttpMethod method = new GetMethod(url.toString()); // Execute the method. try { // execute the method. int statusCode = client.executeMethod(method); } catch (HttpRecoverableException e) { System.err.println(A recoverable exception occurred, retrying. + e.getMessage()); } catch (IOException e) { System.err.println(Failed to download file.); e.printStackTrace(); System.exit(-1); } // Read the response body. byte[] responseBody = method.getResponseBody(); // Release the connection. method.releaseConnection(); Thanks to all that gave me inputs... They were really useful -Joseph Nicholson, Robb [EMAIL PROTECTED] wrote: The Apache Commons HTTP Client (see org.apache.commons.httpclient.* packages) makes it pretty easy to make HTTP requests and get the response back as a String. -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 4:28 PM To: [EMAIL PROTECTED] Subject: Convert JSP to static HTML... Hi All... I have a specific requirement in my project... I want to convert the JSP pages to static html pages and save them in a local directory... How do I achieve this functionality??? Any suggestions appreciated. Thanks much. -Jacob - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
JSP to static html...
Hi All... I have a specific requirement in my project... I want to convert the JSP pages to static html pages and save them in a local directory... How do I achieve this functionality??? Any suggestions appreciated. Thanks much. -Jacob - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Convert JSP to static HTML...
Hi All... I have a specific requirement in my project... I want to convert the JSP pages to static html pages and save them in a local directory... How do I achieve this functionality??? Any suggestions appreciated. Thanks much. -Jacob - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Re: JSP to static html...
Actually, this is therequirement... One jsp page(contains scriptlets, dynamic values. etal) in the current application generates a report. Now, I need to present with a button at the end of the page. When I click on that button, this page should be converted into a static html and then ftp this html page to one of the servers... I know uploading could be done without probs... But, the only question I have is how do I convert that page into an html??? David Erickson [EMAIL PROTECTED] wrote: I don't know the layouts of your jsps or what you are doing in them.. but JSP's are inherently non-static because they use runtime expressions to generate the html, and that can change on a per request basis. If you are using strictly html and no RT expressions or tags or anything I don't see why you couldnt just rename the extension from jsp to html and save it wherever you want. -David - Original Message - From: Jacob Wilson To: Struts Users Mailing List Sent: Friday, January 23, 2004 12:30 PM Subject: JSP to static html... Hi All... I have a specific requirement in my project... I want to convert the JSP pages to static html pages and save them in a local directory... How do I achieve this functionality??? Any suggestions appreciated. Thanks much. -Jacob - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Re: JSP to static html...
Thanks Max. This sounds very good. Your saying that automatically creating an html when the jsp is rendered sounds good. This should solve my problem. We are using websphere 5.0. We are not using ant though... If you can give me little more details on the configuration stuff and how to specify a particular jsp to be converted into an html, that would be great... -Jacob Max Cooper [EMAIL PROTECTED] wrote: View Source ... Save As works generally, but browsers sometimes mess with the HTML in subtle ways (netscape used to add an HTML tag, for instance), so I would be very wary of using that technique (diff users w/diff browser, changes after browser upgrade, etc.). The command-line tools curl or wget should be more trustworthy to deliver the HTML as delivered by the server with no molestation. If you want to automate the process (which I highly recommend if you are really going to do this), you could use Ant to deploy your app and its JSPs on a server and then make requests for all of the pages, saving the responses as build output. Before doing any of this, I would take a detailed look at why you want to render your JSPs and convert them to HTML. It seems likely that there is a better (easier) way to achieve the intended goal. Ant and its various filtering, token-replacing and other abilities may offer a more manageable solution. -Max - Original Message - From: Ron Day To: Struts Users Mailing List Sent: Friday, January 23, 2004 2:28 PM Subject: RE: JSP to static html... View source in browser and save it to xxx.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Pre-poluating values...
Hello Everybody... I have got this generic question... I wan't to use the onLoad event of the javascript function to pre-populate values.For certain reasons, I cannot use the onLoad in the body tag... Hence, I am using the onLoad in an img tag (just created a spacer image specfically for this!!) Is this way really dependable??? Is this idea browser dependent??? Is there any order the browsers use when it downloads the complete page( like the smaller sized images will be downloaded first or vice versa???) I just want to inform that I ain't using Struts here and hence trying to pre-poluate values using a script function just to avoid the innumerable number of if conditions in my jsp??? Actually, I tested this and is working very fine... But, in real time, can we depend on this solution??? Thanks all... Jacob - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
Basic JSTL Question...
Hi... I would appreciate if someone out there helps me with these basic JSTL questions... 1. In c:foreach how do I check whether the collection contains values??? When it has values, it iterates a loop fine... Now, if I want to specify 'No records' how do I do that??? 2. How do I check condition.s.. for eg. I wanna alternate row colors... when I do this, it doesn't work... c:when test=${ (count.index%2) != 0 } tr bgcolor=aa /c:when c:otherwise tr bgcolor=bb /c:otherwise Wat's the right way to do this??? Thanx. -Jacob - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
Javascript question...
Hi Folks... One more javascript question... I have a page that consists of date fields as select boxes... say optionDay, optionMonth, optionYear... I fill the selectboxes calling a javascript function... Now if I have values of day, month, year executing an action. How can I default those values in the select box??? I mean how can I make that particular option 'selected'??? I know we can do that by calling a funtion on the load event... But, I don't want to do it that way as my body tag is generic across all pages... I am trying something like this... script language=javascript function generateYear(optionName,defaultValue) { var s = document.forms[0].elements[optionName]; var today = new Date(); var year = today.getYear(); document.write('select NAME='+optionName+''); document.write('option value=yearYear/option'); for (var i=(year-4);i(year+4);i++ ) { document.write('option value=' + i +'' + i+'/option'); } document.write('/select'); } function generateDay(optionName,defaultValue){ document.write('select NAME='+optionName+''); document.write('option value=dayDay/option'); for (var i=1;i=31;i++ ) { document.write('option value=' + i +'' + i+'/option'); } document.write('/select'); } function generateMonth(optionName,defaultValue){ document.write('select NAME='+optionName+''); document.write('option value=monthMon/option'); document.write('option value=01Jan/option'); document.write('option value=02Feb/option'); document.write('option value=03Mar/option'); document.write('option value=04Apr/option'); document.write('option value=05May/option'); document.write('option value=06Jun/option'); document.write('option value=07Jul/option'); document.write('option value=08Aug/option'); document.write('option value=09Sep/option'); document.write('option value=10Oct/option'); document.write('option value=11Nov/option'); document.write('option value=12Dec/option'); document.write('/select'); } /script and in my html... I say script language=javascript generateMonth(optStartDtMonth,12); generateDay(optStartDtDay,05); generateYear(optStartDtYear,2000); /script I want to make 12, 05, 2000 selected on the load of the page... how do I do that??? I am trying doing something like this... var s = document.forms[0].elements[optionName]; if ( s.options[i].value == defaultValue) { s.options[i].selected = true; } On the click of some thing it works -- if I put the code in the generate year or month or day, if fails to recognize the form element!!! Any suggestions appreciated... Thanks in advance... -Jacob - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: Javascript question...
unfortunately we aren't using Struts here... This is an requirement that comes across all pages -- thinking of making it more generic and Im trying this... Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote:Jacob, Why are you doing this in JavaScript to begin with? Why don't you use the struts html tags to display the select boxes and populate the options lists from collections. You can then set attributes in your form bean and have these fields be defaulted automatically. -Richard -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: Javascript question... Hi Folks... One more javascript question... I have a page that consists of date fields as select boxes... say optionDay, optionMonth, optionYear... I fill the selectboxes calling a javascript function... Now if I have values of day, month, year executing an action. How can I default those values in the select box??? I mean how can I make that particular option 'selected'??? I know we can do that by calling a funtion on the load event... But, I don't want to do it that way as my body tag is generic across all pages... I am trying something like this... function generateYear(optionName,defaultValue) { var s = document.forms[0].elements[optionName]; var today = new Date(); var year = today.getYear(); document.write(''); document.write('Year'); for (var i=(year-4);i document.write('' + i+''); } document.write(''); } function generateDay(optionName,defaultValue){ document.write(''); document.write('Day'); for (var i=1;i document.write('' + i+''); } document.write(''); } function generateMonth(optionName,defaultValue){ document.write(''); document.write('Mon'); document.write('Jan'); document.write('Feb'); document.write('Mar'); document.write('Apr'); document.write('May'); document.write('Jun'); document.write('Jul'); document.write('Aug'); document.write('Sep'); document.write('Oct'); document.write('Nov'); document.write('Dec'); document.write(''); } and in my html... I say generateMonth(optStartDtMonth,12); generateDay(optStartDtDay,05); generateYear(optStartDtYear,2000); I want to make 12, 05, 2000 selected on the load of the page... how do I do that??? I am trying doing something like this... var s = document.forms[0].elements[optionName]; if ( s.options[i].value == defaultValue) { s.options[i].selected = true; } On the click of some thing it works -- if I put the code in the generate year or month or day, if fails to recognize the form element!!! Any suggestions appreciated... Thanks in advance... -Jacob - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: Javascript question...
Richard... I find this list to be more user friendly in terms of responding to questions... Also, not that I do not use Struts at all... for this particular requirement of an old project under maintenance, I am trying to do this... I consider this to be very much knowledge sharing list and hence post questions whenever I have any... thanks is advance... Now, getting back to your question... this is the code... script language=javascript function generateYear(optionName,defaultValue) { var today = new Date(); var year = today.getYear(); document.write('select NAME='+optionName+''); document.write('option value=yearYear/option'); for (var i=(year-4);i(year+4);i++ ) { if(defaultValue == i) { document.write('option value=' + i +'selected' + i+'/option'); } else { document.write('option value=' + i +'' + i+'/option'); } } document.write('/select'); } html script language=javascript generateYear(optStartDtYear,2005); /script /html My idea is to make '2005' selected when the page loads... The above code fails to make '2005' selected!!! If you can make me know the reason, it'd be great... Thanks! Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Jacob, You wrote: unfortunately we aren't using Struts here...? If you aren't using Struts then a) why are you asking this question on a Struts mailing list b) What do you mean then when you write Now if I have values of day, month, year executing an action. How can I default those values in the select box??? Regards, Richard - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: Javascript question...
Oh... thanks buddy... I actually created an option object and finished this... After you saying I checked and yes how stupid I am !!! simple mistakes need an other eye... Thanks again... I did something like this -- this works fine too... var s = document.forms[0]; function generateYear(optionName,defaultValue) { var today = new Date(); var year = today.getYear(); document.write('select NAME='+optionName+''); document.write('option value=yearYear/option'); for (var i=(year-4);i(year+4);i++ ) { if(defaultValue == i) { yearOption = new Option(); yearOption.text= i; yearOption.value= i; s.elements[optionName].options[s.elements[optionName].options.length]=yearOption; yearOption.selected = true; } else { document.write('option value='+i+''+i+'/option'); } } document.write('/select'); } Joe Krause [EMAIL PROTECTED] wrote: You need to put a space in front of the word selected. Right now your HTML output will contain: 2005 This makes the value equal to 2005selected. By putting a space in between the quote and the word selected - you will change the value to 2005 and selected will be picked up correctly. document.write('' + i + ''); You should put double quotes around the value parameter - its cleaner HTML: document.write('' + i + ''); You might have to escape those - I'm not sure. -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 5:00 PM To: Struts Users Mailing List Subject: RE: Javascript question... Richard... I find this list to be more user friendly in terms of responding to questions... Also, not that I do not use Struts at all... for this particular requirement of an old project under maintenance, I am trying to do this... I consider this to be very much knowledge sharing list and hence post questions whenever I have any... thanks is advance... Now, getting back to your question... this is the code... function generateYear(optionName,defaultValue) { var today = new Date(); var year = today.getYear(); document.write(''); document.write('Year'); for (var i=(year-4);i if(defaultValue == i) { document.write('' + i+''); } else { document.write('' + i+''); } } document.write(''); } generateYear(optStartDtYear,2005); My idea is to make '2005' selected when the page loads... The above code fails to make '2005' selected!!! If you can make me know the reason, it'd be great... Thanks! Yee, Richard K,,DMDCWEST wrote: Jacob, You wrote: unfortunately we aren't using Struts here...? If you aren't using Struts then a) why are you asking this question on a Struts mailing list b) What do you mean then when you write Now if I have values of day, month, year executing an action. How can I default those values in the select box??? Regards, Richard - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
Re: Deploying on TOMCAT
Vinitha, Assume 'Tomcat\webapps\root' is your project folder... Create separate folders of images, js, html, styles etc. and place the respective files in the respective folders... Place all your jsps in the root directly... the web-inf should be in your root... in the web-inf place your web.xml and struts-config and all tld files... create a folder lib in your web-inf and place all the jars in the lib folder set your java classpath in your catalina.bat that lies in the bin folder... Run the server and write a action and check... This should work... Hope this helps... -J Vinita Keswani [EMAIL PROTECTED] wrote: Hello, I am trying to deploy my struts application on tomcat..does somebody have a list of do's and dont's for that which paths to set etc...for eg: where does struts-config go? Thanks in advance - Do you Yahoo!? Exclusive Video Premiere - Britney Spears - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
javascript question...
Hi... Is it possible to send a value of a form element from the parent window to the child window like this??? script function go() { var namVal = document.fm1.txtName.value; var newwin=window.open(a.html?Name=namVal); } /script form name=fm1 onSubmit=go() input type=text name=txtName input type=submit value=go /form The above does not work... it will give me 'namVal' as the value rather than the actual typed in value when I try to get request.getParameter How can I achieve this functionality??? I need to pass a form element value when opening a new window. This value is essential at this point coz I perform an action based on this value and then bring the pop up page Suggestions requested please... Thanks! Jacob - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
RE: javascript question...
Thanks Narayanan -- I tried this b4, but this will throw an error... Actually, you need to pass a total string into the open method Prashanth Narayanan [EMAIL PROTECTED] wrote:try var newwin=window.open(a.html?Name=+namVal); -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 4:37 PM To: [EMAIL PROTECTED] Subject: javascript question... Hi... Is it possible to send a value of a form element from the parent window to the child window like this??? function go() { var namVal = document.fm1.txtName.value; var newwin=window.open(a.html?Name=namVal); } [input] [input] The above does not work... it will give me 'namVal' as the value rather than the actual typed in value when I try to get request.getParameter How can I achieve this functionality??? I need to pass a form element value when opening a new window. This value is essential at this point coz I perform an action based on this value and then bring the pop up page Suggestions requested please... Thanks! Jacob - Do you Yahoo!? Exclusive Video Premiere - Britney Spears - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
Re: [OT] RE: javascript question...
You are right... We can reference it using the window opener event and get the value in the child window... But, my problem is that -- inorder to populate the child window I need to execute an action and fetch values from the backend using this value... Is there any other way to solve this??? James Childers [EMAIL PROTECTED] wrote: No, you can't do it that way. But you could create an otherwise unused hidden form element in your parent document, set it with the value you want from within your JavaScript function, and then reference that value from the child window. -= J -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 3:37 PM To: [EMAIL PROTECTED] Subject: javascript question... Hi... Is it possible to send a value of a form element from the parent window to the child window like this??? function go() { var namVal = document.fm1.txtName.value; var newwin=window.open(a.html?Name=namVal); } [input] [input] The above does not work... it will give me 'namVal' as the value rather than the actual typed in value when I try to get request.getParameter How can I achieve this functionality??? I need to pass a form element value when opening a new window. This value is essential at this point coz I perform an action based on this value and then bring the pop up page Suggestions requested please... Thanks! Jacob - Do you Yahoo!? Exclusive Video Premiere - Britney Spears - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
RE: [OT] javascript question...
Im sorry guys... this way works... var newwin=window.open(a.html?Name=+namVal); Rabago, Hubert [EMAIL PROTECTED] wrote: What error were you getting here? -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 3:44 PM To: Struts Users Mailing List Subject: RE: javascript question... Thanks Narayanan -- I tried this b4, but this will throw an error... Actually, you need to pass a total string into the open method Prashanth Narayanan wrote: try var newwin=window.open(a.html?Name=+namVal); -Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 4:37 PM To: [EMAIL PROTECTED] Subject: javascript question... Hi... Is it possible to send a value of a form element from the parent window to the child window like this??? function go() { var namVal = document.fm1.txtName.value; var newwin=window.open(a.html?Name=namVal); } [input] [input] The above does not work... it will give me 'namVal' as the value rather than the actual typed in value when I try to get request.getParameter How can I achieve this functionality??? I need to pass a form element value when opening a new window. This value is essential at this point coz I perform an action based on this value and then bring the pop up page Suggestions requested please... Thanks! Jacob - Do you Yahoo!? Exclusive Video Premiere - Britney Spears - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Exclusive Video Premiere - Britney Spears - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
RE: question on javascript...
Thanks Matt... It sure helped... Actually, now, I tried to put it as a common function like... function getValue(optionName, hiddenValue) { var s = document.forms[0].optionName; for (var i=0; is.options.length; i++) { if ( s.options[i].value == hiddenValue ) { s.options[i].selected = true; break; } } } where optionName is the name of the selectboxes that r in the form -- when I try to use 'optionName' it throws an error when I try to get the length saying option is null... Am I missing something here??? Please let me know... Thanks in advance... -Jacob Kruse, Matt [EMAIL PROTECTED] wrote: This is a basic question... Can I find the index of a select box, if I have the value or the text ??? document.formName.optionName.options[C].selected=true -- This won't work!! You need to loop through each option, checking to see it's value and then checking it. var s = document.formname.optionname; for (var i=0; i if (s.options[i].value==C) { s.selected=true; } } Or, using functions at http://www.mattkruse.com/javascript/validations/ you can do: setInputValue(document.formname.optionname,C); Be careful - multiple options are allowed to have the same value! Matt Kruse - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [ot] Re: question on javascript...
Thanks for the help Mark... when I do this, it says elements.optionName is not null or an object... Any clue??? Thanks! Mark Lowe [EMAIL PROTECTED] wrote:Those variable don't really need to be global. function getValue(form, optionName,hiddenValue) { s = form.elements[optionName]; for(i = 0;i s.options.length;i++) { if(s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } onsomeformevent=getValue(this.form,'foo','bar') Cheers Mark On Monday, October 20, 2003, at 07:55 AM, Jacob Wilson wrote: Thanks Matt... It sure helped... Actually, now, I tried to put it as a common function like... function getValue(optionName, hiddenValue) { var s = document.forms[0].optionName; for (var i=0; i if ( s.options[i].value == hiddenValue ) { s.options[i].selected = true; break; } } } where optionName is the name of the selectboxes that r in the form -- when I try to use 'optionName' it throws an error when I try to get the length saying option is null... Am I missing something here??? Please let me know... Thanks in advance... -Jacob Kruse, Matt wrote: This is a basic question... Can I find the index of a select box, if I have the value or the text ??? document.formName.optionName.options[C].selected=true -- This won't work!! You need to loop through each option, checking to see it's value and then checking it. var s = document.formname.optionname; for (var i=0; i if (s.options[i].value==C) { s.selected=true; } } Or, using functions at http://www.mattkruse.com/javascript/validations/ you can do: setInputValue(document.formname.optionname,C); Be careful - multiple options are allowed to have the same value! Matt Kruse - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [ot] Re: question on javascript...
I get that error when I pass the element name only !! function getValue(form, optionName,hiddenValue) { s = form.elements[optionName]; for(i = 0;i s.options.length;i++) { if(s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } optionName is the element name and the error elements.optionName is not null or an object when I try to use s.options.length... Mark Lowe [EMAIL PROTECTED] wrote: You can specify an index or the name of the element. Likewise with the array of forms in the page.. Some folks prefer using the document.myform.myelement syntax. But you can use the element name also. Cheers Mark On Monday, October 20, 2003, at 03:14 PM, Jeff Kyser wrote: form.elements is an array, and you'd have to specify it by index: s = form.elements[i]; where i was a supplied integer in the range 0..form.elements.length-1, or s = form.optionName; if 'optionName' was a valid name for a form element. HTH, -jeff On Monday, October 20, 2003, at 08:55 AM, Jacob Wilson wrote: Thanks for the help Mark... when I do this, it says elements.optionName is not null or an object... Any clue??? Thanks! Mark Lowe wrote:Those variable don't really need to be global. function getValue(form, optionName,hiddenValue) { s = form.elements[optionName]; for(i = 0;i s.options.length;i++) { if(s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } onsomeformevent=getValue(this.form,'foo','bar') Cheers Mark On Monday, October 20, 2003, at 07:55 AM, Jacob Wilson wrote: Thanks Matt... It sure helped... Actually, now, I tried to put it as a common function like... function getValue(optionName, hiddenValue) { var s = document.forms[0].optionName; for (var i=0; i if ( s.options[i].value == hiddenValue ) { s.options[i].selected = true; break; } } } where optionName is the name of the selectboxes that r in the form -- when I try to use 'optionName' it throws an error when I try to get the length saying option is null... Am I missing something here??? Please let me know... Thanks in advance... -Jacob Kruse, Matt wrote: This is a basic question... Can I find the index of a select box, if I have the value or the text ??? document.formName.optionName.options[C].selected=true -- This won't work!! You need to loop through each option, checking to see it's value and then checking it. var s = document.formname.optionname; for (var i=0; i if (s.options[i].value==C) { s.selected=true; } } Or, using functions at http://www.mattkruse.com/javascript/validations/ you can do: setInputValue(document.formname.optionname,C); Be careful - multiple options are allowed to have the same value! Matt Kruse - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [ot] Re: question on javascript... [solved]
Just tested this... It works Mark... I think I was missing 'document'... Thanks for the help and suggestions... HTML BODY onLoad='initTable(table2);' script language=javascript function getValue(optionName, hiddenValue) { var s = document.frmTest.elements[optionName]; for (var i=0; is.options.length; i++) { if (s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } /script form name=frmTest input type=radio onclick=getValue('abc','Mark') br select name=abc option value=JoeJoe/option option value=JosephJoseph/option option value=JacobJacob/option option value=MarkMark/option /select /form /BODY /HTML Mark Lowe [EMAIL PROTECTED] wrote: I was on the wrong lines anyhow.. forms[] and elements[] deal with the index and/or the names. options[] requires the index. the value is a property of the element not the option (at least i recall things being like that. I'd just pass the value of the element as an argument But my apologies from not reading the question properly in the first place. Cheers Mark On Monday, October 20, 2003, at 03:38 PM, Jacob Wilson wrote: I get that error when I pass the element name only !! function getValue(form, optionName,hiddenValue) { s = form.elements[optionName]; for(i = 0;i s.options.length;i++) { if(s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } optionName is the element name and the error elements.optionName is not null or an object when I try to use s.options.length... Mark Lowe wrote: You can specify an index or the name of the element. Likewise with the array of forms in the page.. Some folks prefer using the document.myform.myelement syntax. But you can use the element name also. Cheers Mark On Monday, October 20, 2003, at 03:14 PM, Jeff Kyser wrote: form.elements is an array, and you'd have to specify it by index: s = form.elements[i]; where i was a supplied integer in the range 0..form.elements.length-1, or s = form.optionName; if 'optionName' was a valid name for a form element. HTH, -jeff On Monday, October 20, 2003, at 08:55 AM, Jacob Wilson wrote: Thanks for the help Mark... when I do this, it says elements.optionName is not null or an object... Any clue??? Thanks! Mark Lowe wrote:Those variable don't really need to be global. function getValue(form, optionName,hiddenValue) { s = form.elements[optionName]; for(i = 0;i s.options.length;i++) { if(s.options[i].value == hiddenValue) { s.options[i].selected = true; break; } } } onsomeformevent=getValue(this.form,'foo','bar') Cheers Mark On Monday, October 20, 2003, at 07:55 AM, Jacob Wilson wrote: Thanks Matt... It sure helped... Actually, now, I tried to put it as a common function like... function getValue(optionName, hiddenValue) { var s = document.forms[0].optionName; for (var i=0; i if ( s.options[i].value == hiddenValue ) { s.options[i].selected = true; break; } } } where optionName is the name of the selectboxes that r in the form -- when I try to use 'optionName' it throws an error when I try to get the length saying option is null... Am I missing something here??? Please let me know... Thanks in advance... -Jacob Kruse, Matt wrote: This is a basic question... Can I find the index of a select box, if I have the value or the text ??? document.formName.optionName.options[C].selected=true -- This won't work!! You need to loop through each option, checking to see it's value and then checking it. var s = document.formname.optionname; for (var i=0; i if (s.options[i].value==C) { s.selected=true; } } Or, using functions at http://www.mattkruse.com/javascript/validations/ you can do: setInputValue(document.formname.optionname,C); Be careful - multiple options are allowed to have the same value! Matt Kruse - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
question on javascript...
Hi... This is a basic question... Can I find the index of a select box, if I have the value or the text ??? select option value=A selectedA/option option value=BB/option option value=CC/option /select If I have the value A or B or C -- Will it be possible for me to do something like this... document.formName.optionName.options[C].selected=true -- This won't work!! Here, if I know the index of C, I can make it selected Please let me know... Thanks. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Basic tag library question
Hi... Is there any tld that is available to handle my input type=image apart from the struts html tld??? I need to make the image disabled or enabled based on the security level that I will be getting from DB... I know we can do this thru the struts html tag lib werein we can set the default attribute to either true or false!! Was wondering whether there are any other taglibs... I checked the input tag lib from jakarta, they do not have it for image!!! Let me know and also please correct me if I had mentioned anything wrong above... Thanks. -Jacob. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
JSTL Question...
Hi, I have a question regarding JSTL. Is there anyway to do sorting of the colums on a table using JSTL. I know there is one table tag that does sorting... But, does it sort all the values that is present in the collection or does it do just page level sorting??? Is there any other tag libr ary that takes all the values present in the collection and does a complete sorting??? -Jacob - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Question on page display while using JSTL...
Hi... I am using Struts in my application. In one of my pages I am using core JSTL tag to iterate a set of collection object (2 rows displayed per page) along with next and previous links so that the other results could be viewed on the click of next... The code is as follows... c:set var=noOfRows value=2 / c:forEach var=actual items=${loginForm.clientCollection} begin=${param.first} end=${param.first + noOfRows - 1} tr td c:out value=${actual.name}/br /td td c:out value=${actual.password}/br /td /tr /c:forEach c:choose c:when test=${param.first 0} a href=confirm.jsp?first=c:out value=${param.first - noOfRows}/Previous/a /c:when c:otherwisenbsp;/c:otherwise /c:choose c:choose c:when test=${param.first + noOfRows 5} a href=confirm.jsp?first=c:out value=${param.first + noOfRows}/Next/a /c:when c:otherwisenbsp;/c:otherwise /c:choose The first time when the page gets displayed the 2 rows are displayed with values and with a 'next' link... When I click on next, I get no results -- I guess at this moment, the collection is empty though the param.first takes the value 2!! Is there anything I am missing??? Kindly advice... -Jacob - Do you Yahoo!? The New Yahoo! Shopping - with improved product search