Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Can hide your JSP in Struts2?

 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of main.jsp, what the users can see is like mx125.abc or etc..
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic