Win a copy of Spring Boot in Practice this week in the Spring forum!

Bhaskar Reddy

Ranch Hand
+ Follow
since Dec 17, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bhaskar Reddy

Thanks Sudhir, let me check using -

response.sendRedirect(response.encodeRedirectURL(request.getParameter("redirectToClientUrl")));

13 years ago
Thank you for your insight!

Well, coming to think of what I am getting after the redirect -

when I do
it redirects the client URL to http://xxx.xxx.xxx.xxx/<<actual_client_url>>.

what I want to do is to redirect the client URL to <<actual_client_url>>. (I am guessing the 'http://' will not be needed as the URL will be submitted by the browser to look up up for the DNS entry.) Is it possible to do so?
13 years ago
By "Complete URLs", did you mean I need to use "http://www.google.com" - instead of "www.google.com"? If so, I was just curious as to how to form the "Complete URL", because client can try any combination - like "google.com" or "www.google.com" or "http://www.google.com" or some other site that may not even have 'www' in the host name.

Just to remind, I am using GET method to retrieve the "redirectToClientUrl" variable from the html.
13 years ago
What I am trying to do :
1. I have created a small application (servlet, HTML & log4j.properties) that is deployed in a web server. There is a switch (say wireless router) that intercepts clients (who are outside network) trying to access wireless network and routes the request to the HTML in the application. The HTML contains some form info that user needs to fill and submit. When he submits this form, it sends the request to the servlet (via GET), the servlet logs the required info, authenticates user and needs to redirect the user back to the site that he initially tried to access.
2. I got everything working but the redirect part. What I am trying to do for redirection is this -


So, when the client tries to go to "www.google.com", the switch redirects to the HTML, user enters the form data and submits the page. This is then sent to the servlet which logs required info, but is not able to redirect to the site 'www.google.com'. The URL at the client end is changed to http://216.216.216.216/www.google.com (where 216.216.216.216 is the IP address of the web server that hosts this application.)

Seeking experts help in redirecting to an URL (which is outside the application) from servlet.
13 years ago
As Stevi put it, check your action mapping scope definition... I believe we need to set the scope as session (unless you are planning to set the previously entered data manually in both the Action class and JSP)..

do post your code snippet for action mapping so we can better assist...
14 years ago
I guess there is an entry missing for 'required' field validation. Please put an entry (key must be the same as that used in your validator-rules.xml for 'required' field validation) as below -


If you are using struts validation framework, please follow the instructions as provided in the framework (you may read the entire steps as outlined here).

Besides, the error object will have a list of all the errors that occurred during the validation process. You should write your own logic to separate out the field specific errors.
14 years ago
Thank you Merrill for your prompt and useful reply!

But I guess, I am stuck in the myMethodThatTransformsToSSL(regularURL) method! I assumed that I'd be able to construct the entire URL by using the methods in the request object (like getRequestURL or something) but I am not able to get this working with the tiles definition.

Could you let me know how do I set up the URL with 'https' and forward/redirect it to the content page of tiles definition?

I came across the sslext library (from sourceforge) but since our application already is in alpha testing, I didnt want to go that route...
[ November 13, 2007: Message edited by: Bhaskar Reddy ]
14 years ago
In your jsp page you are using -


Struts displays error messages (if any) in the page where html:errors is being used.

the error messages are getting printed on the same page instead of appearing a alert message box.



If you want the error messages to get printed in an alert box, please change your code as provided in the link below -
display error in alert box
14 years ago
Hi Folks,

I am trying to switch from 'http' request to 'https' after successful registration process.
In my struts-config file, I have something like this -


In my RegistrationAction.java, I have the following -


public ActionForward doExecute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws Exception {
// stuff1...
// stuff2...

return actionMapping.findForward("success");
}


I have a method that can generate the 'https' URL (as String) based on actionForward. But I am not sure as to how can I use this in my ActionClass as the ActionClass must return actionForward...

Any help on this is much appreciated.
14 years ago
Also, w.r.t. the validator-rules.xml not being used, can you create a folder under WEB-INF (say 'config') and put both validation.xml & validator-rules.xml there?
And then update your struts-config.xml like below -


Please verify if your server contains the appropriate xml file...
[ November 12, 2007: Message edited by: Bhaskar Reddy ]
14 years ago
You mentioned


MessageResource.properties file is in /web-inf/src/java folder


but in your struts-config.xml, you've specified


I think you must update the struts-config.xml like something below -


Also, please check the filename, is it MessageResource.properties or MessageResources.properties??
[ November 12, 2007: Message edited by: Bhaskar Reddy ]
14 years ago


Not all the form values but some of them which I create dynamically using java script.


Could you mention which form fields are you losing the data? Also, posting your code snippet helps identify the problem better...
14 years ago


Is there some property or something that I need to set in order to use the local validator-rules.xml file.



I suspect that the compiled version of your older code is being referenced by the server...

Could you clear your server's temp dir (where it stores the class file and all that...), recompile the files again, restart server and test it?
14 years ago
I guess you may do something like this -
In your struts-config.xml file, have different form bean names for the same form - one each for each page.


Now, using this form bean name, you may have your validations declared in validation.xml file.
14 years ago
Hey Senthil... H R U? do chk your yahoo mailbox for more qns !
14 years ago