wood burning stoves 2.0*
The moose likes Struts and the fly likes How Can hide your JSP in Struts2? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How Can hide your JSP in Struts2?" Watch "How Can hide your JSP in Struts2?" New topic
Author

How Can hide your JSP in Struts2?

victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Hi guys,

Is there a method on how to hide your jsp in struts2? You can hide your servlets in web.xml... There should be a style like this in struts2.

I dont want my i don't want my users to go directly to main.jsp because they must login first in the index.jsp. Thank you gurus..

<struts>
<package name="login" namespace="/" extends="struts-default">

<action name="login"
class="lotmovement.action.LoginAction">
<result name="input">/index.jsp</result>
<result name="success">/main.jsp</result>

</action>

</package>
</struts>
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
instead of main.jsp, what the users can see is like mx125.abc or etc..
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

What good would renaming the resource do? A user would still be able to access it. You should look at the declarative security mechanism built into Java: Securing Web Applications.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Thanks for that I will also look into that one. What I mean is that is their a way in struts2 just like in the servlets below? There is a mapping?

<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

victor chiong wrote:What I mean is that is their a way in struts2 just like in the servlets below? There is a mapping?


There is a mapping for Struts in web.xml (in Struts 2, it is actually implemented as a filter).
If you want to protect your pages from being accessed by users who aren't logged in, the best practice is to use the declarative security I linked to earlier.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How Can hide your JSP in Struts2?
 
Similar Threads
Servlet action is currently unavailable Error When Run My Struts Application
Neither BindingResult nor plain target object for bean name 'loginForm
error in output
when i use login validator my validation not work properly
page is not shown only url is showing