This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts extension with welcome file

 
Jorge Sereno
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I have simple hello world application named "helloexample" where me index.hml, wish is my welcome file defined in web.xml, as the code:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh"
content="0;URL='startPage'">
</head>
</html>
where startPage is an action on struts.xml.
so i just type in browser localhost:8080\helloexample and the aplication starts running the startpage action.

With the “struts.action.extension” set to “html” in my struts.xml it does not work, whithout works fine. I can’t find the problem.
Anyone can help me?

Thankx
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try the following by adding .html extension localhost:8080\helloexample\startPage.html



When you were not overriding the default extension it will add automatically. But when you were overriding it you should explicitly specify it.
 
Jorge Sereno
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thankx for your comment. but helloexample is just the application name, you can´t add extension. when i type "localhost:8080\helloexample" it must read the welcome file and then de refreshed action page wish is "startPage" action.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jorge I was corrected my answer check it once.
 
Jorge Sereno
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohana thankx for the reply. Now it make more sence, and i know that code works.
The problem is when you type "localhost:8080\helloexample\startPage.html" like you said
you are not calling the welcome file, you are calling the action. To call the welcome file
you must type "localhost:8080\helloexample" and this is the problem, it gaves me the error:



I already have the welcome file like you said.
without "struts.action.extension" it works just fine when i type "localhost:8080\helloexample"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic