You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julian Tillmann <pu...@gmx.de> on 2006/03/27 08:51:00 UTC

User Restriction in a web application?

Hi, 

I'd like to implement the following: 

In a web application a function should only be used by ONE user and if 
another user comes along it should show him the first user's name and give
him the choice whether to kick the first user out or not. 
Is there perhaps something like that in Java? 

thx & ciao 4 now
Julian


-- 
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

-- 
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

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


Re: User Restriction in a web application?

Posted by Ted Husted <te...@gmail.com>.
Not as such.

The general concept is usually called "optimistic locking". It's
optimistic because you don't try to lock people out of the function
until someone else uses it.

A typical usage of optimistic locking is for database updates. A
version key is kept in the row. When someone goes to commit a change,
the version key is compared to the what is now in the row. If the key
changed, then someone else changed the field. If someone has the
system usually displays the current record, and the updated record,
and asks if the user still wants to commit the change. If a change is
committed, the system would update the version key in the process.

Struts Action implements a similar idea in the token processor. A key
is generated and placed in the session and embedded in the form. When
the form is submitted, if the keys don't match or the key is missing,
then the submit can be rejected. If the keys do match, the key is
removed.

In this case, you might want to place an attribute representing the
process in application scope. The name of the user starting the
process could be the key's value. If the process sees that a key is
already there, then it would ask "whether to kick the first user out
or not".

Whenever an application starts using scope to store its own state,
it's a good idea to setup your own Map in the scope to store whatever
values your application is using. So instead of  setting the attribute
directly to application scope, but your own Map in application scope
first, and then put your attribute in the map. In this way, it's
easier to track how you are utilizing application or session scope.

HTH, Ted.

On 3/27/06, Julian Tillmann <pu...@gmx.de> wrote:
> Hi,
>
> I'd like to implement the following:
>
> In a web application a function should only be used by ONE user and if
> another user comes along it should show him the first user's name and give
> him the choice whether to kick the first user out or not.
> Is there perhaps something like that in Java?
>
> thx & ciao 4 now
> Julian

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


Re: Problem with defining dynamical structurs with tiles

Posted by Oswaldo Hernandez <os...@cantv.net>.
Hi, Peter in my post I also xposed the same issue in my app, what I 
managed to do was

1. put an attribute into the base.layout tile.
2. I used the <tiles:useAttribute> tag to define that attribute in 
request scope.
3. Then in the other jsp you can use the struts tags for whatever you 
like, in your case you could use the <logic:equal> tags to decide what 
fragment of markup you want you show.

I don't know if it's the cleanest way but that's wat i've have managed 
to do so far, if any one else wants to share a different approach please do.

If you have any questions on the above just reply.
Cheers.

Peter Neu wrote:

>Hello,
>
>I got this scenario where I have a basic layout (header, nav-bar, body,
>info, footer).
>
>What I need to do is insert dynamically a tiles compenent in a jsp document
>a few levels lower than the main document. 
>
>The main document is siteLayout.jsp the body is entry.jsp. How can I insert
>in entry.jsp. Dynamically tiles tags? 
>
>I need to do something like this: 
>
>----entry.jsp------
>
>Case 1 :  <tiles:insert attribute="fworkSeletion1"/>
>Case 2 :  <tiles:insert attribute="fworkSeletion2"/>
>
>-----tiles-config.xml
>
><definition name="base.definition" path="/WEB-INF/JSP/fwork/siteLayout.jsp">
>		<put name="header" value="/WEB-INF/JSP/fwork/header.jsp" />
>		<put name="navigation" value="/WEB-
>INF/JSP/fwork/navigation.jsp"/>
>		<put name="footer" value="/WEB-INF/JSP/fwork/footer.jsp" />
>	</definition>
>
><definition name="page.entry" extends="base.definition">
>     <put name="body" value="/WEB-INF/JSP/fwork/entry.jsp" />
>      <put name="info" value="/WEB-INF/JSP/fwork/info.jsp" />
>  <put name="fworkSelection1" path="/WEB-INF/JSP/fwork/fworkSeletion1.jsp"
>/>
>  <put name="fworkSelection2" path="/WEB-INF/JSP/fwork/fworkSeletion2.jsp"
>/>
>	</definition>
>
>
>Cheers,
>Peter
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

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


Problem with defining dynamical structurs with tiles

Posted by Peter Neu <pe...@gmx.net>.
Hello,

I got this scenario where I have a basic layout (header, nav-bar, body,
info, footer).

What I need to do is insert dynamically a tiles compenent in a jsp document
a few levels lower than the main document. 

The main document is siteLayout.jsp the body is entry.jsp. How can I insert
in entry.jsp. Dynamically tiles tags? 

I need to do something like this: 

----entry.jsp------

Case 1 :  <tiles:insert attribute="fworkSeletion1"/>
Case 2 :  <tiles:insert attribute="fworkSeletion2"/>

-----tiles-config.xml

<definition name="base.definition" path="/WEB-INF/JSP/fwork/siteLayout.jsp">
		<put name="header" value="/WEB-INF/JSP/fwork/header.jsp" />
		<put name="navigation" value="/WEB-
INF/JSP/fwork/navigation.jsp"/>
		<put name="footer" value="/WEB-INF/JSP/fwork/footer.jsp" />
	</definition>

<definition name="page.entry" extends="base.definition">
     <put name="body" value="/WEB-INF/JSP/fwork/entry.jsp" />
      <put name="info" value="/WEB-INF/JSP/fwork/info.jsp" />
  <put name="fworkSelection1" path="/WEB-INF/JSP/fwork/fworkSeletion1.jsp"
/>
  <put name="fworkSelection2" path="/WEB-INF/JSP/fwork/fworkSeletion2.jsp"
/>
	</definition>


Cheers,
Peter



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