RE: sending user to a anchor on a page.
On 12/19/2000 at 5:35 AM John Stauffer wrote: The browser will position the page at the top of the screen if if can't find the anchor tag. Just for the record, Netscape Navigator (through 4.x at least) scrolls to the bottom when it can't find an anchor (and, unlike Explorer, also uses case-sensitive anchors on all platforms) . -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/
RE: sending user to a anchor on a page.
From: Ted Husted [mailto:[EMAIL PROTECTED]] On 12/18/2000 at 5:57 PM Oleson, Rex wrote: as an example lets say that I have a user registration page. If the user inputs some bugus information I would like to return them to that exact area of the page that they need to correct the info. Besides anchors, another way to do this would be by changing the form's focus to the "first" invalid field. Most browsers will scroll to bring a form's field into focus. Not that I know how you would actually do that ... You can do that with Javascript, and I'm relatively certain that it's the only way. It's certainly possible to generate Javascript code using tag extensions; in my most recent project, we have that for precisely this purpose -- sending focus to an input field in error situations. But that's so specialized that I don't think it appropriate for a general-purpose library like struts. Best, Geoff P.S. Hi Thor! | || ||| || r a z o r f i s h , hamburg geoff simmons [ technologist ] tel (49) 40.35 53 77 92 fax (49) 40.35 53 77 20 http://www.razorfish.de
RE: sending user to a anchor on a page.
Ted Husted wrote: another way to do this would be by changing the form's focus to the "first" invalid field. ... Not that I know how you would actually do that ... On 12/19/2000 at 12:45 AM Geoffrey Simmons wrote: You can do that with Javascript, and I'm relatively certain that it's the only way. I just had a vague idea about getting Struts to write the Javascript by somehow changing the focus property for the form tag. Which is the part I'm not sure about. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/
Re: sending user to a anchor on a page.
Ted Husted wrote: Ted Husted wrote: another way to do this would be by changing the form's focus to the "first" invalid field. ... Not that I know how you would actually do that ... On 12/19/2000 at 12:45 AM Geoffrey Simmons wrote: You can do that with Javascript, and I'm relatively certain that it's the only way. I just had a vague idea about getting Struts to write the Javascript by somehow changing the focus property for the form tag. Which is the part I'm not sure about. One approach might be to use a runtime expression as the value of the "focus" attribute. Then, your action could set some appropriate request attribute to the name of the field to be focused on, and your expression could pick up the value. At least with the most recent nightly 1.0 builds, all of the custom tags take runtime expressions for all attributes. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/ Craig
RE: sending user to a anchor on a page.
Perhaps an interstitial jsp like this? % String url = request.getParameter("url"); String anchor = request.getParameter("anchor"); String whereTo = url + "#" + anchor; response.sendRedirect(whereTo); % referenced in action.xml as: ... inputForm="interstitial.jsp?url=page.jspanchor=anchorName" ... If your servlet engine throws an exception on the redirect, you could alternately write in a meta refresh tag, with the downside that the interstitial would show up in the browser. D. -- David Noll, Public Digital [EMAIL PROTECTED] -Original Message- From: Oleson, Rex [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 5:57 PM To: '[EMAIL PROTECTED]' Subject: sending user to a anchor on a page. I was wondering if there was any way to send a user to a specific portion of a page after the action class has executed. as an example lets say that I have a user registration page. If the user inputs some bugus information I would like to return them to that exact area of the page that they need to correct the info. So there is the page userReg.jsp The Form class UserRegForm.java the Action class UserRegAction.java what I was thinking for the action.xml doc is something like action path="/RegisterUser" actionClass="com.userapp.UserRegAction" formAttribute="UserRegForm" formClass="com.userapp.UserRegForm" inputForm="/RegisterUser/userReg.jsp" forward name="success" path="/App/ShowInfo.action"/ forward name="failure" path="/RegisterUser/userReg.jsp"/ forward name="badzip" path="/RegisterUser/userReg.jsp#zip"/ /action where zip is the name of an anchor on userReg.jsp This does not work though all I get is a 404 error and nothing in the webservers output or log files. Any help or suggestions would greatfully appreciated. Thank you, Rex Oleson