You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefano Tranquillini <st...@gmail.com> on 2009/06/04 17:39:11 UTC

Return to previous page without javascript

Hi all.
i want to do a thing. When a user do the login (i've the login in the left
part of the web site, so in each pages the user can do the login) i want to
redirect he at the pages that was visit before the login.
how can i do that? (no JS)


-- 
Stefano

RE: Return to previous page without javascript

Posted by Martin Gainty <mg...@hotmail.com>.
if you want to use tuckey URLRewriteFilter

<rule>
<name>Blocked Inline-Images</name>
<note>
Assume we have under http://www.quux-corp.de/~quux/ some pages with inlined GIF graphics. These graphics are
nice, so others directly incorporate them via hyperlinks to their pages. We don't like this practice because
it adds useless traffic to our server.

While we cannot 100% protect the images from inclusion, we can at least restrict the cases where the browser
sends a HTTP Referer header.

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
RewriteRule .*\.gif$ - [F]
</note>
<condition name="referer" operator="notequal">^$</condition>
<condition name="referer" operator="notequal">^http://www.quux-corp.de/~quux/.*$</condition>
<from>.*\.gif$</from>
<to>null</to>
<set type="status">403</set>
</rule>
<rule>
<name>Blocked Inline-Images example 2</name>
<note>
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$
RewriteRule ^inlined-in-foo\.gif$ - [F]
</note>
<condition name="referer" operator="notequal">^$</condition>
<condition name="referer" operator="notequal">.*/foo-with-gif\.html$</condition>
<from>^inlined-in-foo\.gif$</from>
<to>null</to>
<set type="status">403</set>
</rule>
the above rule is an example of sniffing HTTP_REFERER for URL not 
http://www.quux-corp.de/~quux/.*
in which case a 403 is returned

http://tuckey.org/urlrewrite/manual/2.6/guide.html

HTH
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Thu, 11 Jun 2009 10:37:10 -0400
> From: dale@newfield.org
> To: user@struts.apache.org
> Subject: Re: Return to previous page without javascript
> 
> Stefano Tranquillini wrote:
> > i want to do a thing. When a user do the login (i've the login in the left
> > part of the web site, so in each pages the user can do the login) i want to
> > redirect he at the pages that was visit before the login.
> > how can i do that? (no JS)
> 
> Nobody mentioned that the page from which any form is submitted is 
> usually told to the server by the browser even without sticking it in a 
> hidden field (which is more easily spoofed).  The HTTP specification 
> misspelled it as the "referer" field, and you can ask the request object 
> for the value.  http://en.wikipedia.org/wiki/HTTP_referrer
> 
> -Dale
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

Re: Return to previous page without javascript

Posted by Dale Newfield <da...@newfield.org>.
Stefano Tranquillini wrote:
> i want to do a thing. When a user do the login (i've the login in the left
> part of the web site, so in each pages the user can do the login) i want to
> redirect he at the pages that was visit before the login.
> how can i do that? (no JS)

Nobody mentioned that the page from which any form is submitted is 
usually told to the server by the browser even without sticking it in a 
hidden field (which is more easily spoofed).  The HTTP specification 
misspelled it as the "referer" field, and you can ask the request object 
for the value.  http://en.wikipedia.org/wiki/HTTP_referrer

-Dale

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


Re: Return to previous page without javascript

Posted by Stefano Tranquillini <st...@gmail.com>.
Not really. i usued the tiles and i've some problem. i've in mind an idea:
- keep track inside a jsp of the current page (is possible from jsp to put
the url inside the session?, i tried and i fell, no one thing work )
- each action, when success, return to an action that perform a redirect
(but how?, i thought about forward, but is not struts style).



On Sun, Jun 21, 2009 at 11:22, Girish Naik <gi...@gmail.com> wrote:

> Is this issue solved?
>
> Can we do something like
> this<
> http://www.velocityreviews.com/forums/t131347-struts-requestprocessor-override.html
> >
>
> Regards,
> ---------------------------------------------------------
> Girish Naik
> Mobile:-+91-09740091638
> girish.naik@gmail.com
> Henny Youngman<
> http://www.brainyquote.com/quotes/authors/h/henny_youngman.html>
> - "I told the doctor I broke my leg in two places. He told me to quit
> going
> to those places."
>
> On Mon, Jun 15, 2009 at 8:11 PM, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>
> > I tried to use request and URI but:
> > - i'm not able to have some result from this command.
> > - how can i set this value inside the session from a jsp.
> >
> > thanks.
> >
> >
> >
> > --
> > Stefano
> >
>



-- 
Stefano

Re: Return to previous page without javascript

Posted by Girish Naik <gi...@gmail.com>.
Is this issue solved?

Can we do something like
this<http://www.velocityreviews.com/forums/t131347-struts-requestprocessor-override.html>

Regards,
---------------------------------------------------------
Girish Naik
Mobile:-+91-09740091638
girish.naik@gmail.com
Henny Youngman<http://www.brainyquote.com/quotes/authors/h/henny_youngman.html>
- "I told the doctor I broke my leg in two places. He told me to quit
going
to those places."

On Mon, Jun 15, 2009 at 8:11 PM, Stefano Tranquillini <
stefano.tranquillini@gmail.com> wrote:

> I tried to use request and URI but:
> - i'm not able to have some result from this command.
> - how can i set this value inside the session from a jsp.
>
> thanks.
>
>
>
> --
> Stefano
>

Re: Return to previous page without javascript

Posted by Stefano Tranquillini <st...@gmail.com>.
I tried to use request and URI but:
- i'm not able to have some result from this command.
- how can i set this value inside the session from a jsp.

thanks.



-- 
Stefano

Re: Return to previous page without javascript

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Stefano,

> have u got an example or a tutorial about how to return an url?
I think i was using something like #request.uri or #request.getURI(),
read more here:
http://cwiki.apache.org/WW/ognl-basics.html
or simply put it inside a page from action where You can implement
ServletAware or RequestAware.

> the ajax login with tiles is a little bit complex, i don't found any simple
> example online.

it's exactly the same as without tiles, simply put inside that tile a
form and submit it with ajax:
http://docs.jquery.com/Ajax

Tiles is just a composition of a site not functionality.



> how can i take the current url in a jsp?
read my first line.

Best greetings,
Paweł Wielgus.

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


Re: Return to previous page without javascript

Posted by Stefano Tranquillini <st...@gmail.com>.
2009/6/5 Paweł Wielgus <po...@gmail.com>

> Hi Stefano,
> Action execute method result is a string but that is only a result name,
> result can be a redirect to anything You want.
> Read more about resut types in struts2.

have u got an example or a tutorial about how to return an url?


>
>
> Also if the requirement is to come back to a page that You were on,
> maybe there is no need to leave it at all.
> Use ajax to login the user and as a result You can return anything
> for only that part of the page (tile with logon form)

the ajax login with tiles is a little bit complex, i don't found any simple
example online.


>
>
> As for adding information to login form use hidden field or fields, that's
> it.
> Also You can remebmer in session last request as a whole object,
> very tricky for file uploads i think, but You can only save just the
> informations You need,
> and this would be best done by interceptor.


how can i take the current url in a jsp?

>
>
> Hope that helps,
> Paweł Wielgus.
>
>
> 2009/6/5 Stefano Tranquillini <st...@gmail.com>:
> > Hi
> > there's a problem (i think is a problem). I used the tiles. so the login
> is
> > in the left part of the page and is always available for the user (in
> each
> > page there's the login).
> > so i need to store each time the url in each page. how can i do that?
> >  i can do with a Intercepor that simply store in the session the current
> > url, but: how can i forward to the right page after the login?is a good
> > solution? how can i found the url of the previous page?
> > anyway, login is an action so it wants a String as results of  the
> executed,
> > and the result is mapped inside the sturst.xml. How can i pass a url
> instead
> > the SUCCESS or ERROR etc string?
> >
> > 2009/6/4 Paweł Wielgus <po...@gmail.com>
> >
> >> Hi Stefano,
> >> add some kind of information about the page loging form is on, inside
> >> the login form, then in login action resolve where to come back. It
> >> can be also achieved by remebering the last request uri and params if
> >> any. But there is no standard solution for this problem, as far as i
> >> know. You can always face a scenario where user login without any
> >> page, just by constructing a valid url.
> >>
> >> Best greetings,
> >> Pawel Wielgus.
> >>
> >> 2009/6/4, Stefano Tranquillini <st...@gmail.com>:
> >> > Hi all.
> >> > i want to do a thing. When a user do the login (i've the login in the
> >> left
> >> > part of the web site, so in each pages the user can do the login) i
> want
> >> to
> >> > redirect he at the pages that was visit before the login.
> >> > how can i do that? (no JS)
> >> >
> >> >
> >> > --
> >> > Stefano
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > Stefano
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Stefano

Re: Return to previous page without javascript

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Stefano,
Action execute method result is a string but that is only a result name,
result can be a redirect to anything You want.
Read more about resut types in struts2.

Also if the requirement is to come back to a page that You were on,
maybe there is no need to leave it at all.
Use ajax to login the user and as a result You can return anything
for only that part of the page (tile with logon form)

As for adding information to login form use hidden field or fields, that's it.
Also You can remebmer in session last request as a whole object,
very tricky for file uploads i think, but You can only save just the
informations You need,
and this would be best done by interceptor.

Hope that helps,
Paweł Wielgus.


2009/6/5 Stefano Tranquillini <st...@gmail.com>:
> Hi
> there's a problem (i think is a problem). I used the tiles. so the login is
> in the left part of the page and is always available for the user (in each
> page there's the login).
> so i need to store each time the url in each page. how can i do that?
>  i can do with a Intercepor that simply store in the session the current
> url, but: how can i forward to the right page after the login?is a good
> solution? how can i found the url of the previous page?
> anyway, login is an action so it wants a String as results of  the executed,
> and the result is mapped inside the sturst.xml. How can i pass a url instead
> the SUCCESS or ERROR etc string?
>
> 2009/6/4 Paweł Wielgus <po...@gmail.com>
>
>> Hi Stefano,
>> add some kind of information about the page loging form is on, inside
>> the login form, then in login action resolve where to come back. It
>> can be also achieved by remebering the last request uri and params if
>> any. But there is no standard solution for this problem, as far as i
>> know. You can always face a scenario where user login without any
>> page, just by constructing a valid url.
>>
>> Best greetings,
>> Pawel Wielgus.
>>
>> 2009/6/4, Stefano Tranquillini <st...@gmail.com>:
>> > Hi all.
>> > i want to do a thing. When a user do the login (i've the login in the
>> left
>> > part of the web site, so in each pages the user can do the login) i want
>> to
>> > redirect he at the pages that was visit before the login.
>> > how can i do that? (no JS)
>> >
>> >
>> > --
>> > Stefano
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> --
> Stefano
>

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


Re: Return to previous page without javascript

Posted by Stefano Tranquillini <st...@gmail.com>.
Hi
there's a problem (i think is a problem). I used the tiles. so the login is
in the left part of the page and is always available for the user (in each
page there's the login).
so i need to store each time the url in each page. how can i do that?
 i can do with a Intercepor that simply store in the session the current
url, but: how can i forward to the right page after the login?is a good
solution? how can i found the url of the previous page?
anyway, login is an action so it wants a String as results of  the executed,
and the result is mapped inside the sturst.xml. How can i pass a url instead
the SUCCESS or ERROR etc string?

2009/6/4 Paweł Wielgus <po...@gmail.com>

> Hi Stefano,
> add some kind of information about the page loging form is on, inside
> the login form, then in login action resolve where to come back. It
> can be also achieved by remebering the last request uri and params if
> any. But there is no standard solution for this problem, as far as i
> know. You can always face a scenario where user login without any
> page, just by constructing a valid url.
>
> Best greetings,
> Pawel Wielgus.
>
> 2009/6/4, Stefano Tranquillini <st...@gmail.com>:
> > Hi all.
> > i want to do a thing. When a user do the login (i've the login in the
> left
> > part of the web site, so in each pages the user can do the login) i want
> to
> > redirect he at the pages that was visit before the login.
> > how can i do that? (no JS)
> >
> >
> > --
> > Stefano
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Stefano

Re: Return to previous page without javascript

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Stefano,
add some kind of information about the page loging form is on, inside
the login form, then in login action resolve where to come back. It
can be also achieved by remebering the last request uri and params if
any. But there is no standard solution for this problem, as far as i
know. You can always face a scenario where user login without any
page, just by constructing a valid url.

Best greetings,
Pawel Wielgus.

2009/6/4, Stefano Tranquillini <st...@gmail.com>:
> Hi all.
> i want to do a thing. When a user do the login (i've the login in the left
> part of the web site, so in each pages the user can do the login) i want to
> redirect he at the pages that was visit before the login.
> how can i do that? (no JS)
>
>
> --
> Stefano
>

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