Solved

How to add a variable to URL in struts

Posted on 2011-09-12
9
356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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
 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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.

615 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