struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Takhar <sandeep_tak...@yahoo.com>
Subject Re: Check session/BO @ the view without using Java
Date Thu, 01 Nov 2001 18:51:33 GMT
Interesting question, because this is what Struts is
strong at.

If you really need to add the code, than custom tags
are a better way to go

Here is one way I have seen it done using Struts (note
the forward is to a pre-defined alias of a jsp page so
the path of the jsp is hidden):

<%@ page language="java" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<logic:forward name="welcome"/>

This is a better approach if the forward is necessary
(usually just the main page may contain this
redirect).

Removing the code from the view is always a good thing
to do (IMO).

 -Sandeep
--- "Marc L. de Bruin" <marc@debruin.org> wrote:
> lo,
> 
> I'm a new Struts user (not new on MVC tho). Before
> starting my own 
> Struts-based webapp, I thought it would be wise to
> study some tutorials 
> first. One of these is 
>
http://www.jspinsider.com/tutorials/jsp/struts/strutsintro.view
> . It is 
> the common  logon.jsp/homepage.jsp example.
> 
> However, I don't feel very comfortable with their
> resulting MVC, because 
> they have Java-code within the homepage.jsp to avoid
> 'deep linking'. It 
> looks like this:
> 
> */<%@page contentType="text/html"%>/*
> *<jsp:useBean **id**=*"User"* scope**=*"session"*
> **class**=*"com.jspinsider.struts.User"* />* 
> 
> */<% if (User.isActive() == false){%>/*
>     *<jsp:forward page**=*'logon.jsp'* />*   
> */<%}%>/*
> 
> *<**html**>
> 
> *My question: 
> - Is this the proper way to do it? I didn't expect
> Java-code to appear @ the view;
> - If not, what is the proper way to accomplish such
> a result?
> 
> Tnx,
> 
> Marc.
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

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


Mime
View raw message