|
Ron, The server side will basically totally ignore your JavaScript - as far as it is concerned it is just more HTML which gets sent to the browser. So if you put something in your JavaScript like if ("<%=request.getAttribute("reloadStreet")%>"="true") dosomething; then this would work - the server would resolve the attribute value and send to the browser either if ("true"="true") dosomething; or if ("false"="true") dosomething; which is a bit wasteful. So instead what you want to do is if there is a particular piece of JavaScript that you only want to run if the value is true, make sure that JavaScript is only sent to the browser under those circumstances, i.e. <% if (((String) request.getAttribute("reloadStreet")).equals ("true")) { %> dosomething; <% } %> then the browser will either receive the dosomething; call, or it won't. It will never see the IF statement because that will be resolved on the server. You can check what is going on by doing View -> Source in your browser when testing it, so you can see what actually gets sent to the browser. HTH, Nigel Gay, Computer Patent Annuities. |---------+------------------------------> | | RPower@xxxxxxxxxx | | | Sent by: | | | java400-l-bounces@m| | | idrange.com | | | | | | | | | 04/05/2005 08:03 AM| | | Please respond to | | | Java Programming on| | | and around the | | | iSeries / AS400 | | | | |---------+------------------------------> >--------------------------------------------------------------------------------------------------------------| | | | To: Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> | | cc: | | Subject: Re: Param question | >--------------------------------------------------------------------------------------------------------------| Can I access that attribute from the Javascript inside the JSP? Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill NGay@xxxxxxxxxxxxx Sent by: java400-l-bounces@xxxxxxxxxxxx 04/05/2005 09:45 AM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> cc Subject Re: Param question Ron, I don't believe you can do "getRequestDispatcher(url)" and put extra parameters on the end of the URL, personally I've never tried it, but I thought you only ever specify the name of a JSP here. This is a bit of an odd way to try passing values through to the JSP... instead why not do request.setAttribute ("reloadStreet", "false"); then in your loop/if do request.setAttribute ("reloadStreet", "true"); then inside the JSP you can retrieve this value via request.getAttribute("reloadStreet") ? HTH, Nigel Gay, Computer Patent Annuities. |---------+------------------------------> | | RPower@xxxxxxxxxx | | | Sent by: | | | java400-l-bounces@m| | | idrange.com | | | | | | | | | 04/05/2005 05:46 AM| | | Please respond to | | | Java Programming on| | | and around the | | | iSeries / AS400 | | | | |---------+------------------------------> >--------------------------------------------------------------------------------------------------------------| | | | To: Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> | | cc: | | Subject: Re: Param question | >--------------------------------------------------------------------------------------------------------------| Bump... Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill RPower@xxxxxxxxxx Sent by: java400-l-bounces@xxxxxxxxxxxx 02/05/2005 03:06 PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> cc Subject Param question I'm trying to reload my left frame nav bar if the user added a new customer that is not showing over there yet. I've created the URL "SaveCustomer?reloadStreet=false" In my class SaveCustomer, I want to change that param reloadStreet to true if it needs to be reloaded. However, when it goes back to the jsp page, it shows as being false, even though the java class set it to true. Here's a snippet of code url = ("schedule_middle.jsp?reloadStreet=false"); // code to go here to update the vector for the left pane and refresh it. Vector vStreet = (Vector)sess.getAttribute("vStreet"); for (int i=0; i < vStreet.size(); i++){ StreetInfo st = (StreetInfo)vStreet.get(i); if(st.getNumber() == customer.getStreetNo()){ if(!(st.checkCivic(customer.getCivicNoInt()))){ st.addCivic(customer.getCivicNoInt()); url = ("schedule_middle.jsp?reloadStreet=true"); } } } conn.close(); sess.setAttribute("customer", customer); sess.setAttribute("disabled", "disabled"); sess.setAttribute("enabled", "enabled"); getServletConfig() .getServletContext() .getRequestDispatcher(url) .forward(req, resp); I don't think I'm setting it correctly though. I'm using post, and I think what I'm doing here is for doGet... Can someone help? Thanks, Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. ******************************************************************************** The information in this message is confidential and may be legally privileged. It is intended solely for the addressee; access to this email by anyone else is unauthorised. If you are not the intended recipient: (1) you are kindly requested to return a copy of this message to the sender indicating that you have received it in error, and to destroy the received copy; and (2) any disclosure or distribution of this message, as well as any action taken or omitted to be taken in reliance on its content, is prohibited and may be unlawful. ******************************************************************************** -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.