У меня есть 2 приложения, и когда я нажимаю какую-либо ссылку, перейдите к другой и войдите в нее. Первое приложение находится весной, а второе - в Struts2. Я перенаправляю хорошо, но я не знаю, как отправить имя пользователя и пароль с Spring на Struts.Получение параметров из другого приложения
Весна приложение JSP
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<div id="nav" class="ui-corner-left">
<ul>
<li class="nav_openreports" id="nav_openreports">
<a href="${pageContext.servletContext.contextPath}/SpringMethod/goToStrutsApp" target="_blank">
</a><span><spring:message code="label.StrutsApp"/></span>
</li>
</ul>
</div>
контроллер Spring приложение
@RequestMapping(value = "/SpringMethod/goToStrutsApp", method = RequestMethod.GET)
public String goToStrutsApp(final Model model, final HttpSession session) {
final String dominio = this.prop.getProperty("app.url");
final String urlDestino = dominio + this.prop.getProperty("url.strutsApp");
return "redirect:" + urlDestino;
}
Struts приложение Login.action
private Map<Object,Object> session;
protected String userName;
protected String password;
protected UserProvider userProvider;
@Override
public String execute()
{
if (userName == null || userName.length() < 1 ||
password == null || password.length() < 1)
{
addActionError(getText(LocalStrings.ERROR_LOGIN_INCOMPLETE));
return INPUT;
}
try
{
ReportUser user = checkCredentials();
System.out.println("user: "+user);
if (user == null)
{
addActionError(getText(LocalStrings.ERROR_LOGIN_INVALID));
return INPUT;
}
session.put("user", user);
ActionContext.getContext().setLocale(user.getLocale());
if (user.isDashboardUser() &&
(user.getDefaultReport() != null || user.getAlerts().size() > 0))
{
return ORStatics.DASHBOARD_ACTION;
}
return SUCCESS;
}
catch (Exception e)
{
e.printStackTrace();
addActionError(e.toString());
return INPUT;
}
}
/**
* checkCredentials - override this method to customize login authentication
* @return ReportUser, if credentials in order, null otherwise
* @throws ProviderException
*/
protected ReportUser checkCredentials() throws ProviderException {
return userProvider.getUser(userName, password);
}
@SuppressWarnings("unchecked")
public void setSession(Map session)
{
this.session = session;
}
public String getPassword()
{
return password;
}
public String getUserName()
{
return userName;
}
public void setPassword(String password)
{
this.password = password;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public void setUserProvider(UserProvider userProvider)
{
this.userProvider = userProvider;
}