sounds like your browser is caching it. try this:
hit the page check the value empty browser cache refresh the page see if the value changed... other then that i hope you know that storing a password in cleartext inside a js file might not be the best idea :) -igor On Thu, Jan 15, 2009 at 4:02 PM, Trent Larson <[email protected]> wrote: > Some time ago, I wrote the following code to generate a javascript resource > with values that are unique to each user. I would have sworn that it > worked, and that it would return a different value depending on which user > was logged in. However, I've just found that it is now always returning the > same value, whichever value was first retrieved. Any ideas? > > Here's the javascript file (named "sensitive.js"): > > function getInfoTraxPassword() { > return "${password}"; > } > > > > Here is the Java code: > > HashMap<String,Object> vars = new HashMap<String,Object>(); > vars.put("password", currentUser.getPassword()); > TextTemplateResourceReference ref = > new TextTemplateResourceReference( > BasePage.class, > "sensitive.js", > "text/javascript", > new Model(vars)){ > @Override > public Time lastModifiedTime() { return Time.now(); } > }; > add(new JavaScriptReference("sensitiveJavascript", ref)); > > > I'm including it in the HTML HEAD this way: > > <script wicket:id="sensitiveJavascript"></script> > > > I'm currently running the Java code inside the Page class, and with my > debugger I see it getting the right value as it steps through the code. Ask > me anything else, I dare you! I swear I've been through every combination > of logic, but once I hit that javascript file the first time, I can never > get any other value for the ${password}. I'm currently using Jetty for the > app server, with nothing (like Apache) in between. > > Any brainstorms are welcome. Thanks! > Trent > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
