You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Deepa Khetan <de...@gmail.com> on 2005/12/06 05:01:17 UTC

URL in struts

Hi,

Just a bit of a question. Can i do some thing in Struts, which will enable
me to show the same URL all the time, for my aplication?? i mean i do not
want to show in the URL which action mapping i am calling, as in,
https://<IpAddress>     thats it, for all my actions??

Regards,
Deepa

Re: URL in struts

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Not *entirely* true about bookmarking either, although admittedly it is 
more work...

I had one frame-based site that required bookmarkability (is that a 
word?) on every page.  To accomplish that, I had a "Bookmark This Page" 
link that fired a Javascript function to add the appropriate URL.  I 
then had a filter in place that checked for a value in session that 
indicated the frameset had been properly set up.  This only got set when 
the user accessed the "appropriate" starting page.  So, if the filter 
saw a request come in for a "non-appropriate" page, it redirected to the 
starting page, which had a few lines of Javascript to send them back to 
the originally requested page (it's nn intercept pattern, much like a 
j_security servlet does for security).  The net effect was that when 
they clicked their bookmark, they were right back on the page they 
wanted to be on.

Like I said, more work, but really not a lot, and accomplishes the goal.

Frank

Laurie Harper wrote:
> Michael Jouravlev wrote:
> 
>> On 12/5/05, Laurie Harper <la...@holoweb.net> wrote:
>>
>>> Or the fourth option is to use framesets. Of course if you do this, with
>>> any of these approaches, you'll be causing your users pain in that there
>>> will be no way they can bookmark pages and the browser's Refresh option
>>> will become useless (since it would just reload the front page, not the
>>> page the user was currently on)...
>>
>>
>> The remark about refresh is not true. Check any of my samples, for
>> example, this one:
>> http://superinterface.com/strutsdialog/crudactionlite.do Open in a new
>> window, click on buttons, see how application reacts. Then notice is
>> Back button enabled ;-) And, of course, you can refresh any view at
>> any time. Why it should stop working? The state is kept on the server.
>> You can leave the site and then type its address in the address bar
>> and there you are again, in the same state on the same page.
> 
> 
> Fair enough, I should have said that the browser's Refresh option will 
> become useless *unless you take steps to preserve application state in 
> the session* :-) The bookmarking point is still valid though.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: URL in struts

Posted by Laurie Harper <la...@holoweb.net>.
Michael Jouravlev wrote:
> On 12/5/05, Laurie Harper <la...@holoweb.net> wrote:
>> Or the fourth option is to use framesets. Of course if you do this, with
>> any of these approaches, you'll be causing your users pain in that there
>> will be no way they can bookmark pages and the browser's Refresh option
>> will become useless (since it would just reload the front page, not the
>> page the user was currently on)...
> 
> The remark about refresh is not true. Check any of my samples, for
> example, this one:
> http://superinterface.com/strutsdialog/crudactionlite.do Open in a new
> window, click on buttons, see how application reacts. Then notice is
> Back button enabled ;-) And, of course, you can refresh any view at
> any time. Why it should stop working? The state is kept on the server.
> You can leave the site and then type its address in the address bar
> and there you are again, in the same state on the same page.

Fair enough, I should have said that the browser's Refresh option will 
become useless *unless you take steps to preserve application state in 
the session* :-) The bookmarking point is still valid though.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: URL in struts

Posted by Michael Jouravlev <jm...@gmail.com>.
Got mistake to fix. Instead this:
> Michael Jouravlev wrote:
> You can go with a more elaborate path to avoid problems with Back
> button and implicit resubmits on page refresh. In this case you accept
> an initial request, no matter GET or POST. Then you redirect to a
> particular action processing the request. It changes the application
> state and saves it in the session. Then you redirect to the same front
> action.

must read:
You can go with a more elaborate path to avoid problems with Back
button and implicit resubmits on page refresh. In this case you accept
an initial request, no matter GET or POST. Then you *forward* to a
particular action processing the request. It changes the application
state and saves it in the session. Then you *redirect* to the same front
action.

On 12/5/05, Laurie Harper <la...@holoweb.net> wrote:
> Or the fourth option is to use framesets. Of course if you do this, with
> any of these approaches, you'll be causing your users pain in that there
> will be no way they can bookmark pages and the browser's Refresh option
> will become useless (since it would just reload the front page, not the
> page the user was currently on)...

The remark about refresh is not true. Check any of my samples, for
example, this one:
http://superinterface.com/strutsdialog/crudactionlite.do Open in a new
window, click on buttons, see how application reacts. Then notice is
Back button enabled ;-) And, of course, you can refresh any view at
any time. Why it should stop working? The state is kept on the server.
You can leave the site and then type its address in the address bar
and there you are again, in the same state on the same page.

Michael.

--
Struts Dialogs: code-behind for Struts
http://struts.sourceforge.net/strutsdialogs/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: URL in struts

Posted by Deepa Khetan <de...@gmail.com>.
In Fact, I have made the application in the way in which, back and refresh
buttons cannot be used. If the user at any point on time clicks back or
refresh, he is logged out and his session expires!! Also, since i am
maintaining session and security for the site, bookmarking of pages is not
allowed. so, this is not the issue.

The issue is, if the user has the URL for an Action with him, he can copy
paste that to anothr browser and try to access the function. Although the
session control i am doing, does not allow this, but in some places, it
throws NullPointer Exceptions!! Again, This can be controlled by putting
appropriate null checks, but mine being a big project, i want to control it
somehow single handedly and not depend on each developer!! So, i thot if i
can somehow restrict showing the URl on teh browser!!



On 12/6/05, Laurie Harper <la...@holoweb.net> wrote:
>
> Michael Jouravlev wrote:
> > On 12/5/05, Deepa Khetan <de...@gmail.com> wrote:
> >> Hi,
> >>
> >> Just a bit of a question. Can i do some thing in Struts, which will
> enable
> >> me to show the same URL all the time, for my aplication?? i mean i do
> not
> >> want to show in the URL which action mapping i am calling, as in,
> >> https://<IpAddress>     thats it, for all my actions??
> >
> > Sure. In a "normal" non-Ajax world you still need to have one action
> > that processes requests. Basically, a front controller. Then you do
> > in-server forward to an actual action that serves the request, and it
> > forwards to a JSP page to display a view. In this case either all
> > requests should be POSTs to hide parameters, or you need to do a
> > redirect to a view to hide them (see second option).
> >
> > You can go with a more elaborate path to avoid problems with Back
> > button and implicit resubmits on page refresh. In this case you accept
> > an initial request, no matter GET or POST. Then you redirect to a
> > particular action processing the request. It changes the application
> > state and saves it in the session. Then you redirect to the same front
> > action. It pulls application state from the session and forwards to a
> > view, corresponding to the state. How front action knows that this
> > time it should render a view instead of forwarding to processing
> > action? Simple. The redirect request (1) has GET type and (2) is
> > empty, that is, no parameters.
> >
> > The third option known to me is using Ajax and updating page fragments
> > without reloading the whole page.
> >
> > Michael.
>
> Or the fourth option is to use framesets. Of course if you do this, with
> any of these approaches, you'll be causing your users pain in that there
> will be no way they can bookmark pages and the browser's Refresh option
> will become useless (since it would just reload the front page, not the
> page the user was currently on)...
>
> Before you ask if/how, ask yourself whether you really want to do this :)
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: URL in struts

Posted by Laurie Harper <la...@holoweb.net>.
Michael Jouravlev wrote:
> On 12/5/05, Deepa Khetan <de...@gmail.com> wrote:
>> Hi,
>>
>> Just a bit of a question. Can i do some thing in Struts, which will enable
>> me to show the same URL all the time, for my aplication?? i mean i do not
>> want to show in the URL which action mapping i am calling, as in,
>> https://<IpAddress>     thats it, for all my actions??
> 
> Sure. In a "normal" non-Ajax world you still need to have one action
> that processes requests. Basically, a front controller. Then you do
> in-server forward to an actual action that serves the request, and it
> forwards to a JSP page to display a view. In this case either all
> requests should be POSTs to hide parameters, or you need to do a
> redirect to a view to hide them (see second option).
> 
> You can go with a more elaborate path to avoid problems with Back
> button and implicit resubmits on page refresh. In this case you accept
> an initial request, no matter GET or POST. Then you redirect to a
> particular action processing the request. It changes the application
> state and saves it in the session. Then you redirect to the same front
> action. It pulls application state from the session and forwards to a
> view, corresponding to the state. How front action knows that this
> time it should render a view instead of forwarding to processing
> action? Simple. The redirect request (1) has GET type and (2) is
> empty, that is, no parameters.
> 
> The third option known to me is using Ajax and updating page fragments
> without reloading the whole page.
> 
> Michael.

Or the fourth option is to use framesets. Of course if you do this, with 
any of these approaches, you'll be causing your users pain in that there 
will be no way they can bookmark pages and the browser's Refresh option 
will become useless (since it would just reload the front page, not the 
page the user was currently on)...

Before you ask if/how, ask yourself whether you really want to do this :)

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: URL in struts

Posted by Michael Jouravlev <jm...@gmail.com>.
On 12/5/05, Deepa Khetan <de...@gmail.com> wrote:
> Hi,
>
> Just a bit of a question. Can i do some thing in Struts, which will enable
> me to show the same URL all the time, for my aplication?? i mean i do not
> want to show in the URL which action mapping i am calling, as in,
> https://<IpAddress>     thats it, for all my actions??

Sure. In a "normal" non-Ajax world you still need to have one action
that processes requests. Basically, a front controller. Then you do
in-server forward to an actual action that serves the request, and it
forwards to a JSP page to display a view. In this case either all
requests should be POSTs to hide parameters, or you need to do a
redirect to a view to hide them (see second option).

You can go with a more elaborate path to avoid problems with Back
button and implicit resubmits on page refresh. In this case you accept
an initial request, no matter GET or POST. Then you redirect to a
particular action processing the request. It changes the application
state and saves it in the session. Then you redirect to the same front
action. It pulls application state from the session and forwards to a
view, corresponding to the state. How front action knows that this
time it should render a view instead of forwarding to processing
action? Simple. The redirect request (1) has GET type and (2) is
empty, that is, no parameters.

The third option known to me is using Ajax and updating page fragments
without reloading the whole page.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org