Solved

How to add a variable to URL in struts

Posted on 2011-09-12
9
351 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java syntax, or is it Selenium 6 39
Running JavaFX on the Raspberry Pi 27 132
Html split(text) 2 28
Delete .class files at every compile 4 18
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…
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 arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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.

749 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