Solved

How to add a variable to URL in struts

Posted on 2011-09-12
9
348 Views
Last Modified: 2012-05-12
Is it possible to add a parameter to the url at framework level in struts 1.2. I need to get a back a parameter always in the URL. any alternate approaches are also welcome.
0
Comment
Question by:greenearth
  • 5
  • 4
9 Comments
 
LVL 27

Expert Comment

by:rrz
ID: 36526019
I don't use Struts. If you can't find a Struts way, then maybe you could use a Filter.
Please give us more details.
Where is the URL ?
Do you want to add a parameter to each request to your web app ?
0
 

Author Comment

by:greenearth
ID: 36529562
yes, I want to add an authkey to the url always so that my firewall will be able to validate the request coming through. So all the requests needs to have this parameter in the url.
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 36530421
I am still trying to understand your requirements. Is this question the same as your last question ?
http://www.experts-ex  change.com/Software/Server_Software/Web_Servers/Q_27293827.html  
There you posted
><form id="form1" name="form1" method="post" action="print?<%= session.getAttribute("auth") %>  
Which by the way should be
<form id="form1" name="form1" method="post" action="print?authkey=<%= session.getAttribute("auth") %>
>So all the requests needs to have this parameter in the url.
You mean any request from anybody ? If so, then what would be the point of authentication ?
I guess you are talking about requests from forms on your web pages.
If the user has joined a session, then the "auth" attribute should be there for subsequent requests from the user. So are you talking about incidents when the user has no session ? If cookies are a problem, then you could use url rewriting to encode each url in your web app.  
0
 

Author Comment

by:greenearth
ID: 36531199
with url re-writing i have to encode each url and with growing size of the application it would not be a great solution. Is it possible to do this at any framework level, where we can always ask the next request to have this parameter in the url or request header.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 27

Assisted Solution

by:rrz
rrz earned 500 total points
ID: 36531982
>yes, I want to add an authkey to the url always so that my firewall will be able to validate the request coming through.  
I presume the request must make it through the firewall before it gets to your web server. This would require that the authkey be sent to the client in the last response from the server.  
>with url re-writing i have to encode each url and with growing size of the application it would not be a great solution.  
I believe its standard practice. The easiest way is to use JSTL tag;
<c:url>
0
 
LVL 27

Expert Comment

by:rrz
ID: 36531997
In fact, there must be a Struts tag to do what <c:url> does.
0
 

Author Comment

by:greenearth
ID: 36532738
>yes, I want to add an authkey to the url always so that my firewall will be able to validate the request coming through.  
>>>I presume the request must make it through the firewall before it gets to your web server. This would require that the authkey be sent to the client in the last response from the server.  

Yes , this what I am looking for.

>with url re-writing i have to encode each url and with growing size of the application it would not be a great solution.  
>>>I believe its standard practice. The easiest way is to use JSTL tag;
<c:url>

I am not aware if this is the best approach for scenario like this...

0
 
LVL 27

Expert Comment

by:rrz
ID: 36532839
>I am not aware if this is the best approach for scenario like this...  
You mean when you don't use session cookies ?
0
 

Author Closing Comment

by:greenearth
ID: 36720063
we have finally going with cookies as the firewall will be able to intercept the contents of the cookie
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now