• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How Can hide your JSP in Struts2?

 
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..
 
Bartender
Posts: 9559
12
Mac OS X Linux 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: 9559
12
Mac OS X Linux 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!