aspose file tools*
The moose likes Struts and the fly likes How to call a .do directly? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to call a .do directly?" Watch "How to call a .do directly?" New topic
Author

How to call a .do directly?

j luft
Greenhorn

Joined: Oct 14, 2010
Posts: 3
Why is it when I call a .do method directly,(http://myserver/myapp/myaction.do) it errors out because there is no session?? If I launch the app by default (
(http://myserver/myapp) ,then navigate to the .do I want, it works since there is a session. What am I doing wrong that it isn't creating the session ???
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

it errors out because there is no session?

Can you elaborate on this more please. Where exactly do you get the error. If its in your Action code, then please show us the code of your action...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
j luft
Greenhorn

Joined: Oct 14, 2010
Posts: 3
I have a request processor that I added to forward people to the home page when their session is invalid... I added a line to allow the one action through that I want to be accessed directly (users are sent a link via email).

protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) {
if (request.isRequestedSessionIdValid() == false) {
try {
Log.debug(this.getClass(), "session is no longer valid "+request.getRequestURL());
StringBuffer url = request.getRequestURL();


if ( url != null && url.indexOf("/license.do") > 0 ) {
return (true);
} else {
doForward("/index.jsp", request, response);
}
......

It allows me to get to the page now, but the session is still invalid(puts out the debug). When I get to the page, some of the stuff on the page does not render (html:rewrite for images etc)
and the form is not filled out. When I view source on the page, all the html: tag rendered with jsessionid=6d356793f802c2ba67c5f27bca8a56ea693130656f3fee2cf104b9f03ef56cf5 appended to the end of it... If I launch the app going to the home page first, then go to this action, everything works ok.... How do I get it to render correctly when I go directly to that action in a new browser?
Here is the definition of the action in my struts config;
<action path="/license"
type="app.action.SetupLicenseAgreeAction"
name="laForm"
scope="request">
<forward name="continue" path=".tile.licenseAgree"/>
</action>



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call a .do directly?
 
Similar Threads
Intercepting call in Struts' ActionServlet.process(..)
mapping the root directory servlet for your webapp
JSF application on Apacher web server and Tomcat
URL Pattern
command to run a cron job